25 using std::istringstream;
38 for (
const auto& iacd : acds ) {
39 cout << pre <<
setw(2) << iacd.first <<
":";
40 for (
float sam : iacd.second.samples ) {
50 const string myname =
"test_CnrByGroup: ";
52 cout << myname <<
"NDEBUG must be off." <<
endl;
55 string line =
"-----------------------------";
57 cout << myname << line <<
endl;
58 string fclfile =
"test_CnrByGroup.fcl";
59 if ( ! useExistingFcl ) {
60 ofstream
fout(fclfile.c_str());
63 fout <<
" tool_type: CnrByGroup" <<
endl;
65 fout <<
" Groups: [\"grpa:0:5\", \"grpb:5:10\"]" <<
endl;
71 cout << myname <<
"Using existing top-level FCL." <<
endl;
74 cout << myname << line <<
endl;
75 cout << myname <<
"Fetching tool manager." <<
endl;
77 assert ( ptm !=
nullptr );
82 cout << myname << line <<
endl;
83 cout << myname <<
"Fetching tool." <<
endl;
85 assert( ptoo !=
nullptr );
87 cout << myname << line <<
endl;
88 cout << myname <<
"Create channel data." <<
endl;
90 float noiseSigma = 0.5;
91 for (
Index icha=0; icha<10; ++icha ) {
92 float off = icha < 5 ? 10 : 20;
93 for (
Index isam=0; isam<8; ++isam ) {
94 acds[icha].samples.push_back(gRandom->Gaus(off, noiseSigma));
95 acds[icha].setChannelInfo(icha, 0, icha, 0);
100 cout << myname << line <<
endl;
101 cout << myname <<
"Call tool." <<
endl;
102 DataMap ret = ptoo->updateMap(acds);
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";
int test_CnrByGroup(bool useExistingFcl)
void showSamples(const AdcChannelDataMap &acds, string pre)
Q_EXPORT QTSManip setprecision(int p)
Q_EXPORT QTSManip setw(int w)
int main(int argc, char *argv[])
void line(double t, double *p, double &x, double &y, double &z)
std::vector< AdcSignal > AdcSignalVector
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
Dft::FloatVector FloatVector
QTextStream & endl(QTextStream &s)