43 using namespace KM3NETDAQ;
47 Long64_t numberOfSlices;
61 JParser<> zap(
"Auxiliary program to write time slices with random data.");
65 zap[
'a'] =
make_field(detectorFile,
"detector.");
70 zap[
'T'] =
make_field(TCLB_ns,
"CLB state-machine time jitter") = 256;
71 zap[
'N'] =
make_field(recycling,
"number of recycles / time interval for sampling data") = make_pair(0, 0.0);
73 zap[
'F'] =
make_field(fast,
"fast - disable PMT simulation");
79 catch(
const exception &error) {
80 FATAL(error.what() << endl);
84 gRandom->SetSeed(seed);
86 JK40DefaultSimulatorInterface::setSigma(sigma_ns);
92 if (pmtParameters.getQE() != 1.0) {
94 WARNING(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
96 rates_Hz.correct(pmtParameters.getQE());
99 DEBUG(
"PMT parameters: " << endl << pmtParameters << endl);
100 DEBUG(
"K40 rates: " << endl << rates_Hz << endl);
111 JPMTParametersMap::Throw(
false);
116 if (runbyrun.is_valid()) {
118 NOTICE(
"Using run-by-run:" << endl << runbyrun << endl);
120 if (!runbyrun.hasNext()) {
121 FATAL(
"Run-by-run simulation yields no input." << endl);
124 if (rates_Hz.getSinglesRate() != 0.0) {
125 WARNING(
"Run-by-run simulation discards singles rate [Hz] " << rates_Hz.getSinglesRate() << endl);
139 NOTICE(
"Using fixed rates [Hz]: " << rates_Hz << endl);
154 JTimer timerco(
"constructor");
155 JTimer timerrc(
"recycle");
170 for ( ; counter != numberOfSlices; ) {
172 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
174 int frame_index = counter + 1;
176 if (runbyrun.hasNext()) {
178 summaryRouter.update(runbyrun.next());
180 summaryRouter.correct(dynamic_cast<const JPMTDefaultSimulatorInterface&>(simbad.getPMTSimulator()));
182 frame_index = summaryRouter.getFrameIndex();
183 run = summaryRouter.getRunNumber();
200 for (
size_t i = 1; i <= recycling.first && counter != numberOfSlices; ++i) {
202 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
206 timeslice.recycle(recycling.second);
220 timerco.print(cout,
true);
221 timerrc.print(cout,
true);
222 timerIO.print(cout,
true);
Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file...
Utility class to parse command line options.
Default implementation of the simulation of K40 background.
double getSigma(vector< double > &v)
get standard deviation of vector content
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for UTC time.
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.
#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.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
PMT simulation based on run-by-run information.
virtual const char * what() const override
Get error message.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector
Timeslice with random data.
Default PMT simulation interface.
Auxiliary class for K40 rates.
#define DEBUG(A)
Message macros.