Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Coldbox
vd
Tools
VDColdboxChannelGroups_tool.cc
Go to the documentation of this file.
1
#include "
VDColdboxChannelGroups.h
"
2
#include "
dunecore/ArtSupport/DuneToolManager.h
"
3
#include "
dunecore/DuneInterface/Tool/IndexRangeTool.h
"
4
#include <string>
5
#include <iostream>
6
7
using
std::string
;
8
using
std::cout;
9
using
std::endl
;
10
11
//**********************************************************************
12
13
VDColdboxChannelGroups::VDColdboxChannelGroups
(
fhicl::ParameterSet
const
&
ps
)
14
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)) {
15
const
string
myname =
"VDColdboxChannelGroups::ctor: "
;
16
// Fetch the IndexRange tool.
17
DuneToolManager
* ptm =
DuneToolManager::instance
();
18
if
( ptm ==
nullptr
) {
19
if
(
m_LogLevel
>= 1 ) cout << myname <<
"ERROR: Tool manager not found."
<<
endl
;
20
}
else
{
21
string
crtName =
"channelRanges"
;
22
m_pcrt
= ptm->
getShared
<
IndexRangeTool
>(crtName);
23
if
(
m_pcrt
==
nullptr
) {
24
if
(
m_LogLevel
>= 1 ) cout << myname <<
"ERROR: Channel range tool not found: "
<< crtName <<
endl
;
25
}
26
}
27
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
28
}
29
30
//**********************************************************************
31
32
IndexRangeGroup
VDColdboxChannelGroups::get
(
std::string
gnam)
const
{
33
const
string
myname =
"VDColdboxChannelGroups::get: "
;
34
if
(
m_pcrt
==
nullptr
) {
35
cout << myname <<
"ERROR: Channel range tool was not found."
<<
endl
;
36
return
IndexRangeGroup
();
37
}
38
// Construct group if this is a known group name.
39
const
NameVector
ufnams = {
"femb01u"
,
"femb02u"
,
"femb03u"
,
"femb04u"
,
"femb05u"
,
"femb06u"
,
40
"femb07u"
,
"femb08u"
,
"femb09u"
,
"femb10u"
,
"femb11u"
};
41
const
NameVector
yfnams = {
"femb01y"
,
"femb02y"
,
"femb03y"
,
"femb04y"
,
42
"femb11y"
,
"femb12y"
,
"femb13y"
};
43
const
NameVector
zfnams = {
"femb04z"
,
"femb05z"
,
"femb06z"
,
"femb07z"
,
44
"femb08z"
,
"femb09z"
,
"femb10z"
,
"femb11z"
};
45
NameVector
fnams = ufnams;
46
fnams.insert(fnams.end(), yfnams.begin(), yfnams.end());
47
fnams.insert(fnams.end(), zfnams.begin(), zfnams.end());
48
if
( gnam ==
"fembviews"
) {
49
return
makeGroup
(gnam, fnams,
"FEMB views"
);
50
}
else
if
( gnam ==
"fembu"
) {
51
return
makeGroup
(gnam, ufnams,
"U FEMBs"
);
52
}
else
if
( gnam ==
"femby"
) {
53
return
makeGroup
(gnam, yfnams,
"Y FEMBs"
);
54
}
else
if
( gnam ==
"fembz"
) {
55
return
makeGroup
(gnam, zfnams,
"Z FEMBs"
);
56
}
57
// No groups found. Try range instead.
58
IndexRange
ran =
m_pcrt
->
get
(gnam);
59
if
( ! ran.
isValid
() ) {
60
if
(
m_LogLevel
>= 2 ) cout << myname <<
"Range not found: "
<< gnam <<
endl
;
61
return
IndexRangeGroup
();
62
}
63
return
IndexRangeGroup
(ran);
64
}
65
66
//**********************************************************************
67
68
IndexRangeGroup
VDColdboxChannelGroups::
69
makeGroup
(
Name
nam,
NameVector
rnams,
Name
lab)
const
{
70
IndexRangeGroup::RangeVector
rans;
71
for
(
Name
rnam : rnams ) {
72
rans.push_back(
m_pcrt
->
get
(rnam));
73
}
74
NameVector
labs = {lab};
75
return
IndexRangeGroup
(nam, labs, rans);
76
}
77
78
79
//**********************************************************************
80
81
DEFINE_ART_CLASS_TOOL
(
VDColdboxChannelGroups
)
IndexRangeGroup
Definition:
IndexRangeGroup.h:20
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
VDColdboxChannelGroups
Definition:
VDColdboxChannelGroups.h:16
string
std::string string
Definition:
nybbler.cc:12
IndexRangeGroup::RangeVector
std::vector< IndexRange > RangeVector
Definition:
IndexRangeGroup.h:28
VDColdboxChannelGroups::makeGroup
IndexRangeGroup makeGroup(Name nam, NameVector rnams, Name lab) const
Definition:
VDColdboxChannelGroups_tool.cc:69
IndexRange::isValid
bool isValid() const
Definition:
IndexRange.h:94
IndexRangeTool.h
DuneToolManager.h
IndexRangeTool
Definition:
IndexRangeTool.h:13
VDColdboxChannelGroups::VDColdboxChannelGroups
VDColdboxChannelGroups(fhicl::ParameterSet const &ps)
Definition:
VDColdboxChannelGroups_tool.cc:13
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
VDColdboxChannelGroups::NameVector
std::vector< Name > NameVector
Definition:
VDColdboxChannelGroups.h:39
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
DuneToolManager
Definition:
DuneToolManager.h:34
VDColdboxChannelGroups::get
IndexRangeGroup get(std::string nam) const override
Definition:
VDColdboxChannelGroups_tool.cc:32
IndexRange
Definition:
IndexRange.h:23
VDColdboxChannelGroups::m_LogLevel
int m_LogLevel
Definition:
VDColdboxChannelGroups.h:32
VDColdboxChannelGroups::m_pcrt
IndexRangeTool * m_pcrt
Definition:
VDColdboxChannelGroups.h:35
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
VDColdboxChannelGroups.h
IndexRangeGroupTool::Name
IndexRangeGroup::Name Name
Definition:
IndexRangeGroupTool.h:17
DuneToolManager::instance
static DuneToolManager * instance(std::string fclname="", int dbg=1)
Definition:
DuneToolManager.cxx:95
DuneToolManager::getShared
T * getShared(std::string name)
Definition:
DuneToolManager.h:101
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
IndexRangeTool::get
virtual IndexRange get(Name nam) const =0
Generated by
1.8.11