Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
AdcSampleFiller_tool.cc
Go to the documentation of this file.
1
// AdcSampleFiller_tool.cc
2
3
#include "
AdcSampleFiller.h
"
4
#include <iostream>
5
6
using
std::string
;
7
using
std::cout;
8
using
std::endl
;
9
10
//**********************************************************************
11
// Class methods.
12
//**********************************************************************
13
14
AdcSampleFiller::AdcSampleFiller
(
fhicl::ParameterSet
const
&
ps
)
15
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)),
16
m_AdcUnderflow(ps.
get
<unsigned
int
>(
"AdcUnderflow"
)),
17
m_AdcOverflow(ps.
get
<unsigned
int
>(
"AdcOverflow"
)) {
18
const
string
myname =
"AdcSampleFiller::ctor: "
;
19
if
(
m_LogLevel
>= 1 ) {
20
cout << myname <<
"Configuration parameters:"
<<
endl
;
21
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
22
cout << myname <<
" AdcUnderflow: "
<<
m_AdcUnderflow
<<
endl
;
23
cout << myname <<
" AdcOverflow: "
<<
m_AdcOverflow
<<
endl
;
24
}
25
}
26
27
//**********************************************************************
28
29
DataMap
AdcSampleFiller::update
(
AdcChannelData
& acd)
const
{
30
const
string
myname =
"AdcSampleFiller::update: "
;
31
AdcIndex
nsam = acd.
raw
.size();
32
acd.
samples
.resize(nsam,
AdcChannelData::badSignal
());
33
acd.
flags
.resize(nsam,
AdcGood
);
34
AdcPedestal
ped = acd.
pedestal
;
35
if
(
m_LogLevel
>= 2 ) {
36
cout << myname <<
"# samples: "
<< nsam <<
endl
;
37
cout << myname <<
" Pedestal: "
<< ped <<
endl
;
38
}
39
if
( ped ==
AdcChannelData::badSignal
() ) {
40
cout << myname <<
"Pedestal is not set."
<<
endl
;
41
return
DataMap
(1);
42
}
43
AdcIndex
nlo = 0;
44
AdcIndex
nhi = 0;
45
AdcIndex
nbad = 0;
46
for
(
AdcIndex
isam=0; isam<nsam; ++isam ) {
47
AdcIndex
adc
= acd.
raw
[isam];
48
acd.
samples
[isam] = adc - ped;
49
if
( adc <=
m_AdcUnderflow
) {
50
acd.
flags
[isam] =
AdcUnderflow
;
51
++nlo;
52
}
else
if
( adc >=
m_AdcOverflow
) {
53
acd.
flags
[isam] =
AdcOverflow
;
54
++nhi;
55
}
56
if
( adc < m_AdcUnderflow || adc >
m_AdcOverflow
) ++nbad;
57
}
58
acd.
sampleUnit
=
"ADC count"
;
59
DataMap
res(0);
60
res.
setInt
(
"nSample"
, nsam);
61
res.
setInt
(
"nUnderflow"
, nlo);
62
res.
setInt
(
"nOverflow"
, nhi);
63
res.
setInt
(
"nOutOfRange"
, nbad);
64
return
res;
65
}
66
67
//**********************************************************************
68
69
DataMap
AdcSampleFiller::view
(
const
AdcChannelData
& acd)
const
{
70
AdcChannelData
acdtmp;
71
acdtmp.
samples
= acd.
samples
;
72
return
update
(acdtmp);
73
}
74
75
//**********************************************************************
76
77
DEFINE_ART_CLASS_TOOL
(
AdcSampleFiller
)
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
AdcSampleFiller::update
DataMap update(AdcChannelData &acd) const override
Definition:
AdcSampleFiller_tool.cc:29
AdcSampleFiller::view
DataMap view(const AdcChannelData &acd) const override
Definition:
AdcSampleFiller_tool.cc:69
string
std::string string
Definition:
nybbler.cc:12
AdcChannelData::sampleUnit
Name sampleUnit
Definition:
AdcChannelData.h:133
adc
int16_t adc
Definition:
CRTFragment.hh:202
AdcUnderflow
const AdcFlag AdcUnderflow
Definition:
AdcTypes.h:33
AdcSampleFiller::m_LogLevel
int m_LogLevel
Definition:
AdcSampleFiller.h:53
AdcChannelData
Definition:
AdcChannelData.h:95
AdcSampleFiller::m_AdcOverflow
AdcIndex m_AdcOverflow
Definition:
AdcSampleFiller.h:55
AdcGood
const AdcFlag AdcGood
Definition:
AdcTypes.h:32
AdcChannelData::badSignal
static Index badSignal()
Definition:
AdcChannelData.h:115
AdcOverflow
const AdcFlag AdcOverflow
Definition:
AdcTypes.h:34
AdcSampleFiller
Definition:
AdcSampleFiller.h:39
DataMap::setInt
void setInt(Name name, int val)
Definition:
DataMap.h:131
AdcSampleFiller::m_AdcUnderflow
AdcIndex m_AdcUnderflow
Definition:
AdcSampleFiller.h:54
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
AdcChannelData::raw
AdcCountVector raw
Definition:
AdcChannelData.h:130
AdcIndex
unsigned int AdcIndex
Definition:
AdcTypes.h:15
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
AdcSampleFiller.h
AdcSampleFiller::AdcSampleFiller
AdcSampleFiller(fhicl::ParameterSet const &ps)
Definition:
AdcSampleFiller_tool.cc:14
AdcChannelData::pedestal
AdcSignal pedestal
Definition:
AdcChannelData.h:128
AdcPedestal
float AdcPedestal
Definition:
AdcTypes.h:25
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
AdcChannelData::flags
AdcFlagVector flags
Definition:
AdcChannelData.h:135
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11