Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
AdcRegularSignalFinder_tool.cc
Go to the documentation of this file.
1
// AdcRegularSignalFinder_tool.cc
2
3
#include "
AdcRegularSignalFinder.h
"
4
#include <iostream>
5
6
using
std::string
;
7
using
std::cout;
8
using
std::endl
;
9
10
using
Index
=
AdcIndex
;
11
12
//**********************************************************************
13
// Class methods.
14
//**********************************************************************
15
16
AdcRegularSignalFinder::
17
AdcRegularSignalFinder
(
AdcIndex
per,
AdcIndex
len,
int
lev)
18
: m_LogLevel(lev),
19
m_Period(per),
20
m_Length(len) {
21
const
string
myname =
"AdcRegularSignalFinder::ctor: "
;
22
if
(
m_LogLevel
>= 1 ) {
23
cout << myname <<
"Configuration parameters:"
<<
endl
;
24
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
25
cout << myname <<
" Period: "
<<
m_Period
<<
endl
;
26
cout << myname <<
" Length: "
<<
m_Length
<<
endl
;
27
}
28
}
29
30
//**********************************************************************
31
32
AdcRegularSignalFinder::
33
AdcRegularSignalFinder
(
fhicl::ParameterSet
const
&
ps
)
34
:
AdcRegularSignalFinder
(
35
ps.
get
<unsigned
int
>(
"Period"
),
36
ps.
get
<unsigned
int
>(
"Length"
),
37
ps.
get
<
int
>(
"LogLevel"
)
38
) { }
39
40
//**********************************************************************
41
42
DataMap
AdcRegularSignalFinder::update
(
AdcChannelData
& acd)
const
{
43
const
string
myname =
"AdcRegularSignalFinder::update: "
;
44
Index
nsam = acd.
samples
.size();
45
Index
nper =
m_Period
;
46
Index
nlen =
m_Length
== 0 ?
m_Period
:
m_Length
;
47
if
( nper == 0 ) {
48
if
( acd.
rois
.size() > 0 ) {
49
AdcRoi
roi = acd.
rois
[0];
50
AdcIndex
itck1 = roi.first;
51
AdcIndex
itck2 = roi.second + 1;
52
if
( itck2 > itck1 ) {
53
nper = itck2 - itck1;
54
nlen = nper;
55
if
( acd.
rois
.size() > 1 ) {
56
roi = acd.
rois
[1];
57
itck1 = roi.first;
58
itck2 = roi.second + 1;
59
if
( itck2 > itck1 ) nlen = itck2 - itck1;
60
}
61
}
else
{
62
cout << myname <<
"WARNING: Input ROI does not specify a valid period."
<<
endl
;
63
}
64
}
else
{
65
cout << myname <<
"WARNING: Input ROI to specify period is not present."
<<
endl
;
66
}
67
}
68
Index
nroi = 0;
69
acd.
rois
.clear();
70
if
( nsam > 0 && nper > 0 ) {
71
acd.
signal
.resize(nsam,
true
);
72
Index
nrem = nsam % nper;
73
nroi = nsam/nper + (nrem>0);
74
for
(
Index
iroi=0; iroi<nroi; ++iroi ) {
75
Index
isam1 = nper*iroi;
76
Index
isam2 = isam1 + nlen;
77
Index
isam3 = isam1 + nper;
78
if
( isam2 > nsam ) isam2 = nsam;
79
if
( isam3 > nsam ) isam3 = nsam;
80
for
(
Index
isam=isam2; isam<isam3; ++isam ) {
81
acd.
signal
[isam] =
false
;
82
}
83
acd.
rois
.emplace_back(isam1, isam2-1);
84
}
85
}
else
{
86
acd.
signal
.resize(nsam,
false
);
87
}
88
DataMap
res(0);
89
res.
setInt
(
"roiPeriod"
, nper);
90
res.
setInt
(
"roiLength"
, nlen);
91
res.
setInt
(
"roiCount"
, nroi);
92
return
res;
93
}
94
95
//**********************************************************************
96
97
DataMap
AdcRegularSignalFinder::view
(
const
AdcChannelData
& acd)
const
{
98
AdcChannelData
acdtmp;
99
acdtmp.
samples
= acd.
samples
;
100
return
update
(acdtmp);
101
}
102
103
//**********************************************************************
104
105
DEFINE_ART_CLASS_TOOL
(
AdcRegularSignalFinder
)
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
AdcRegularSignalFinder.h
AdcChannelTool::Index
unsigned int Index
Definition:
AdcChannelTool.h:58
AdcRegularSignalFinder
Definition:
AdcRegularSignalFinder.h:40
string
std::string string
Definition:
nybbler.cc:12
AdcRoi
std::pair< AdcIndex, AdcIndex > AdcRoi
Definition:
AdcTypes.h:54
Index
unsigned int Index
Definition:
sspmapmaker_v1.c:14
AdcChannelData
Definition:
AdcChannelData.h:95
AdcRegularSignalFinder::m_LogLevel
int m_LogLevel
Definition:
AdcRegularSignalFinder.h:57
AdcRegularSignalFinder::m_Length
AdcIndex m_Length
Definition:
AdcRegularSignalFinder.h:59
AdcChannelData::rois
AdcRoiVector rois
Definition:
AdcChannelData.h:137
DataMap::setInt
void setInt(Name name, int val)
Definition:
DataMap.h:131
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
AdcRegularSignalFinder::AdcRegularSignalFinder
AdcRegularSignalFinder(AdcIndex per, AdcIndex len, int lev)
Definition:
AdcRegularSignalFinder_tool.cc:17
AdcIndex
unsigned int AdcIndex
Definition:
AdcTypes.h:15
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
AdcRegularSignalFinder::view
DataMap view(const AdcChannelData &acd) const override
Definition:
AdcRegularSignalFinder_tool.cc:97
AdcChannelData::signal
AdcFilterVector signal
Definition:
AdcChannelData.h:136
AdcRegularSignalFinder::update
DataMap update(AdcChannelData &acd) const override
Definition:
AdcRegularSignalFinder_tool.cc:42
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
DataMap
Definition:
DataMap.h:43
AdcChannelData::samples
AdcSignalVector samples
Definition:
AdcChannelData.h:131
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
AdcRegularSignalFinder::m_Period
AdcIndex m_Period
Definition:
AdcRegularSignalFinder.h:58
Generated by
1.8.11