58 using namespace KM3NETDAQ;
69 JParser<> zap(
"Auxiliary program to histogram and print trigger statistics.");
73 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
79 catch(
const exception &error) {
80 FATAL(error.what() << endl);
87 TH1D h1(
"Timeslice", NULL, 100, 0.0, 1.0e3);
88 TH1D h2(
"Event ", NULL, 100, 0.0, 1.0e1);
89 TH1D h3(
"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);
98 long long int numberOfTimeslices = 0;
99 long long int numberOfSummaryslices = 0;
102 for (JMultipleFileScanner<JTriggerParameters> input = inputFile; input.hasNext(); ) {
104 trigger_parameters = *input.next();
106 NOTICE(trigger_parameters << endl);
110 for (JMultipleFileScanner<JDAQTimeslice> input = inputFile; input.hasNext(); ++numberOfTimeslices) {
112 STATUS(
"entry: " << setw(10) << input.getCounter() <<
'\r');
DEBUG(endl);
116 h1.Fill((Double_t) object->
getSize() * 1e-6);
120 for (JMultipleFileScanner<JDAQEvent> input = inputFile; input.hasNext(); ) {
122 STATUS(
"entry: " << setw(10) << input.getCounter() <<
'\r');
DEBUG(endl);
126 h2.Fill((Double_t) object->
getSize() * 1e-6);
133 hm.Fill((Double_t) i);
156 for (JMultipleFileScanner<JDAQSummaryslice> input = inputFile; input.hasNext(); ++numberOfSummaryslices) {
158 STATUS(
"entry: " << setw(10) << input.getCounter() <<
'\r');
DEBUG(endl);
162 h3.Fill((Double_t) object->
getSize() * 1e-6);
164 for (JDAQSummaryslice::const_iterator i = object->begin(); i !=
object->end(); ++i) {
166 hr.Fill(i->getRate(pmt) * 1.0e-3);
182 NOTICE(
"Background rate estimate from snapshot hits " << setprecision(2)
183 << (hs.GetMean() - hn.GetMean()) * numberOfSummaryslices / (hr.GetEntries() * 2e-6 * trigger_parameters.TMaxEvent_ns)
184 <<
" [kHz]" << endl);
187 long long int numberOfSlices = 0;
190 if (numberOfSlices == 0) numberOfSlices = numberOfTimeslices * trigger_parameters.writeTimeslices.prescale;
191 if (numberOfSlices == 0) numberOfSlices = numberOfSummaryslices * trigger_parameters.writeSummary .prescale;
194 const double T = numberOfSlices * 1.0e-9 *
getFrameTime();
196 NOTICE(setw(
WIDTH) << left <<
"Total run duration (based on time slices) [s] " <<
FIXED(7,1) << T << endl);
199 for (Int_t i = 1; i <= hm.GetNbinsX(); ++i) {
201 const Double_t x = hm.GetBinCenter (i);
202 const Double_t y = hm.GetBinContent(i);
207 <<
"[" << setw(2) << (
int) x <<
"]" <<
' '
211 if (numberOfSlices != 0) {
220 << setw(4) <<
" " <<
' '
221 << setw(16) <<
" " <<
' '
222 <<
FIXED(7,0) << h2.GetEntries());
224 if (numberOfSlices != 0) {
225 NOTICE(
FIXED(7,2) << h2.GetEntries() / T <<
" [Hz]");
232 out << h1 << h2 << h3;
233 out << hm << hn << hs << hr;
Auxiliary data structure for alignment of data.
Utility class to parse command line options.
Data structure for all trigger parameters.
bool hasTriggerBit(const unsigned int bit) const
Check trigger bit.
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits.
Auxiliary data structure for floating point format specification.
unsigned int size() const
Get number of hits.
static JTriggerMask_t getTriggerMask(const JDAQTriggeredHit &hit)
Get trigger mask of given hit.
JLimit JLimit_t
Type definition of limit.
virtual int getSize() const
Get size of object.
const_iterator< T > end() const
Get end of data.
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
const_iterator< T > begin() const
Get begin of data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getFrameTime()
Get frame time duration.
virtual int getSize() const
Get size of object.
Auxiliary class to set DAQ system clock parameters.
virtual int getSize() const
Get size of object.
const char * getTriggerName(JTriggerbit_t bit)
Get trigger name.
const JLimit & getLimit() const
Get limit.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
JTriggerCounter_t next()
Increment trigger counter.
#define DEBUG(A)
Message macros.