26 const string myname =
"test_AdcChannelDumper: ";
28 cout << myname <<
"NDEBUG must be off." <<
endl;
31 string line =
"-----------------------------";
33 cout << myname << line <<
endl;
34 string fclfile =
"test_AdcChannelDumper.fcl";
35 if ( ! useExistingFcl ) {
36 cout << myname <<
"Creating top-level FCL." <<
endl;
37 ofstream
fout(fclfile.c_str());
40 fout <<
" tool_type: AdcChannelDumper" <<
endl;
43 fout <<
" Prefix: \"ADC dump: \"" <<
endl;
49 cout << myname <<
"Using existing top-level FCL." <<
endl;
52 cout << myname << line <<
endl;
53 cout << myname <<
"Fetching tool manager." <<
endl;
55 assert ( ptm !=
nullptr );
60 cout << myname << line <<
endl;
61 cout << myname <<
"Fetching tool." <<
endl;
63 assert( padv !=
nullptr );
65 cout << myname << line <<
endl;
66 cout << myname <<
"Create data and call too." <<
endl;
68 string lab =
"plane 3u";
69 float peds[10] = {701.1, 711.2, 733.3, 690.4, 688.5, 703.6, 720.7, 720.8, 695.9, 702.0};
70 for (
AdcIndex ievt=0; ievt<nevt; ++ievt ) {
71 cout << myname <<
"Event " << ievt <<
endl;
74 for (
AdcIndex icha=0; icha<ncha; ++icha ) {
75 std::pair<AdcChannelDataMap::iterator, bool> kdat = datamap.emplace(icha,
AdcChannelData());
79 float ped = peds[icha];
83 for (
AdcIndex itic=0; itic<100; ++itic ) {
84 float xadc = ped + rand()%20 - 10.0;
86 if ( iticeff > 20 && iticeff < 40 ) xadc +=600;
88 data.
raw.push_back(iadc);
89 data.
flags.push_back(0);
90 data.
samples.push_back(iadc - ped);
91 data.
signal.push_back(xadc - ped > 300.0 );
93 AdcIndex tp = 10*ievt + 60 - 2.3*icha;
101 assert( padv->view(datamap[icha]) == 0 );
105 cout << myname << line <<
endl;
106 cout << myname <<
"Done." <<
endl;
void setChannelInfo(ChannelInfoPtr pchi)
void setEventInfo(EventInfoPtr pevi)
void line(double t, double *p, double &x, double &y, double &z)
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
QTextStream & endl(QTextStream &s)