30 const string myname =
"test_AdcEventViewer: ";
32 cout << myname <<
"NDEBUG must be off." <<
endl;
35 string line =
"-----------------------------";
37 cout << myname << line <<
endl;
38 string fclfile =
"test_AdcEventViewer.fcl";
39 if ( ! useExistingFcl ) {
40 cout << myname <<
"Creating top-level FCL." <<
endl;
41 ofstream
fout(fclfile.c_str());
42 fout <<
"#include \"dataprep_tools.fcl\"" <<
endl;
44 fout <<
" tool_type: AdcEventViewer" <<
endl;
48 fout <<
" ChannelRanges: []" <<
endl;
49 fout <<
" ChannelRangeLabel: \"\"" <<
endl;
51 fout <<
" ClockRate: 50000000" <<
endl;
55 cout << myname <<
"Using existing top-level FCL." <<
endl;
58 cout << myname << line <<
endl;
59 cout << myname <<
"Fetching tool manager." <<
endl;
61 assert ( ptm !=
nullptr );
66 cout << myname << line <<
endl;
67 cout << myname <<
"Fetching tool." <<
endl;
69 assert( ptoo !=
nullptr );
71 cout << myname << line <<
endl;
72 cout << myname <<
"Create test data." <<
endl;
74 vector<float> pulse = { 2.0, -3.0, 0.0, 5.0, 24.0, 56.0, 123.0, 71.0, 52.1, 26.3,
75 12.5, 8.1, 4.5, 2.0, -1.0, 3.2, 1.1, -2.2, 0.1, -0.1};
77 for (
Index icha=250; icha<270; ++icha ) {
85 for (
Index ipul=0; ipul<npul; ++ipul ) {
87 for (
Index ismp=0; ismp<pulse.
size(); ++ismp, ++itck ) {
88 acd.
samples[itck] = pulse[ismp] + gRandom->Gaus(0.0, sigma);
90 acd.
rois.emplace_back( itck0+2, itck-2);
92 assert( acd.
rois.size() == npul );
95 cout << myname << line <<
endl;
97 cout << myname << line <<
endl;
98 cout << myname <<
"Call tool for channel map." <<
endl;
100 res = ptoo->viewMap(acds);
101 res = ptoo->viewMap(acds);
102 res = ptoo->viewMap(acds);
104 cout << myname << line <<
endl;
105 cout << myname <<
"Done." <<
endl;
112 bool useExistingFcl =
false;
114 string sarg(argv[1]);
115 if ( sarg ==
"-h" ) {
116 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
117 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
120 useExistingFcl = sarg ==
"true" || sarg ==
"1";
void setChannelInfo(ChannelInfoPtr pchi)
int test_AdcEventViewer(bool useExistingFcl=false)
void setEventInfo(EventInfoPtr pevi)
void line(double t, double *p, double &x, double &y, double &z)
int main(int argc, char *argv[])
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
QTextStream & endl(QTextStream &s)