120 const string myname =
"AdcEventViewer::ctor: ";
122 bool toolNotFound =
false;
126 if ( crn.size() == 0 || crn ==
"all" ) {
127 m_crs.emplace_back(
"all", 0, 0,
"All");
129 if ( pcrt ==
nullptr && !toolNotFound ) {
131 if ( pcrt ==
nullptr ) {
132 cout << myname <<
"ERROR: IndexRangeTool not found: channelRanges" <<
endl;
135 if ( pcrt !=
nullptr ) {
138 m_crs.push_back(ran);
140 cout << myname <<
"WARNING: Channel range not found: " << crn <<
endl;
148 cout << myname <<
" EventHists: [" <<
endl;
152 cout << myname <<
" " <<
"]" <<
endl;
153 cout << myname <<
" EventGraphs: [" <<
endl;
157 cout << myname <<
" " <<
"]" <<
endl;
158 cout << myname <<
" ChannelRanges: [";
161 if ( ! first ) cout <<
", ";
168 cout << myname <<
" ClockRate: " <<
m_ClockRate <<
" tick/sec" <<
endl;
172 const string::size_type& npos = string::npos;
178 cout << myname <<
"WARNING: invalid clock unit changed to tick" <<
endl;
186 cout << myname <<
"WARNING: Skipping duplicate CR name: " << crn <<
endl;
197 string::size_type ipos = 0;
198 string::size_type jpos = 0;
200 jpos = hspec.find(
":");
201 if ( jpos != npos ) {
202 basename = hspec.substr(ipos, jpos-ipos);
204 jpos = hspec.find(
":", ipos);
205 if ( jpos != npos && jpos > ipos ) {
206 istringstream ssnbin(hspec.substr(ipos, jpos-ipos));
209 jpos = hspec.find(
":", ipos);
210 if ( jpos != npos && jpos > ipos ) {
211 istringstream ssxmin(hspec.substr(ipos, jpos-ipos));
215 istringstream ssxmax(hspec.substr(ipos, jpos-ipos));
222 cout <<
"WARNING: Invalid histogram configuration string: " << hspec <<
endl;
226 if ( crn !=
"all " ) hname +=
"_" + crn;
228 if ( basename.find(
"nfemb") != string::npos ) {
230 }
else if ( basename.find(
"rmPedPower") != string::npos ) {
231 vname =
"rmPedPower";
232 }
else if ( basename.find(
"meanPed") != string::npos ) {
235 cout << myname <<
"ERROR: No variable for histogram name " << hname <<
endl;
239 string sttl = vinfo.label;
240 sttl +=
";" + vinfo.label;
241 Name unit = vinfo.unit;
242 if ( unit.size() ) sttl +=
" [" + unit +
"]";
245 cout << myname <<
"Creating in histogram " << hname <<
", nbin=" << nbin
246 <<
", range=(" << xmin <<
", " << xmax <<
")" <<
endl;
248 TH1* ph =
new TH1F(hname.c_str(), sttl.c_str(), nbin, xmin, xmax);
249 ph->SetDirectory(
nullptr);
252 crstate.hists.push_back(ph);
253 if (
m_LogLevel>= 1 ) cout << myname <<
"Created histogram " << hname <<
endl;
256 if (
m_LogLevel >= 2 ) cout << myname <<
"Building graph info" <<
endl;
265 string::size_type ipos = 0;
266 string::size_type jpos = 0;
268 jpos = gspec.find(
":");
270 if ( jpos != npos ) {
271 xname = gspec.substr(ipos, jpos-ipos);
273 jpos = gspec.find(
":", ipos);
274 if (
m_LogLevel >= 2 ) cout << myname <<
" xname: " << xname <<
endl;
277 if ( jpos != npos && jpos > ipos ) {
279 if ( isalpha(gspec[ipos]) ) {
280 if (
m_LogLevel >= 2 ) cout << myname <<
" Taking x range from tool." <<
endl;
281 istringstream ssnran(gspec.substr(ipos, jpos-ipos));
282 Name ranName = gspec.substr(ipos, jpos-ipos);
284 if ( pcrt ==
nullptr ) {
285 cout << myname <<
"ERROR: Unable to find index range tool jobRanges" <<
endl;
292 cout << myname <<
"ERROR: Unable to find job range " << ranName <<
endl;
296 jpos = gspec.find(
":", ipos);
297 if ( jpos != npos && jpos > ipos ) {
298 istringstream ssxoff(gspec.substr(ipos, jpos-ipos));
303 if (
m_LogLevel >= 2 ) cout << myname <<
" Using explicit x range." <<
endl;
304 istringstream ssxmin(gspec.substr(ipos, jpos-ipos));
307 jpos = gspec.find(
":", ipos);
308 if ( jpos != npos && jpos > ipos ) {
309 istringstream ssxmax(gspec.substr(ipos, jpos-ipos));
315 jpos = gspec.find(
":", ipos);
317 if ( jpos != npos && jpos > ipos ) {
318 yname = gspec.substr(ipos, jpos-ipos);
320 jpos = gspec.find(
":", ipos);
321 if (
m_LogLevel >= 2 ) cout << myname <<
" yname: " << yname <<
endl;
324 if ( jpos != npos && jpos > ipos ) {
326 if ( isalpha(gspec[ipos]) ) {
327 if (
m_LogLevel >= 2 ) cout << myname <<
" Taking y range from tool." <<
endl;
328 istringstream ssnran(gspec.substr(ipos, jpos-ipos));
329 Name ranName = gspec.substr(ipos, jpos-ipos);
330 cout << myname <<
"Taking y-range from job range " << ranName <<
endl;
332 if ( pcrt ==
nullptr ) {
333 cout << myname <<
"ERROR: Unable to find index range tool jobRanges" <<
endl;
340 cout << myname <<
"ERROR: Unable to fund job range " << ranName <<
endl;
344 jpos = gspec.find(
":", ipos);
345 if ( jpos != npos && jpos > ipos ) {
346 istringstream ssyoff(gspec.substr(ipos, jpos-ipos));
351 if (
m_LogLevel >= 2 ) cout << myname <<
" Using explicit y range." <<
endl;
352 istringstream ssymin(gspec.substr(ipos, jpos-ipos));
355 jpos = gspec.find(
":", ipos);
357 istringstream ssymax(gspec.substr(ipos, jpos-ipos));
364 bool ok = xvin.isValid() && yvin.isValid();
366 cout << myname <<
"WARNING: Invalid graph configuration string: " << gspec <<
endl;
369 string sttl = yvin.label +
" vs. " + xvin.label;
371 cout << myname <<
"Creating graph of " << yname;
372 if ( ymax > ymin ) cout <<
" range=(" << ymin - yoff <<
", " << ymax + yoff <<
")";
373 else if ( ymax >= 0.0 ) cout <<
" range from data with border " << yoff <<
endl;
374 cout <<
" vs. " << xname;
375 if ( xmax > xmin ) cout <<
" range=(" << xmin <<
", " << xmax <<
")";
376 else if ( xmax >= 0.0 ) cout <<
" range from data with border " << xoff <<
endl;
379 crstate.graphs.emplace_back(xname, xvin.label, xvin.unit, xmin, xmax, xoff,
380 yname, yvin.label, yvin.unit, ymin, ymax, yoff );
381 if (
m_LogLevel>= 1 ) cout << myname <<
"Created graph info for " << yname <<
" vs. " << xname <<
endl;
ChannelGroupService::Name Name
ChannelRangeStates crstates
static constexpr double ps
ChannelRangeState & crstate(Name crn) const
NameVector m_ChannelRanges
QTextStream & endl(QTextStream &s)
std::vector< Name > NameVector