38 inline void print(
const TH1& h1, std::ostream& out)
42 out << setw(
WIDTH) << left << h1.GetName() <<
' '
43 <<
FIXED(8,0) << h1.GetEntries() <<
' '
44 <<
FIXED(8,2) << h1.GetMean() <<
' '
45 <<
FIXED(8,2) << h1.GetRMS() <<
' '
56 int main(
int argc,
char **argv)
63 JLimit_t& numberOfEvents = inputFile.getLimit();
70 JParser<> zap(
"Auxiliary program to histogram and print trigger statistics.");
74 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
80 catch(
const exception &error) {
81 FATAL(error.what() << endl);
88 TH1D h1(
"Event ", NULL, 100, 0.0, 1.0e1);
89 TH1D h2(
"Summary ", NULL, 100, 0.0, 1.0e1);
92 TH1D hn(
"Trigger hits ", NULL, 1000, -0.5, 1000 - 0.5);
93 TH1D hs(
"Snapshot hits ", NULL, 1000, -0.5, 10000 - 0.5);
94 TH1D hr(
"PMT rate [kHz]", NULL, 100, 0.0, 50.0);
99 NOTICE(trigger_parameters << endl);
102 for (JMultipleFileScanner<JDAQEvent> input = inputFile; input.
hasNext(); ) {
104 STATUS(
"entry: " << setw(10) << input.getCounter() <<
'\r');
DEBUG(endl);
108 h1.Fill((Double_t) object->
getSize() * 1e-6);
115 hm.Fill((Double_t) i);
138 long long int numberOfSummaryslices = 0;
140 for (JMultipleFileScanner<JDAQSummaryslice> input = inputFile; input.
hasNext(); ++numberOfSummaryslices) {
142 STATUS(
"entry: " << setw(10) << input.getCounter() <<
'\r');
DEBUG(endl);
146 h2.Fill((Double_t) object->
getSize() * 1e-6);
148 for (JDAQSummaryslice::const_iterator i = object->begin(); i !=
object->end(); ++i) {
150 hr.Fill(i->getRate(pmt) * 1.0e-3);
165 NOTICE(
"Background rate estimate from snapshot hits " << setprecision(2)
166 << (hs.GetMean() - hn.GetMean()) * numberOfSummaryslices / (hr.GetEntries() * 2e-6 * trigger_parameters.
TMaxEvent_ns)
167 <<
" [kHz]" << endl);
171 const double T = numberOfSummaryslices * 1.0e-9 *
getFrameTime();
173 NOTICE(setw(
WIDTH) << left <<
"Total run duration (based on time slices) [s] " <<
FIXED(7,1) << T << endl);
176 for (Int_t i = 1; i <= hm.GetNbinsX(); ++i) {
179 const Double_t y = (Double_t) hm.GetBinContent(i);
183 if (name != NULL || y != 0.0) {
186 <<
"[" << setw(2) << x <<
"]" <<
' '
187 << setw(16) << left << (name != NULL ? name :
"?") <<
' '
190 if (numberOfSummaryslices != 0) {
199 << setw(4) <<
" " <<
' '
200 << setw(16) <<
" " <<
' '
201 <<
FIXED(7,0) << h1.GetEntries());
203 if (numberOfSummaryslices != 0) {
204 NOTICE(
FIXED(7,2) << h1.GetEntries() / T <<
" [Hz]");
214 out << hm << hn << hs << hr;
221 for (Int_t i = 1; i <= hm.GetNbinsX(); ++i) {
224 const Double_t y = (Double_t) hm.GetBinContent(i);