29 int main(
int argc,
char **argv)
36 Long64_t numberOfSlices;
44 JParser<> zap(
"Example program to test generation of time slices with random data.");
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);
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 gRandom->SetSeed(seed);
66 for (Long64_t counter = 0; counter != numberOfSlices; ++counter) {
68 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
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));
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));
92 timeslice[0].
add(buffer.size(), buffer.data());
97 h0->Fill((Double_t) hit->getT());
100 for (
size_t i = 1; i <= recycling.first; ++i) {
102 timeslice.
recycle(recycling.second);
107 h0->Fill((Double_t) hit->getT());
KM3NeT DAQ constants, bit handling, etc.
Dynamic ROOT object management.
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#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.
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
unsigned char JPMT_t
PMT channel in FPGA.
JDAQTimeslice & add(const JDAQTimeslice ×lice)
Add another timeslice.
int main(int argc, char **argv)
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.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Timeslice with random data.
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.