25 using std::istringstream;
37 const string myname =
"test_KeepAllRoiBuildingService: ";
39 cout << myname <<
"NDEBUG must be off." <<
endl;
42 string line =
"-----------------------------";
44 cout << myname << line <<
endl;
45 cout << myname <<
"Arguments: " <<
endl;
46 cout << myname <<
" LogLevel: " << a_LogLevel <<
endl;
47 cout << myname <<
" explicitFcl: " << explicitFcl <<
endl;
49 cout << myname << line <<
endl;
50 cout << myname <<
"Create top-level FCL." <<
endl;
51 std::ostringstream
fout;
52 fout <<
"#include \"services_dune.fcl\"" <<
endl;
53 fout <<
"services: @local::dune35t_services_legacy" <<
endl;
55 fout <<
"services.AdcRoiBuildingService: {" <<
endl;
56 fout <<
" service_provider: KeepAllRoiBuildingService" <<
endl;
57 fout <<
" LogLevel: " << a_LogLevel <<
endl;
60 fout <<
"services.AdcRoiBuildingService: @local::adcroi_keepall" <<
endl;
64 const unsigned int nsig = 100;
67 for (
unsigned int isig=0; isig<nsig; ++isig ) {
85 cout << myname << line <<
endl;
86 cout << myname <<
"Fetch ROI building service." <<
endl;
88 hroi->
print(cout, myname);
90 cout << myname << line <<
endl;
91 cout << myname <<
"Build ROIs." <<
endl;
93 cout << myname <<
"Samples size: " << acd.
samples.size() <<
endl;
94 cout << myname <<
"Output ROIS size: " << acd.
rois.size() <<
endl;
95 assert( sigs.size() == nsig );
96 for (
unsigned int isig=0; isig<nsig; ++isig ) {
97 cout << myname <<
setw(4) << isig <<
": " 101 assert( sigs[isig] == sigsin[isig] );
103 cout << myname << line <<
endl;
104 cout << myname <<
"ROIS:" <<
endl;
106 cout <<
setw(6) << roi.first <<
setw(6) << roi.second <<
endl;
109 cout << myname << line <<
endl;
110 cout << myname <<
"Check ROIs." <<
endl;
111 assert( acd.
rois.size() == 1 );
112 assert( acd.
rois[0].first == 0 );
113 assert( acd.
rois[0].second == 99 );
115 cout << myname << line <<
endl;
116 cout << myname <<
"Done." <<
endl;
124 bool explicitFcl = 1;
126 istringstream ssarg(argv[1]);
130 string sarg(argv[2]);
131 explicitFcl = sarg==
"1" || sarg ==
"true";
133 cout <<
" LogLevel: " << a_LogLevel <<
endl;
134 cout <<
" explicitFcl: " << explicitFcl <<
endl;
virtual int build(AdcChannelData &data) const =0
int main(int argc, char *argv[])
vector< unsigned int > IndexVector
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
std::pair< AdcIndex, AdcIndex > AdcRoi
static void load_services(std::string const &config)
Q_EXPORT QTSManip setprecision(int p)
void setChannelInfo(ChannelInfoPtr pchi)
Q_EXPORT QTSManip setw(int w)
int test_KeepAllRoiBuildingService(int a_LogLevel=1, bool explicitFcl=true)
void line(double t, double *p, double &x, double &y, double &z)
std::vector< AdcSignal > AdcSignalVector
QTextStream & endl(QTextStream &s)