27 using std::ostringstream;
36 const string myname =
"test_AdcDetectorPlotter: ";
38 cout << myname <<
"NDEBUG must be off." <<
endl;
41 string line =
"-----------------------------";
43 cout << myname << line <<
endl;
44 string fclfile =
"test_AdcDetectorPlotter.fcl";
45 string gname =
"protodune_geo";
47 cout << myname <<
"Using existing top-level FCL." <<
endl;
49 cout << myname <<
"Creating top-level FCL." <<
endl;
50 std::ofstream
config{fclfile};
51 config <<
"#include \"geometry_dune.fcl\"" <<
endl;
52 config <<
"services.Geometry: @local::" + gname <<
endl;
53 config <<
"services.ExptGeoHelperInterface: @local::dune_geometry_helper" <<
endl;
54 config <<
"#include \"dataprep_tools.fcl\"" <<
endl;
56 config <<
" tool_type: AdcDetectorPlotter" <<
endl;
76 config <<
" Title: \"Prepared ADC run %RUN% event %EVENT%\"" <<
endl;
78 config <<
" FileName: \"test_AdcDetectorPlotter-run%0RUN%-evt%0EVENT%.png\"" <<
endl;
83 cout << myname << line <<
endl;
84 cout << myname <<
"Get Geometry service." <<
endl;
88 cout << myname << line <<
endl;
89 cout << myname <<
"Fetching tool manager." <<
endl;
91 assert ( ptm !=
nullptr );
96 cout << myname << line <<
endl;
97 cout << myname <<
"Fetching tool." <<
endl;
99 assert( padv !=
nullptr );
101 cout << myname << line <<
endl;
102 cout << myname <<
"Create data." <<
endl;
104 vector<vector<AdcChannelDataMap>> evtdatamaps(nevt);
115 bool strumWires =
false;
117 for ( vector<AdcChannelDataMap>& datamaps : evtdatamaps ) {
119 datamaps.resize(ntpc);
121 for (
Index itpc=0; itpc<ntpc; ++itpc ) {
127 for (
Index icha=0; icha<ncha; ++ icha ) datamap[icha];
130 Index ngrp = datamaps.size();
131 cout << myname <<
" Event " << tester.
event <<
endl;
132 cout << myname <<
" Group count is " << ngrp <<
endl;
133 for (
Index igrp=0; igrp<ngrp; ++ igrp ) {
134 cout << myname <<
" Group " << igrp <<
" channel count: " << datamaps[igrp].size() <<
endl;
139 cout << myname << line <<
endl;
140 cout << myname <<
"Call tool." <<
endl;
143 for (
AdcIndex ievt=0; ievt<nevt; ++ievt ) {
144 cout << myname <<
"Event " << ievt <<
endl;
149 const vector<AdcChannelDataMap>& datamaps = evtdatamaps[ievt];
150 Index ngrp = datamaps.size();
152 for (
Index igrp=0; igrp<ngrp; ++igrp ) {
154 assert( datamap.size() > 0 );
155 assert( datamap.begin()->second.event() == ievt );
156 assert( datamap.begin()->second.run() == tester.
run );
157 cout << myname <<
"Calling tool for event " << ievt <<
", group " << igrp
158 <<
", Nchan = " << datamap.size() <<
endl;
159 assert( padv->viewMap(datamap) == 0 );
164 cout << myname << line <<
endl;
165 cout << myname <<
"Done." <<
endl;
172 bool useExistingFcl =
false;
174 string sarg(argv[1]);
175 if ( sarg ==
"-h" ) {
176 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
177 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
180 useExistingFcl = sarg ==
"true" || sarg ==
"1";
int test_AdcDetectorPlotter(bool useExistingFcl=false)
static constexpr FileOnPath_t FileOnPath
Geometry information for a single cryostat.
static void load_services(std::string const &config)
art framework interface to geometry description
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
int strumChannels(AdcChannelDataMap &acds, Index ncha=0)
unsigned int NTPC() const
Number of TPCs in this cryostat.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
void line(double t, double *p, double &x, double &y, double &z)
int strumTpcWires(AdcChannelDataMap &acds, Index itpc, Index icry=0)
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
int main(int argc, char *argv[])
QTextStream & endl(QTextStream &s)