30 const string myname =
"test_FembMappedAdcModifier: ";
32 cout << myname <<
"NDEBUG must be off." <<
endl;
35 string line =
"-----------------------------";
37 cout << myname << line <<
endl;
38 string fclfile =
"test_FembMappedAdcModifier.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;
54 fout <<
" tool_type: FembLinearCalibration" <<
endl;
57 fout <<
" Gains: [1.0, 2.0, 3.0, 4.0, 5.0]" <<
endl;
59 fout <<
" AdcMins: [1200, 1300, 1400, 1500, 1600]" <<
endl;
64 fout <<
" tool_type: FembLinearCalibration" <<
endl;
67 fout <<
" Gains: [1.0, 2.0, 3.0, 4.0, 5.0]" <<
endl;
69 fout <<
" AdcMins: [1200, 1300, 1400, 1500, 1600]" <<
endl;
74 fout <<
" tool_type: FembLinearCalibration" <<
endl;
77 fout <<
" Gains: [1.0, 2.0, 3.0, 4.0, 5.0]" <<
endl;
79 fout <<
" AdcMins: [1200, 1300, 1400, 1500, 1600]" <<
endl;
84 fout <<
" tool_type: FembLinearCalibration" <<
endl;
87 fout <<
" Gains: [1.0, 2.0, 3.0, 4.0, 5.0]" <<
endl;
89 fout <<
" AdcMins: [1200, 1300, 1400, 1500, 1600]" <<
endl;
94 fout <<
" tool_type: FembMappedAdcModifier" <<
endl;
96 fout <<
" ToolBase: modtool" <<
endl;
102 cout << myname <<
"Using existing top-level FCL." <<
endl;
105 cout << myname << line <<
endl;
106 cout << myname <<
"Fetching tool manager." <<
endl;
108 assert ( ptm !=
nullptr );
113 cout << myname << line <<
endl;
114 cout << myname <<
"Fetching tool." <<
endl;
116 assert( pmod !=
nullptr );
118 cout << myname << line <<
endl;
119 cout << myname <<
"Create data." <<
endl;
122 acd0.
raw.push_back(1100);
123 acd0.
raw.push_back(1200);
124 acd0.
raw.push_back(1300);
125 acd0.
raw.push_back(1400);
126 acd0.
raw.push_back(1500);
139 for (
auto& ient : acds ) {
143 for (
Index isam=0; isam<nsam; ++isam ) {
144 sigchk[isam] = (icha+1)*(acd0.
raw[isam] - acd0.
pedestal);
146 cout << myname << line <<
endl;
147 cout << myname <<
"Channel " << icha <<
endl;
148 DataMap res = pmod->update(acd);
149 cout << myname <<
"Modify:" <<
endl;
154 assert( res.
status() == 0 );
155 assert( nsamRes == nsam );
156 cout << myname <<
" Raw:";
159 cout << myname <<
" Prep:";
162 cout << myname <<
"Check:";
165 cout << myname <<
" Flag:";
168 cout << myname <<
"Check samples." <<
endl;
169 for (
Index isam=0; isam<nsam; ++isam ) {
170 assert( acd.
samples[isam] == sigchk[isam] );
172 cout << myname <<
"Check under and overflows." <<
endl;
174 Index noverExp = icha > 2 ? icha - 2 : 0;
175 assert ( nunder == nunderExp );
176 assert ( nover == noverExp );
177 for (
Index isam=0; isam<nsam; ++isam ) {
181 if ( acd.
flags[isam] != flgExp ) {
182 cout << myname <<
"Sample " << isam <<
": " << acd.
flags[isam]
183 <<
" != " << flgExp <<
endl;
185 assert( acd.
flags[isam] == flgExp );
189 cout << myname << line <<
endl;
190 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)