36 const string myname =
"test_ApaChannelRanges: ";
38 cout << myname <<
"NDEBUG must be off." <<
endl;
41 string line =
"-----------------------------";
43 cout << myname << line <<
endl;
44 string fclfile =
"test_ApaChannelRanges.fcl";
45 if ( ! useExistingFcl ) {
46 cout << myname <<
"Creating top-level FCL." <<
endl;
47 ofstream
fout(fclfile.c_str());
50 fout <<
" tool_type: ApaChannelRanges" <<
endl;
52 fout <<
" ApaNumbers: [3, 5, 2, 6, 1, 4]" <<
endl;
53 fout <<
" ApaLocationNames: [\"R1\", \"L1\", \"R2\", \"L2\", \"R3\", \"L3\"]" <<
endl;
54 fout <<
" ExtraRanges: \"\"" <<
endl;
59 cout << myname <<
"Using existing top-level FCL." <<
endl;
62 cout << myname << line <<
endl;
63 cout << myname <<
"Fetching tool manager." <<
endl;
65 assert ( ptm !=
nullptr );
70 cout << myname << line <<
endl;
71 cout << myname <<
"Fetching tool." <<
endl;
73 assert( irt !=
nullptr );
75 cout << myname << line <<
endl;
76 cout << myname <<
"Fetching TPC ranges." <<
endl;
78 vector<string> namSufs = {
"",
"u",
"v",
"z",
"c",
"x",
"i"};
79 vector<string> namPres = {
"tps",
"tpp",
"tpp",
"tpp",
"tpp",
"tpp",
"tpp"};
80 for (
Index inam=0; inam<namPres.size(); ++inam ) {
81 for (
Index itps=0; itps<6; ++itps ) {
83 string nam = namPres[inam] + stps + namSufs[inam];
86 cout << myname <<
"Invalid range: " << nam <<
endl;
91 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
93 assert( ir.
name == nam );
99 cout << myname << line <<
endl;
100 cout << myname <<
"Fetching APA ranges." <<
endl;
102 vector<string> namPresApa = {
"apa",
"apa",
"apa",
"apa",
"apa",
"apa",
"apa"};
103 for (
Index inam=0; inam<namPres.size(); ++inam ) {
104 for (
Index iapa=1; iapa<=6; ++iapa ) {
106 string nam = namPresApa[inam] + stps + namSufs[inam];
109 cout << myname <<
"Invalid range: " << nam <<
endl;
113 <<
" " << ir.
label();
114 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
116 assert( ir.
name == nam );
122 bool showFembBlocks = show > 1;
123 if ( showFembBlocks ) {
124 cout << myname << line <<
endl;
125 cout << myname <<
"Fetching FEMB block ranges." <<
endl;
128 for (
Index iapa=1; iapa<=6; ++iapa ) {
129 for (
string view : {
"u",
"v",
"x"} ) {
130 for (
Index ifmb=1; ifmb<=20; ++ifmb ) {
132 ssnam <<
"femb" << iapa <<
setfill(
'0') <<
setw(2) << ifmb << view;
133 string nam = ssnam.str();
136 cout << myname <<
"Invalid range: " << nam <<
endl;
140 <<
" " << ir.
label();
141 for (
Index ilab=1; ilab<ir.
labels.size(); ++ilab ) cout <<
", " << ir.
label(ilab);
142 for (
Index icha=ir.
begin; icha<ir.
end; ++icha ) chk[icha] += 1;
148 for (
Index icha=0; icha<15360; ++icha ) {
149 assert( chk[icha] == 1 );
154 cout << myname << line <<
endl;
155 cout <<
"Fetch bad range" <<
endl;
160 cout << myname << line <<
endl;
161 cout << myname <<
"Done." <<
endl;
Name label(Index ilab=0) const
Q_EXPORT QTSManip setw(int w)
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)