27 const string myname =
"test_FclStickyCodeFlagger: ";
29 cout << myname <<
"NDEBUG must be off." <<
endl;
32 string line =
"-----------------------------";
34 cout << myname << line <<
endl;
35 string fclfile =
"test_FclStickyCodeFlagger.fcl";
36 if ( ! useExistingFcl ) {
37 cout << myname <<
"Creating top-level FCL." <<
endl;
38 ofstream
fout(fclfile.c_str());
41 fout <<
" tool_type: FclStickyCodeFlagger" <<
endl;
45 fout <<
" chan012: [105, 110]" <<
endl;
49 fout <<
" chan014: [110, 111]" <<
endl;
50 fout <<
" chan014x: [119, 119]" <<
endl;
56 cout << myname <<
"Using existing top-level FCL." <<
endl;
59 cout << myname << line <<
endl;
60 cout << myname <<
"Fetching tool manager." <<
endl;
62 assert ( ptm !=
nullptr );
67 cout << myname << line <<
endl;
68 cout << myname <<
"Fetching tool." <<
endl;
70 assert( padv !=
nullptr );
72 cout << myname << line <<
endl;
73 cout << myname <<
"Create data and call tool." <<
endl;
75 for (
AdcIndex ievt=0; ievt<nevt; ++ievt ) {
76 cout << myname <<
"Event " << ievt <<
endl;
79 for (
AdcIndex icha=0; icha<ncha; ++icha ) {
80 std::pair<AdcChannelDataMap::iterator, bool> kdat = datamap.emplace(icha,
AdcChannelData());
88 for (
AdcIndex itic=0; itic<20; ++itic ) {
90 data.
raw.push_back(iadc);
91 data.
flags.push_back(0);
93 DataMap dm = padv->update(datamap[icha]);
97 for (
Index isam=0; isam<data.
raw.size(); ++isam ) {
98 cout << myname <<
" " << data.
raw[isam] <<
" " << data.
flags[isam] <<
endl;
99 if ( data.
raw[isam] == 105 || data.
raw[isam] == 109 || data.
raw[isam] == 110 ) assert( data.
flags[isam] == 8 );
100 else assert( data.
flags[isam] == 0 );
104 for (
Index isam=0; isam<data.
raw.size(); ++isam ) {
105 cout << myname <<
" " << data.
raw[isam] <<
" " << data.
flags[isam] <<
endl;
106 if ( data.
raw[isam] == 110 || data.
raw[isam] == 111 || data.
raw[isam] == 119 ) assert( data.
flags[isam] == 8 );
107 else assert( data.
flags[isam] == 0 );
113 cout << myname << line <<
endl;
114 cout << myname <<
"Done." <<
endl;
121 bool useExistingFcl =
false;
123 string sarg(argv[1]);
124 if ( sarg ==
"-h" ) {
125 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
126 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
129 useExistingFcl = sarg ==
"true" || sarg ==
"1";
void print(std::ostream *pout) const
void setChannelInfo(ChannelInfoPtr pchi)
int test_FclStickyCodeFlagger(bool useExistingFcl=false)
void setEventInfo(EventInfoPtr pevi)
void line(double t, double *p, double &x, double &y, double &z)
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
int main(int argc, char *argv[])
QTextStream & endl(QTextStream &s)