55 JParser<> zap(
"Auxiliary program to generate noise in Monte Carlo event.");
59 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
61 zap[
'T'] =
make_field(period) = JTimeRange::DEFAULT_RANGE;
68 catch(
const exception &error) {
69 FATAL(error.what() << endl);
73 gRandom->SetSeed(seed);
88 if (period == JTimeRange::DEFAULT_RANGE) {
107 if (!inputFile.empty()) {
113 while (inputFile.hasNext()) {
115 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
117 Evt*
event = inputFile.next();
119 JTimeRange time_range(JTimeRange::DEFAULT_RANGE);
127 iter_swap(i, --__end);
131 time_range.include(
getTime(*i));
137 event->mc_hits.erase(__end, event->mc_hits.end());
139 if (time_range.is_valid())
140 time_range.add(period);
147 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
149 buffer.
reset(module->size());
151 modk40.generateHits(*module, time_range, buffer);
153 for (
unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
155 const JModuleData::value_type& frame = buffer[pmt];
157 for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
159 event->mc_hits.push_back(
JHit_t(event->mc_hits.size() + 1,
160 module->getPMT(pmt).getID(),
170 outputFile.put(*event);
174 for (
counter_type counter = 0; counter != numberOfEvents; ++counter) {
176 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
182 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
184 buffer.
reset(module->size());
186 modk40.generateHits(*module, period, buffer);
188 for (
unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
190 const JModuleData::value_type& frame = buffer[pmt];
192 for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
195 module->getPMT(pmt).getID(),
205 outputFile.put(event);
210 outputFile.put(*gRandom);
Utility class to parse command line options.
void reset(size_t size)
Reset buffers.
Default implementation of the simulation of K40 background.
Data structure for PMT data corresponding to a detector module.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [ns]).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Long64_t counter_type
Type definition for counter.
double getTime(const Hit &hit)
Get true time of hit.
bool is_noise(const Hit &hit)
Verify hit origin.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getMaximalTime(const double R_Hz)
Get maximal time for given rate.
Template specialisation of JMultipleFileScanner for Monte Carlo header.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Auxiliary class to set-up Hit.
const JLimit & getLimit() const
Get limit.
Auxiliary class for K40 rates.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.