30 const string myname =
"test_AdcRoiToTree: ";
32 cout << myname <<
"NDEBUG must be off." <<
endl;
35 string line =
"-----------------------------";
37 cout << myname << line <<
endl;
38 string fclfile =
"test_AdcRoiToTree.fcl";
39 if ( ! useExistingFcl ) {
40 cout << myname <<
"Creating top-level FCL." <<
endl;
41 ofstream
fout(fclfile.c_str());
43 fout <<
" tool_type: AdcRoiToTree" <<
endl;
45 fout <<
" OutFile: \"adcrois.root\"" <<
endl;
46 fout <<
" MetadataFields: [\"runevt\", \"xcha\"]" <<
endl;
50 cout << myname <<
"Using existing top-level FCL." <<
endl;
53 cout << myname << line <<
endl;
54 cout << myname <<
"Fetching tool manager." <<
endl;
56 assert ( ptm !=
nullptr );
61 cout << myname << line <<
endl;
62 cout << myname <<
"Fetching tool." <<
endl;
64 assert( ptoo !=
nullptr );
66 cout << myname << line <<
endl;
67 cout << myname <<
"Create test data." <<
endl;
70 float runevt = 1000*irun + ievt;
74 Index icha2 = icha1 + ncha;
75 for (
Index icha=icha1; icha<icha2; ++icha ) {
79 float xcha = 5*(icha%100);
83 Index nroi = icha - icha1 + 1;
84 for (
Index iroi=0; iroi<nroi; ++iroi ) {
85 Index isam1 = 100*iroi;
86 Index isam2 = isam1 + iroi;
87 acd.
rois.emplace_back(isam1, isam2);
91 cout << myname << line <<
endl;
92 cout << myname <<
"Call tool." <<
endl;
93 DataMap res = ptoo->viewMap(acds);
96 cout << myname << line <<
endl;
97 cout << myname <<
"Done." <<
endl;
104 bool useExistingFcl =
false;
106 string sarg(argv[1]);
107 if ( sarg ==
"-h" ) {
108 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
109 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
112 useExistingFcl = sarg ==
"true" || sarg ==
"1";
int test_AdcRoiToTree(bool useExistingFcl=false)
void print(std::ostream *pout) const
int main(int argc, char *argv[])
void setChannelInfo(ChannelInfoPtr pchi)
void setEventInfo(EventInfoPtr pevi)
void line(double t, double *p, double &x, double &y, double &z)
void setMetadata(Name mname, float val)
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
QTextStream & endl(QTextStream &s)