43{
46
49 JLimit_t& numberOfEvents = inputFile.getLimit();
50 string detectorFile;
55
56 try {
57
58 JParser<> zap(
"Auxiliary program to generate noise in Monte Carlo event.");
59
68
69 zap(argc, argv);
70 }
71 catch(const exception &error) {
72 FATAL(error.what() << endl);
73 }
74
75
76 seed.set(gRandom);
77
78 const int NPE = 1;
79
80
82
83 try {
85 }
88 }
89
90
92
94
96 }
97
98
100
102
105 }
106
109
110 if (!inputFile.empty()) {
111
113
115
117
119
121
123
125
127
129
130 iter_swap(i, --__end);
131
132 } else {
133
134 time_range.include(
getTime(*i));
135
136 ++i;
137 }
138 }
139
140 event->mc_hits.erase(__end, event->mc_hits.end());
141
142 if (time_range.is_valid())
143 time_range.add(period);
144 else
145 time_range = period;
146
147
148 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
149
150 if (!module->empty()) {
151
153
154 modk40.generateHits(*module, time_range, buffer);
155
156 for (unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
157
158 const JModuleData::value_type& frame = buffer[pmt];
159
160 for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
161
162 event->mc_hits.push_back(
JHit_t(event->mc_hits.size() + 1,
163 module->getPMT(pmt).getID(),
165 0,
166 hit->t_ns,
167 NPE));
168 }
169 }
170 }
171 }
172
173
175 }
176
177 } else {
178
179 for (
counter_type counter = 0; counter != numberOfEvents; ++counter) {
180
181 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
182
184
186
187 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
188
189 if (!module->empty()) {
190
192
193 modk40.generateHits(*module, period, buffer);
194
195 for (unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
196
197 const JModuleData::value_type& frame = buffer[pmt];
198
199 for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
200
202 module->getPMT(pmt).getID(),
204 0,
205 hit->t_ns,
206 NPE));
207 }
208 }
209 }
210 }
211
212
214 }
215 }
217
220}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Default implementation of the simulation of K40 background.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
@ HIT_TYPE_NOISE
Random noise.
bool is_noise(const Hit &hit)
Verify hit origin.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
const char * getTime()
Get current local time conform ISO-8601 standard.
double getMaximalTime(const double R_Hz)
Get maximal time for given rate.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Template definition of random value generator.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for K40 rates.
Auxiliary class to set-up Hit.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.