107 const string mypre =
"test_Adc2dConvolute";
108 const string myname = mypre +
": ";
110 cout << myname <<
"NDEBUG must be off." <<
endl;
113 string line =
"-----------------------------";
115 cout << myname << line <<
endl;
116 string fclfile =
"test_Adc2dConvolute.fcl";
121 if ( ! useExistingFcl ) {
122 cout << myname <<
"Creating top-level FCL." <<
endl;
123 ofstream
fout(fclfile.c_str());
126 fout <<
" tool_type: Adc2dConvolute" <<
endl;
128 fout <<
" ResponseVectors: [" <<
endl;
129 fout <<
" [0.2, 0.4, 0.3, 0.1], [0.2, 0.4, 0.3, 0.1]," <<
endl;
130 fout <<
" [0.1, 0.2, 0.15, 0.05], [0.05, 0.10, 0.075, 0.025]," <<
endl;
131 fout <<
" [0.025, 0.050, 0.0375, 0.0125], [0.0125, 0.025, 0.01875, 0.00625]" <<
endl;
133 fout <<
" ResponseCenter: 1" <<
endl;;
136 fout <<
" MinChannel: 101" <<
endl;;
137 fout <<
" MaxChannel: 104" <<
endl;;
142 cout << myname <<
"Using existing top-level FCL." <<
endl;
145 cout << myname << line <<
endl;
146 cout << myname <<
"Fetching tool manager." <<
endl;
148 assert ( ptm !=
nullptr );
153 cout << myname << line <<
endl;
154 cout << myname <<
"Fetching tool." <<
endl;
156 assert( pcondir !=
nullptr );
158 cout << myname << line <<
endl;
159 cout << myname <<
"Create empty input data." <<
endl;
163 for (
Index icha=100; icha<105; ++icha ) {
169 std::map<Index,float> expAreas;
170 for (
Index icha=100; icha<106; ++icha ) expAreas[icha] = 0.0;
176 cout << myname <<
"Add signal " << ++isig <<
endl;
177 data[103].binSamples[3][10] = 100.0;
178 expAreas[102] += 6.25;
179 expAreas[103] += 100.0;
180 expAreas[104] += 50.0;
184 cout << myname <<
"Add signal " << ++isig <<
endl;
185 data[102].binSamples[1][20] = 100.0;
186 expAreas[101] += 25.0;
187 expAreas[102] += 100.0;
188 expAreas[103] += 12.5;
191 cout << myname << line <<
endl;
192 cout << myname <<
"Check signals." <<
endl;
194 cout << myname <<
"Add signal " << ++isig <<
endl;
195 data[101].binSamples[0][30] = 100.0;
196 expAreas[101] += 100.0;
197 expAreas[102] += 6.25;
200 cout << myname << line <<
endl;
201 cout << myname <<
"Check signals." <<
endl;
202 cout << myname <<
"Signal count: " << nsig <<
endl;
203 assert( isig == nsig );
205 cout << myname << line <<
endl;
206 cout << myname <<
"Call tool." <<
endl;
207 DataMap ret = pcondir->updateMap(data);
210 assert( ret.
getInt(
"responseVectorCount") == 6 );
211 assert( ret.
getInt(
"channelMin") == 101 );
212 assert( ret.
getInt(
"channelMax") == 104 );
214 cout << myname << line <<
endl;
215 cout << myname <<
"Check areas" <<
endl;
216 cout << myname <<
"Chan Nsam Area" <<
endl;
217 cout << myname <<
"---- ---- -----------" <<
endl;
218 for (
const auto& kdat : data ) {
219 Index icha = kdat.first;
223 for (
float sam : sams ) area +=
sam;
224 cout << myname <<
setw(4) << icha <<
setw(6) << nsam <<
setw(13) << area <<
endl;
228 cout << myname << line <<
endl;
229 string fnam =
"convhist.png";
230 cout << myname <<
"Create plot " << fnam <<
endl;
231 Plot plt(data.size());
232 plt.addData(data, 1, 2, 1);
235 cout << myname << line <<
endl;
236 cout << myname <<
"Done." <<
endl;
AdcSignalVectorVector binSamples
void print(std::ostream *pout) const
bool checkEqual(string s1, string s2)
void setChannelInfo(ChannelInfoPtr pchi)
void setEventInfo(EventInfoPtr pevi)
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
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
QTextStream & endl(QTextStream &s)