30 const string myname =
"test_FembLinearCalibration: ";
32 cout << myname <<
"NDEBUG must be off." <<
endl;
35 string line =
"-----------------------------";
37 cout << myname << line <<
endl;
38 string fclfile =
"test_FembLinearCalibration.fcl";
39 if ( ! useExistingFcl ) {
40 cout << myname <<
"Creating top-level FCL." <<
endl;
41 ofstream
fout(fclfile.c_str());
44 fout <<
" tool_type: FembLinearCalibration" <<
endl;
47 fout <<
" Gains: [1.0, 2.0, 3.0, 4.0, 5.0]" <<
endl;
49 fout <<
" AdcMins: [1200, 1300, 1400, 1500, 1600]" <<
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( pmod !=
nullptr );
72 cout << myname << line <<
endl;
73 cout << myname <<
"Create data." <<
endl;
76 acd0.
raw.push_back(1100);
77 acd0.
raw.push_back(1200);
78 acd0.
raw.push_back(1300);
79 acd0.
raw.push_back(1400);
80 acd0.
raw.push_back(1500);
93 for (
auto& ient : acds ) {
97 for (
Index isam=0; isam<nsam; ++isam ) {
98 sigchk[isam] = (icha+1)*(acd0.
raw[isam] - acd0.
pedestal);
100 cout << myname << line <<
endl;
102 cout << myname <<
"Channel " << icha <<
endl;
103 DataMap res = pmod->update(acd);
104 cout << myname <<
"Modify:" <<
endl;
109 assert( res.
status() == 0 );
110 assert( nsamRes == nsam );
111 cout << myname <<
" Raw:";
114 cout << myname <<
" Prep:";
117 cout << myname <<
"Check:";
120 cout << myname <<
" Flag:";
123 cout << myname <<
"Check samples." <<
endl;
124 for (
Index isam=0; isam<nsam; ++isam ) {
125 assert( acd.
samples[isam] == sigchk[isam] );
127 cout << myname <<
"Check under and overflows." <<
endl;
129 Index noverExp = icha > 2 ? icha - 2 : 0;
130 assert ( nunder == nunderExp );
131 assert ( nover == noverExp );
132 for (
Index isam=0; isam<nsam; ++isam ) {
136 if ( acd.
flags[isam] != flgExp ) {
137 cout << myname <<
"Sample " << isam <<
": " << acd.
flags[isam]
138 <<
" != " << flgExp <<
endl;
140 assert( acd.
flags[isam] == flgExp );
145 cout << myname << line <<
endl;
146 cout << myname <<
"Done." <<
endl;
const AdcFlag AdcUnderflow
void print(std::ostream *pout) const
void setChannelInfo(ChannelInfoPtr pchi)
const AdcFlag AdcOverflow
Q_EXPORT QTSManip setw(int w)
int getInt(Name name, int def=0) const
void line(double t, double *p, double &x, double &y, double &z)
std::vector< AdcSignal > AdcSignalVector
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
QTextStream & endl(QTextStream &s)