39 int main(
int argc,
char **argv)
43 using namespace KM3NETDAQ;
47 Long64_t numberOfSlices;
59 JParser<> zap(
"Auxiliary program to write time slices with random data.");
63 zap[
'a'] =
make_field(detectorFile,
"detector.");
68 zap[
'T'] =
make_field(TCLB_ns,
"CLB state-machine time jitter") = 256;
69 zap[
'N'] =
make_field(recycling,
"number of recycles / time interval for sampling data") = make_pair(0, 0.0);
75 catch(
const exception &error) {
76 FATAL(error.what() << endl);
80 gRandom->SetSeed(seed);
87 if (pmtParameters.getQE() != 1.0) {
89 WARNING(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
91 rates_Hz.correct(pmtParameters.getQE());
94 DEBUG(
"PMT parameters: " << endl << pmtParameters << endl);
95 DEBUG(
"K40 rates: " << endl << rates_Hz << endl);
106 JPMTParametersMap::Throw(
false);
111 if (runbyrun.is_valid()) {
113 NOTICE(
"Using run-by-run:" << endl << runbyrun << endl);
115 if (!runbyrun.hasNext()) {
116 FATAL(
"Run-by-run simulation yields no input." << endl);
119 if (rates_Hz.getSinglesRate() != 0.0) {
120 WARNING(
"Run-by-run simulation discards singles rate [Hz] " << rates_Hz.getSinglesRate() << endl);
134 NOTICE(
"Using fixed rates [Hz]: " << rates_Hz << endl);
147 JTimer timerco(
"constructor");
148 JTimer timerrc(
"recycle");
163 for ( ; counter != numberOfSlices; ) {
165 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
167 int frame_index = counter + 1;
169 if (runbyrun.hasNext()) {
171 summaryRouter.update(runbyrun.next());
173 summaryRouter.correct(dynamic_cast<const JPMTDefaultSimulatorInterface&>(simbad.
getPMTSimulator()));
175 frame_index = summaryRouter.getFrameIndex();
176 run = summaryRouter.getRunNumber();
193 for (
size_t i = 1; i <= recycling.first && counter != numberOfSlices; ++i) {
195 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
199 timeslice.
recycle(recycling.second);
209 timerco.
print(cout,
true);
210 timerrc.
print(cout,
true);
211 timerIO.
print(cout,
true);
Utility class to parse command line options.
ROOT TTree parameter settings.
Default implementation of the simulation of K40 background.
Auxiliary class to handle run by run options.
Recording of objects on file according a format that follows from the file name extension.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
const JPMTSimulator & getPMTSimulator() const
Get PMT simulator.
Data structure for UTC time.
Data structure for detector geometry and calibration.
unsigned int JTDC_t
leading edge [ns]
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
K40 simulation based on run-by-run information.
void setDAQLongprint(const bool option)
Set DAQ print option.
Scanning of objects from a single file according a format that follows from the extension of each fil...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for CPU timing and usage.
Auxiliary class for map of PMT parameters.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
General purpose messaging.
void reset(JK40Simulator *k40Simulator)
Reset K40 simulator.
PMT simulation based on run-by-run information.
Utility class to parse command line options.
virtual const char * what() const
Get error message.
Timeslice with random data.
#define DEBUG(A)
Message macros.
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.
Auxiliary class for K40 rates.
int main(int argc, char *argv[])