Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
FembMappedAdcModifier_tool.cc
Go to the documentation of this file.
1
// FembMappedAdcModifier_tool.cc
2
3
#include "
FembMappedAdcModifier.h
"
4
#include "
dunecore/ArtSupport/DuneToolManager.h
"
5
#include "TSystem.h"
6
#include <iostream>
7
#include <sstream>
8
9
using
std::string
;
10
using
std::cout;
11
using
std::endl
;
12
using
std::ostringstream;
13
14
using
Name
=
std::string
;
15
using
ToolPtr
= std::unique_ptr<TpcDataTool>;
16
17
//**********************************************************************
18
19
FembMappedAdcModifier::FembMappedAdcModifier
(
fhicl::ParameterSet
const
&
ps
)
20
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)),
21
m_ToolBase(ps.
get
<
Name
>(
"ToolBase"
)),
22
m_DirName(ps.
get
<
Name
>(
"DirName"
)) {
23
const
string
myname =
"FembMappedAdcModifier::ctor: "
;
24
if
(
m_LogLevel
>= 1 ) {
25
cout << myname <<
" Log level: "
<<
m_LogLevel
<<
endl
;
26
cout << myname <<
" Tool base: "
<<
m_ToolBase
<<
endl
;
27
cout << myname <<
" Fcl dir: "
<<
m_DirName
<<
endl
;
28
}
29
}
30
31
//**********************************************************************
32
33
DataMap
FembMappedAdcModifier::view
(
const
AdcChannelData
& acd)
const
{
34
DataMap
result
;
35
AdcChannelData
acdtmp(acd);
36
acdtmp.
samples
= acd.
samples
;
37
return
update
(acdtmp);
38
}
39
40
//**********************************************************************
41
42
DataMap
FembMappedAdcModifier::update
(
AdcChannelData
& acd)
const
{
43
const
string
myname =
"FembMappedAdcModifier::update: "
;
44
DataMap
res;
45
AdcChannel
ifmb = acd.
fembID
();
46
ostringstream sstool;
47
sstool <<
m_ToolBase
;
48
if
( ifmb ==
AdcChannelData::badIndex
() ) sstool <<
"Default"
;
49
else
sstool << ifmb;
50
Name
toolName = sstool.str();
51
DuneToolManager
* pdtm =
nullptr
;
52
std::unique_ptr<DuneToolManager> pdtmManaged;
53
if
(
m_DirName
.size() ) {
54
Name
fclfile =
m_DirName
+
"/"
+ toolName +
".fcl"
;
55
if
( gSystem->AccessPathName(fclfile.c_str()) ) {
56
cout << myname <<
"ERROR: No such file: "
<< fclfile <<
endl
;
57
return
res.
setStatus
(2000);
58
}
59
pdtmManaged.reset(
new
DuneToolManager
(fclfile));
60
pdtm = pdtmManaged.get();
61
}
else
{
62
pdtm =
DuneToolManager::instance
();
63
}
64
ToolPtr
ptool = pdtm->
getPrivate
<
TpcDataTool
>(toolName);
65
if
( ptool ==
nullptr
) {
66
if
(
m_LogLevel
>= 2 ) {
67
cout << myname <<
"ERROR: Unable find tool "
<< toolName <<
endl
;
68
}
69
return
res.
setStatus
(1000);
70
}
71
return
ptool->update(acd);
72
}
73
74
//**********************************************************************
75
76
DEFINE_ART_CLASS_TOOL
(
FembMappedAdcModifier
)
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
result
static QCString result
Definition:
fortranscanner.cpp:56614
FembMappedAdcModifier::view
DataMap view(const AdcChannelData &acd) const override
Definition:
FembMappedAdcModifier_tool.cc:33
DataMap::setStatus
DataMap & setStatus(int stat)
Definition:
DataMap.h:130
string
std::string string
Definition:
nybbler.cc:12
Name
ChannelGroupService::Name Name
Definition:
FixedChannelGroupService_service.cc:19
AdcChannelData
Definition:
AdcChannelData.h:95
ToolPtr
std::unique_ptr< TpcDataTool > ToolPtr
Definition:
FembMappedAdcModifier_tool.cc:15
TpcDataTool
Definition:
TpcDataTool.h:17
AdcChannelData::fembID
Index fembID() const
Definition:
AdcChannelData.h:200
FembMappedAdcModifier::m_ToolBase
Name m_ToolBase
Definition:
FembMappedAdcModifier.h:46
FembMappedAdcModifier::m_DirName
Name m_DirName
Definition:
FembMappedAdcModifier.h:47
FembMappedAdcModifier
Definition:
FembMappedAdcModifier.h:29
DuneToolManager.h
FembMappedAdcModifier::FembMappedAdcModifier
FembMappedAdcModifier(fhicl::ParameterSet const &ps)
Definition:
FembMappedAdcModifier_tool.cc:19
FembMappedAdcModifier::m_LogLevel
int m_LogLevel
Definition:
FembMappedAdcModifier.h:45
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
FembMappedAdcModifier.h
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
DuneToolManager::getPrivate
std::unique_ptr< T > getPrivate(std::string name)
Definition:
DuneToolManager.h:82
DuneToolManager
Definition:
DuneToolManager.h:34
AdcChannel
unsigned int AdcChannel
Definition:
AdcTypes.h:50
FembMappedAdcModifier::update
DataMap update(AdcChannelData &acd) const override
Definition:
FembMappedAdcModifier_tool.cc:42
FembMappedAdcModifier::Name
std::string Name
Definition:
FembMappedAdcModifier.h:42
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
DataMap
Definition:
DataMap.h:43
AdcChannelData::badIndex
static Index badIndex()
Definition:
AdcChannelData.h:112
DuneToolManager::instance
static DuneToolManager * instance(std::string fclname="", int dbg=1)
Definition:
DuneToolManager.cxx:95
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