Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Protodune
singlephase
Exe
pdChannelRange.cxx
Go to the documentation of this file.
1
// pdChannelRange.cxx
2
//
3
// David Adams
4
// October 2018
5
//
6
// Display the range of channels for a named channel range or group.
7
8
#include "
dunecore/ArtSupport/DuneToolManager.h
"
9
#include "
dunecore/DuneInterface/Tool/IndexRangeTool.h
"
10
#include "
dunecore/DuneInterface/Tool/IndexRangeGroupTool.h
"
11
#include <string>
12
#include <iostream>
13
#include <vector>
14
#include <sstream>
15
16
using
std::string
;
17
using
std::cout;
18
using
std::cin;
19
using
std::endl
;
20
using
std::ostream;
21
using
std::istringstream;
22
23
//**********************************************************************
24
25
int
main
(
int
argc,
char
**
argv
) {
26
const
string
myname =
"pdChannelRange: "
;
27
bool
help
=
false
;
28
string
crname;
29
string
tnameRange =
"channelRanges"
;
30
string
tnameGroup =
"channelGroups"
;
31
int
iarg = 1;
32
string
sdet =
"protodune"
;
33
while
( iarg < argc ) {
34
string
arg = argv[iarg++];
35
if
( arg[0] ==
'-'
) {
36
if
( arg ==
"-h"
) {
37
help =
true
;
38
}
else
if
( arg ==
"-d"
) {
39
if
( iarg < argc ) sdet = argv[iarg++];
40
}
else
{
41
cout <<
"ERROR: Invalid flag: "
<< arg <<
endl
;
42
help =
true
;
43
}
44
}
else
{
45
crname = arg;
46
}
47
}
48
string
fclfile = sdet +
"_tools_dune.fcl"
;
49
if
( help ) {
50
cout <<
"Usage: "
<< argv[0] <<
" [-d DET] NAME"
<<
endl
;
51
cout <<
" Displays the range names group for channel group NAME"
<<
endl
;
52
cout <<
" or the range for channel range NAME."
<<
endl
;
53
cout <<
" DET = protodune (default), apa7, iceberg, vdcb or any value for which\n"
54
<<
" DET_tools_dune.fcl provides definitions for\n"
55
<<
" channelRanges and channelGroups."
<<
endl
;
56
if
( sdet ==
"protodune"
) {
57
cout <<
" Protodune channel group names include:"
<<
endl
;
58
cout <<
" apas - APAs."
<<
endl
;
59
cout <<
" tpss - TPC sets."
<<
endl
;
60
cout <<
" apaus, apavs, apazs, apacs - APA planes with install naming."
<<
endl
;
61
cout <<
" tppus, tppvs, tppzs, tppcs - APA planes with offline naming."
<<
endl
;
62
cout <<
" Protodune channel range names include:"
<<
endl
;
63
cout <<
" apa1 - apa6: APA with APA numbering."
<<
endl
;
64
cout <<
" tps0 - tps5: APA (TPC set) with offline numbering."
<<
endl
;
65
cout <<
" apa0u, apa0v, apa0z, apa0c, ..., apa5c: APA plane with install numbering."
<<
endl
;
66
cout <<
" tpp0u, tpp0v, tpp0z, tpp0c, ..., tpp5c: APA plane with offline numbering."
<<
endl
;
67
cout <<
" (u and v are induction, z is TPC-side collection, c is cryostat side."
<<
endl
;
68
cout <<
" femb101u, femb102u, ..., femb620u: FEMB u channels (same for v and x)."
<<
endl
;
69
}
else
if
( sdet ==
"apa7"
) {
70
cout <<
" CERN coldbox channel range names include:"
<<
endl
;
71
cout <<
" apa7: same as all."
<<
endl
;
72
cout <<
" apa7u, apa7v, apa7z, apa7c: APA plane."
<<
endl
;
73
cout <<
" tpp7u, tpp7v, tpp7z, tpp07: APA plane."
<<
endl
;
74
cout <<
" (u and v are induction, z is TPC-side collection, c is cryostat side."
<<
endl
;
75
cout <<
" femb701u, femb702u, ..., femb720u: FEMB u channels (same for v and x)."
<<
endl
;
76
}
else
if
( sdet ==
"iceberg"
) {
77
cout <<
" Iceberg channel range names include:"
<<
endl
;
78
cout <<
" apa: same as all."
<<
endl
;
79
cout <<
" apau, apav, apaz1, apaz2: APA plane."
<<
endl
;
80
cout <<
" tppu, tppv, tppz1, apaz2: APA plane."
<<
endl
;
81
cout <<
" (u and v are induction, z is TPC-side collection, c is cryostat side."
<<
endl
;
82
cout <<
" femb701u, femb702u, ..., femb720u: FEMB u channels (same for v and x)."
<<
endl
;
83
cout <<
" apai: Induction channels."
<<
endl
;
84
cout <<
" apaz or apax: Collection channels."
<<
endl
;
85
}
86
return
0;
87
}
88
89
DuneToolManager
* ptm =
DuneToolManager::instance
(fclfile, 0);
90
assert ( ptm !=
nullptr
);
91
DuneToolManager
&
tm
= *ptm;
92
//tm.print();
93
assert( tm.
toolNames
().size() >= 1 );
94
95
IndexRangeGroupTool
* pcgt = tm.
getShared
<
IndexRangeGroupTool
>(tnameGroup);
96
IndexRangeTool
* pcrt = tm.
getShared
<
IndexRangeTool
>(tnameRange);
97
98
int
warnGroup = 0;
99
int
warnRange = 0;
100
// If user provides name, exit after displaying result.
101
bool
exitLoop = crname.size();
102
while
(
true
) {
103
if
( crname.size() == 0 ) {
104
cout <<
"Group or range name> "
;
105
cout.flush();
106
std::getline(cin, crname);
107
}
108
if
( crname.size() == 0 || crname ==
"q"
)
return
0;
109
IndexRangeGroup
cg;
110
if
( pcgt ==
nullptr
) {
111
if
( ! warnGroup++ ) cout <<
"WARNING: Channel group tool not found: "
<< tnameGroup <<
endl
;
112
}
else
{
113
cg = pcgt->get(crname);
114
}
115
if
( cg.
isValid
() ) {
116
cout << cg <<
endl
;
117
}
else
if
( pcrt ==
nullptr
) {
118
if
( ! warnRange ) cout <<
"WARNING: Channel range tool not found: "
<< tnameRange <<
endl
;
119
}
else
{
120
IndexRange
cr
= pcrt->get(crname);
121
if
( cr.
isValid
() ) {
122
cout << cr <<
endl
;
123
}
else
{
124
cout <<
"ERROR: "
<< crname <<
" is not a valid channel group or range."
<<
endl
;
125
}
126
}
127
if
( warnGroup && warnRange )
return
1;
128
if
( exitLoop )
return
0;
129
crname =
""
;
130
}
131
return
0;
132
}
IndexRangeGroup
Definition:
IndexRangeGroup.h:20
DuneToolManager::toolNames
const std::vector< std::string > & toolNames() const
Definition:
DuneToolManager.cxx:151
string
std::string string
Definition:
nybbler.cc:12
IndexRange::isValid
bool isValid() const
Definition:
IndexRange.h:94
demo.tm
tm
Definition:
demo.py:21
IndexRangeTool.h
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
main
int main(int argc, char **argv)
Definition:
pdChannelRange.cxx:25
IndexRangeGroupTool
Definition:
IndexRangeGroupTool.h:13
tracks.cr
cr
Definition:
tracks.py:457
DuneToolManager.h
IndexRangeTool
Definition:
IndexRangeTool.h:13
IndexRangeGroupTool.h
DuneToolManager
Definition:
DuneToolManager.h:34
IndexRange
Definition:
IndexRange.h:23
IndexRangeGroup::isValid
bool isValid() const
Definition:
IndexRangeGroup.h:78
ValidateOpDetReco.help
help
Definition:
ValidateOpDetReco.py:23
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
Generated by
1.8.11