24 using std::istringstream;
25 using std::ostringstream;
36 const string myname =
"test_ProtoDuneChannelRanges: ";
38 cout << myname <<
"NDEBUG must be off." <<
endl;
41 string line =
"-----------------------------";
43 cout << myname << line <<
endl;
44 string fclfile =
"test_ProtoDuneChannelRanges.fcl";
45 if ( ! useExistingFcl ) {
46 cout << myname <<
"Creating top-level FCL." <<
endl;
47 ofstream
fout(fclfile.c_str());
50 fout <<
" tool_type: ProtoDuneChannelRanges" <<
endl;
52 fout <<
" ExtraRanges: \"\"" <<
endl;
57 cout << myname <<
"Using existing top-level FCL." <<
endl;
60 cout << myname << line <<
endl;
61 cout << myname <<
"Fetching tool manager." <<
endl;
63 assert ( ptm !=
nullptr );
68 cout << myname << line <<
endl;
69 cout << myname <<
"Fetching tool." <<
endl;
71 assert( irt !=
nullptr );
73 cout << myname << line <<
endl;
74 cout << myname <<
"Fetching TPC ranges." <<
endl;
76 vector<string> namSufs = {
"",
"u",
"v",
"z",
"c",
"x",
"i"};
77 vector<string> namPres = {
"tps",
"tpp",
"tpp",
"tpp",
"tpp",
"tpp",
"tpp"};
78 for (
Index inam=0; inam<namPres.size(); ++inam ) {
79 for (
Index itps=0; itps<6; ++itps ) {
81 string nam = namPres[inam] + stps + namSufs[inam];
84 cout << myname <<
"Invalid range: " << nam <<
endl;
89 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
91 assert( ir.
name == nam );
97 cout << myname << line <<
endl;
98 cout << myname <<
"Fetching APA ranges." <<
endl;
100 vector<string> namPresApa = {
"apa",
"apa",
"apa",
"apa",
"apa",
"apa",
"apa"};
101 for (
Index inam=0; inam<namPres.size(); ++inam ) {
102 for (
Index iapa=1; iapa<=6; ++iapa ) {
104 string nam = namPresApa[inam] + stps + namSufs[inam];
107 cout << myname <<
"Invalid range: " << nam <<
endl;
111 <<
" " << ir.
label();
112 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
114 assert( ir.
name == nam );
120 bool showFembBlocks = show > 1;
121 if ( showFembBlocks ) {
122 cout << myname << line <<
endl;
123 cout << myname <<
"Fetching FEMB block ranges." <<
endl;
126 for (
Index iapa=1; iapa<=6; ++iapa ) {
127 for (
string view : {
"u",
"v",
"x"} ) {
128 for (
Index ifmb=1; ifmb<=20; ++ifmb ) {
130 ssnam <<
"femb" << iapa <<
setfill(
'0') <<
setw(2) << ifmb << view;
131 string nam = ssnam.str();
134 cout << myname <<
"Invalid range: " << nam <<
endl;
138 <<
" " << ir.
label();
139 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
140 for (
Index icha=ir.
begin; icha<ir.
end; ++icha ) chk[icha] += 1;
146 for (
Index icha=0; icha<15360; ++icha ) {
147 assert( chk[icha] == 1 );
152 cout << myname << line <<
endl;
153 cout <<
"Fetch bad range" <<
endl;
158 cout << myname << line <<
endl;
159 cout << myname <<
"Done." <<
endl;
166 bool useExistingFcl =
false;
169 string sarg(argv[1]);
170 if ( sarg ==
"-h" ) {
171 cout <<
"Usage: " << argv[0] <<
" [keepFCL] [SHOW]" <<
endl;
172 cout <<
" If keepFCL = true, existing FCL file is used." <<
endl;
173 cout <<
" SHOW > 1 also shows the 480 FEMB blocks." <<
endl;
176 useExistingFcl = sarg ==
"true" || sarg ==
"1";
179 string sarg(argv[2]);
180 show = std::stoi(sarg);
int main(int argc, char *argv[])
Name label(Index ilab=0) const
Q_EXPORT QTSManip setw(int w)
int test_ProtoDuneChannelRanges(bool useExistingFcl=false, int show=1)
void line(double t, double *p, double &x, double &y, double &z)
std::string rangeString() const
Q_EXPORT QTSManip setfill(int f)
std::string to_string(ModuleType const mt)
QTextStream & endl(QTextStream &s)