39 int main(
int argc,
char **argv)
45 JFileRecorder<JTYPELIST<JDAQTimesliceL0, JMeta, JRootTypes_t>::typelist>
outputFile;
47 Long64_t numberOfEvents;
49 JPMTParametersMap pmtParameters;
58 JParser<> zap(
"Auxiliary program to write time slices with random data.");
61 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
62 zap[
'a'] =
make_field(detectorFile,
"detecto.");
73 catch(
const exception &error) {
74 FATAL(error.what() << endl);
78 gRandom->SetSeed(seed);
85 if (pmtParameters.getQE() != 1.0) {
87 WARNING(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
89 rates_Hz.correct(pmtParameters.getQE());
92 DEBUG(
"PMT parameters: " << endl << pmtParameters << endl);
93 DEBUG(
"K40 rates: " << endl << rates_Hz << endl);
98 load(detectorFile, detector);
100 catch(
const JException& error) {
104 JPMTParametersMap::Throw(
false);
106 JDetectorSimulator simbad(detector);
107 JSummaryRouter summaryRouter;
109 if (runbyrun.is_valid()) {
111 NOTICE(
"Using run-by-run:" << endl << runbyrun << endl);
113 if (!runbyrun.hasNext()) {
114 FATAL(
"Run-by-run simulation yields no input." << endl);
117 if (rates_Hz.getSinglesRate() != 0.0) {
118 WARNING(
"Run-by-run simulation discards singles rate [Hz] " << rates_Hz.getSinglesRate() << endl);
122 simbad.reset(
new JK40RunByRunSimulator(summaryRouter, rates_Hz));
123 simbad.reset(
new JPMTRunByRunSimulator(summaryRouter, pmtParameters, detector, runbyrun.range_Hz));
124 simbad.reset(
new JCLBDefaultSimulator());
126 catch(
const JException& error) {
127 FATAL(error.what() << endl);
132 NOTICE(
"Using fixed rates [Hz]: " << rates_Hz << endl);
135 simbad.reset(
new JK40DefaultSimulator(rates_Hz));
136 simbad.reset(
new JPMTDefaultSimulator(pmtParameters, detector));
137 simbad.reset(
new JCLBDefaultSimulator());
139 catch(
const JException& error) {
140 FATAL(error.what() << endl);
145 JTimer timerco(
"constructor");
146 JTimer timerIO(
"I/O");
160 for ( ; count <= numberOfEvents; ++count) {
162 STATUS(
"event: " << setw(10) << count <<
'\r');
DEBUG(endl);
164 int frame_index = count;
166 if (runbyrun.hasNext()) {
168 summaryRouter.update(runbyrun.next());
170 summaryRouter.correct(dynamic_cast<const JPMTDefaultSimulatorInterface&>(simbad.getPMTSimulator()));
172 frame_index = summaryRouter.getFrameIndex();
173 run = summaryRouter.getRunNumber();
194 const double factor = 1.0 / (double) (count - 1);
196 timerco.print(cout, factor);
197 timerIO.print(cout, factor);