30int main(
int argc,
char **argv)
37 JLimit_t& numberOfEvents = inputFile.getLimit();
44 JParser<> zap(
"Example program to histogram summary data.");
54 catch(
const exception& error) {
55 FATAL(error.what() << endl);
59 const double factor = 1.0e-3;
67 TProfile h1(
"h1", NULL, 32,-0.5, 31.5);
68 TProfile h2(
"h2", NULL, 32,-0.5, 31.5);
70 TH2D hu(
"hu", NULL, 201, -0.5, +200.5, 201, -0.5, +200.5);
72 TH2D hv(
"hv", NULL, 51, -0.5, +50.5, 200, 0.0, 50.0);
73 TH2D hw(
"hw", NULL, 51, -0.5, +50.5, 200, 0.0, 50.0);
75 TH2D hx(
"hx", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS - 0.5, 200, 0.0, 50.0);
76 TH2D hy(
"hy", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS - 0.5, 200, 0.0, 50.0);
78 size_t udp[] = { 0, 0, 0, 0 };
90 << setw(6) << summaryslice->size() << endl);
94 for (JDAQSummaryslice::const_iterator frame = summaryslice->begin(); frame != summaryslice->end(); ++frame) {
99 double R[2] = { 0.0 };
101 int lower[2] = { 0 };
102 int upper[2] = { 0 };
106 const int index = (!frame->testHighRateVeto(pmt) && !frame->testFIFOStatus(pmt) ? 0 : 1);
109 R[index] += correct ?
getRate(*frame, pmt, factor) : frame->getRate(pmt, factor);
116 h0.Fill(correct ?
getRate(*frame, pmt, factor) : frame->getRate(pmt, factor), frame->getWeight(pmt, factor));
118 if (!frame->testHighRateVeto(pmt) && !frame->testFIFOStatus(pmt)) {
119 hb.Fill(correct ?
getRate(*frame, pmt, factor) : frame->getRate(pmt, factor), frame->getWeight(pmt, factor));
122 h1.Fill((Double_t) pmt, (frame->testHighRateVeto(pmt) ? 1.0 : 0.0));
123 h2.Fill((Double_t) pmt, (frame->testFIFOStatus (pmt) ? 1.0 : 0.0));
126 hu.Fill((
double) frame->getUDPMaximalSequenceNumber(),
127 (
double) frame->getUDPNumberOfReceivedPackets());
129 if (N[0] != 0) { hv.Fill((
double) frame->getUDPMaximalSequenceNumber(), R[0] / N[0]); }
130 if (N[1] != 0) { hw.Fill((
double) frame->getUDPMaximalSequenceNumber(), R[1] / N[1]); }
134 hx.Fill((
double) N[1], R[0] / N[0]);
136 if (lower[0] != 0 && upper[0] != 0) {
137 hy.Fill((
double) N[1], R[0] / N[0]);
141 const bool status = (frame->getUDPNumberOfReceivedPackets() == frame->getUDPMaximalSequenceNumber() + 1 &&
142 frame->hasUDPTrailer());
145 udp[1] += (status ? 1 : 0);
146 udp[2] += max(frame->getUDPMaximalSequenceNumber() + 1,
147 frame->getUDPNumberOfReceivedPackets());
148 udp[3] += frame->getUDPNumberOfReceivedPackets();
150 h1.Fill((Double_t) 31, (frame->testWhiteRabbitStatus() ? 1.0 : 0.0));
151 h2.Fill((Double_t) 31, (status ? 1.0 : 0.0));
158 for (
int i = 0; i !=
sizeof(udp)/
sizeof(udp[0]); ++i) {
159 cout <<
"UDP[" << i <<
"] = " << setw(12) << udp[i] << endl;
162 cout <<
"Estimated packet loss probability " <<
SCIENTIFIC(12,3) << (double) (udp[2] - udp[3]) / (double) (udp[2]) << endl;
163 cout <<
"Estimated packet loss probability (worst-case-scenario) " <<
SCIENTIFIC(12,3) << (double) (udp[0] - udp[1]) / (double) (udp[3]) << endl;