30{
34
36 Long64_t numberOfSlices;
37 double rate_Hz;
39 ULong_t seed;
41
42 try {
43
44 JParser<> zap(
"Example program to test generation of time slices with random data.");
45
48 zap[
'B'] =
make_field(rate_Hz,
"background rate [Hz]");
49 zap[
'N'] =
make_field(recycling,
"number of recycles / time interval for sampling data") = make_pair(0, 0.0);
52
53 zap(argc, argv);
54 }
55 catch(const exception &error) {
56 FATAL(error.what() << endl);
57 }
58
59
60 gRandom->SetSeed(seed);
61
63
65
66 for (Long64_t counter = 0; counter != numberOfSlices; ++counter) {
67
68 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
69
71
72 timeslice.resize(1);
73
74
76
77 if (rate_Hz > 0.0) {
78
79 double period_ns = 1.0e9 / (NUMBER_OF_PMTS * rate_Hz);
80
81 for (
double t1 = 0.0 *
getFrameTime() + gRandom->Exp(period_ns); t1 < 0.5 * getFrameTime(); t1 += gRandom->Exp(period_ns)) {
82 buffer.push_back(
JDAQHit(PMT_L0[0], t1, 0));
83 }
84
85 period_ns *= 2.0;
86
87 for (
double t1 = 0.5 *
getFrameTime() + gRandom->Exp(period_ns); t1 < 1.0 * getFrameTime(); t1 += gRandom->Exp(period_ns)) {
88 buffer.push_back(
JDAQHit(PMT_L0[1], t1, 0));
89 }
90 }
91
92 timeslice[0].
add(buffer.size(), buffer.data());
93
94 TH1D* h0 = H0[0];
95
97 h0->Fill((Double_t) hit->getT());
98 }
99
100 for (size_t i = 1; i <= recycling.first; ++i) {
101
102 timeslice.
recycle(recycling.second);
103
104 TH1D* h0 = H0[i];
105
107 h0->Fill((Double_t) hit->getT());
108 }
109 }
110 }
112
113
115
116 out << H0;
117
118 out.Write();
119 out.Close();
120}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
unsigned char JPMT_t
PMT channel in FPGA.
JDAQTimeslice & add(const JDAQTimeslice ×lice)
Add another timeslice.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
Timeslice with random data.
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.