58 Long64_t numberOfSlices;
72 JParser<> zap(
"Auxiliary program to write time slices with random data.");
76 zap[
'a'] =
make_field(detectorFile,
"detector.");
81 zap[
'T'] =
make_field(TCLB_ns,
"CLB state-machine time jitter") = 256;
82 zap[
'N'] =
make_field(recycling,
"number of recycles / time interval for sampling data [ns]") = make_pair(0, 0.0);
84 zap[
'F'] =
make_field(fast,
"fast - disable PMT simulation");
90 catch(
const exception &error) {
91 FATAL(error.what() << endl);
97 FATAL(
"Invalid number of output files; should be 1 or 2." << endl);
100 gRandom->SetSeed(seed);
102 JK40DefaultSimulatorInterface::setSigma(sigma_ns);
107 if (pmtParameters.
getQE() != 1.0) {
109 WARNING(
"Correct background rates with global efficiency " << pmtParameters.
getQE() << endl);
114 DEBUG(
"PMT parameters: " << endl << pmtParameters << endl);
115 DEBUG(
"K40 rates: " << endl << rates_Hz << endl);
126 JPMTParametersMap::Throw(
false);
133 NOTICE(
"Using run-by-run:" << endl << runbyrun << endl);
136 FATAL(
"Run-by-run simulation yields no input." << endl);
154 NOTICE(
"Using fixed rates [Hz]: " << rates_Hz << endl);
169 JTimer timerco(
"constructor");
170 JTimer timerrc(
"recycle");
173 for (
size_t i = 0; i !=
outputFile.size(); ++i) {
187 for ( ; counter != numberOfSlices; ) {
189 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
191 int frame_index = counter + 1;
199 frame_index = summaryRouter.getFrameIndex();
200 run = summaryRouter.getRunNumber();
216 outputFile.rbegin()->put(timeslice); ++counter;
220 for (
size_t i = 1; i <= recycling.first && counter != numberOfSlices; ++i) {
222 STATUS(
"slice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
226 timeslice.recycle(recycling.second);
232 outputFile.rbegin()->put(timeslice); ++counter;
240 timerco.print(cout,
true);
241 timerrc.print(cout,
true);
242 timerIO.print(cout,
true);
253 buffer.
push(&JHead::DAQ);
254 buffer.
push(&JHead::K40);
256 copy(buffer, header);
262 for (
size_t i = 0; i !=
outputFile.size(); ++i) {
double getSigma(vector< double > &v)
get standard deviation of vector content
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void push(T JHead::*pd)
Push given data member to Head.
Default implementation of the simulation of K40 background.
Default PMT simulation interface.
Auxiliary class for map of PMT parameters.
double getQE(const JPMTIdentifier &id) const
Get QE of given PMT.
Auxiliary class for CPU timing and usage.
virtual const char * what() const override
Get error message.
virtual const pointer_type & next() override
Get next element.
virtual bool hasNext() override
Check availability of next element.
Utility class to parse command line options.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
void update(const JDAQSummaryslice *ps)
Update router.
K40 simulation based on run-by-run information.
unsigned int JTDC_t
leading edge [ns]
Data structure for UTC time.
void copy(const Head &from, JHead &to)
Copy header from from to to.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
T & getInstance(const T &object)
Get static instance from temporary object.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getLivetime(const std::string &file_name)
Get data taking live time.
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
void setDAQLongprint(const bool option)
Set DAQ print option.
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
double livetime_s
Live time [s].
double livetime_s
Live time [s].
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for K40 rates.
double getSinglesRate() const
Get singles rate.
void correct(const double QE)
Correct rates for global efficiency,.
Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file...
bool is_valid() const
Check validity of run by run options.
Timeslice with random data.