Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
AdcSampleScaler_tool.cc
Go to the documentation of this file.
1
// AdcSampleScaler_tool.cc
2
3
#include "
AdcSampleScaler.h
"
4
#include <iostream>
5
6
using
std::string
;
7
using
std::cout;
8
using
std::endl
;
9
10
using
Index
=
unsigned
int
;
11
12
//**********************************************************************
13
// Class methods.
14
//**********************************************************************
15
16
AdcSampleScaler::AdcSampleScaler
(
fhicl::ParameterSet
const
&
ps
)
17
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)),
18
m_ScaleFactor(ps.
get
<
float
>(
"ScaleFactor"
)),
19
m_OutputUnit(ps.
get
<
string
>(
"OutputUnit"
)),
20
m_InputUnit(ps.
get
<
string
>(
"InputUnit"
)) {
21
const
string
myname =
"AdcSampleScaler::ctor: "
;
22
if
(
m_LogLevel
>= 1 ) {
23
cout << myname <<
"Parameters:"
<<
endl
;
24
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
25
cout << myname <<
" ScaleFactor: "
<<
m_ScaleFactor
<<
endl
;
26
cout << myname <<
" OutputUnit: "
<<
m_OutputUnit
<<
endl
;
27
cout << myname <<
" InputUnit: "
<<
m_InputUnit
<<
endl
;
28
}
29
}
30
31
//**********************************************************************
32
33
DataMap
AdcSampleScaler::update
(
AdcChannelData
& acd)
const
{
34
const
string
myname =
"AdcSampleScaler::update: "
;
35
if
(
m_LogLevel
>= 2 ) cout <<
"Processing run "
<< acd.
run
() <<
" event "
<< acd.
event
()
36
<<
" channel "
<< acd.
channel
() <<
endl
;
37
DataMap
ret;
38
39
// Check input data unit.
40
int
unitCheck = 0;
41
if
(
m_InputUnit
.size() ) {
42
if
( acd.
sampleUnit
.size() == 0 ) {
43
cout << myname <<
"WARNING: Input data does not have a sample unit."
<<
endl
;
44
unitCheck = 1;
45
}
else
if
( acd.
sampleUnit
!=
m_InputUnit
) {
46
cout << myname <<
"WARNING: Unexpected input data unit: "
<< acd.
sampleUnit
47
<<
" != "
<<
m_InputUnit
<<
endl
;
48
unitCheck = 2;
49
}
50
}
51
52
// Scale samples.
53
for
(
float
&
sam
: acd.
samples
) sam *=
m_ScaleFactor
;
54
if
(
m_OutputUnit
.size() ) acd.
sampleUnit
=
m_OutputUnit
;
55
56
ret.
setInt
(
"acsUnitCheck"
, unitCheck);
57
ret.
setInt
(
"acsSampleCount"
, acd.
samples
.size());
58
59
return
ret;
60
}
61
62
//**********************************************************************
63
64
DEFINE_ART_CLASS_TOOL
(
AdcSampleScaler
)
AdcSampleScaler::AdcSampleScaler
AdcSampleScaler(fhicl::ParameterSet const &ps)
Definition:
AdcSampleScaler_tool.cc:16
AdcSampleScaler::m_ScaleFactor
float m_ScaleFactor
Definition:
AdcSampleScaler.h:33
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
reco_momentum_tuples.float
float
Definition:
reco_momentum_tuples.py:12
string
std::string string
Definition:
nybbler.cc:12
AdcChannelData::sampleUnit
Name sampleUnit
Definition:
AdcChannelData.h:133
Index
unsigned int Index
Definition:
sspmapmaker_v1.c:14
AdcChannelData
Definition:
AdcChannelData.h:95
cache_state.sam
sam
Definition:
cache_state.py:334
AdcSampleScaler.h
AdcChannelData::run
AdcIndex run() const
Definition:
AdcChannelData.h:174
AdcSampleScaler::update
DataMap update(AdcChannelData &acd) const override
Definition:
AdcSampleScaler_tool.cc:33
DataMap::setInt
void setInt(Name name, int val)
Definition:
DataMap.h:131
AdcChannelData::event
AdcIndex event() const
Definition:
AdcChannelData.h:176
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
AdcSampleScaler::m_LogLevel
int m_LogLevel
Definition:
AdcSampleScaler.h:32
AdcChannelData::channel
Channel channel() const
Definition:
AdcChannelData.h:199
AdcSampleScaler::m_OutputUnit
std::string m_OutputUnit
Definition:
AdcSampleScaler.h:34
AdcSampleScaler
Definition:
AdcSampleScaler.h:19
AdcSampleScaler::m_InputUnit
std::string m_InputUnit
Definition:
AdcSampleScaler.h:35
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
Generated by
1.8.11