23 using std::ostringstream;
36 if ( sigdiff < -0.5 )
return false;
37 if ( sigdiff > 0.5 )
return false;
44 const string myname =
"test_AcdDigitReader: ";
46 cout << myname <<
"NDEBUG must be off." <<
endl;
49 string line =
"-----------------------------";
51 cout << myname << line <<
endl;
52 string fclfile =
"test_AcdDigitReader.fcl";
53 if ( ! useExistingFcl ) {
54 cout << myname <<
"Creating top-level FCL." <<
endl;
55 ofstream
fout(fclfile.c_str());
58 fout <<
" tool_type: AcdDigitReader" <<
endl;
64 cout << myname <<
"Using existing top-level FCL." <<
endl;
67 cout << myname << line <<
endl;
68 cout << myname <<
"Fetching tool manager." <<
endl;
70 assert ( ptm !=
nullptr );
75 cout << myname << line <<
endl;
76 cout << myname <<
"Fetching tool." <<
endl;
78 assert( prdr !=
nullptr );
80 cout << myname << line <<
endl;
81 cout << myname <<
"Construct test digit." <<
endl;
86 cout << myname << line <<
endl;
87 cout << myname <<
"Extract data from digit." <<
endl;
90 assert( prdr->update(acd) == 0 );
96 cout << myname <<
"Output raw vector size: " << sigs.size() <<
endl;
97 cout << myname <<
"Output prep vector size: " << sigs.size() <<
endl;
98 cout << myname <<
" Output flags size: " << flags.size() <<
endl;
99 cout << myname <<
" Pedestal: " << pedout <<
endl;
100 assert( raw.size() == nsig );
101 assert( chanout == pdig->
Channel() );
105 for (
unsigned int isig=0; isig<nsig; ++isig ) {
109 if ( dbg ) cout << isig <<
": " << sigin <<
" --> " << sigout
110 <<
" (flag=" << flag <<
")" <<
endl;
111 if ( flag ==
AdcGood) assert( sigout == sigin );
114 cout << myname << line <<
endl;
115 cout << myname <<
"Done." <<
endl;
122 bool useExistingFcl =
false;
124 string sarg(argv[1]);
125 if ( sarg ==
"-h" ) {
126 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
127 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
130 useExistingFcl = sarg ==
"true" || sarg ==
"1";
float GetPedestal() const
std::vector< AdcCount > AdcCountVector
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Collection of charge vs time digitized from a single readout channel.
int test_AcdDigitReader(bool useExistingFcl=false)
std::vector< AdcFlag > AdcFlagVector
ChannelID_t Channel() const
DAQ channel this raw data was read from.
const raw::RawDigit * pdig
const raw::RawDigit * digit
Q_EXPORT QTSManip setprecision(int p)
int main(int argc, char *argv[])
Q_EXPORT QTSManip setw(int w)
void line(double t, double *p, double &x, double &y, double &z)
std::vector< AdcSignal > AdcSignalVector
bool sigequal(AdcSignal sig1, AdcSignal sig2)
QTextStream & endl(QTextStream &s)