63{
67
69
72 JLimit_t& numberOfEvents = inputFile.getLimit();
73 string detectorFile;
75 bool reuse_parameters;
76 bool snapshot;
79
80 try {
81
82 JParser<> zap(
"Auxiliary program to re-trigger event data.");
83
84 zap[
'f'] =
make_field(inputFile,
"input file.");
87 zap[
'a'] =
make_field(detectorFile,
"detector file.");
89 zap[
'U'] =
make_field(reuse_parameters,
"reuse trigger parameters from input file.");
90 zap[
'S'] =
make_field(snapshot,
"use snapshot hits instead of triggered hits.");
93
94 zap(argc, argv);
95 }
96 catch(const exception &error) {
97 FATAL(error.what() << endl);
98 }
99
100
102
104
105 try {
107 }
110 }
111
112 if (reuse_parameters) {
113
114 try {
115
117
118 NOTICE(
"Set trigger parameters from input." << endl);
119 }
121 FATAL(
"No trigger parameters from input." << endl);
122 }
123 }
124
125
126
127 if (parameters.disableHighRateVeto) {
128
129 NOTICE(
"Disabling high-rate veto of all PMTs." << endl);
130
132 }
133
135
136 parameters.triggerNB.write.prescale = 1;
137
139 DEBUG(
"Reset time [ms] " <<
getRTS() * 1e-6 << endl);
140 DEBUG(
"Trigger" << endl << parameters << endl);
141
143
144 if (parameters.writeSummary()) {
WARNING(
"Discard writeSummary option during reprocesing of data." << endl); }
145 if (parameters.writeL1()) {
WARNING(
"Discard writeL1 option during reprocesing of data." << endl); }
146 if (parameters.writeL2()) {
WARNING(
"Discard writeL2 option during reprocesing of data." << endl); }
147 if (parameters.writeSN()) {
WARNING(
"Discard writeSN option during reprocesing of data." << endl); }
148
149
150
152
155 typedef JTimeslice <hit_type> JTimeslice_t;
156 typedef JBuildL1 <hit_type> JBuildL1_t;
157 typedef JBuildL2 <hit_type> JBuildL2_t;
158
159 const JBuildL1_t buildL1(parameters);
160 const JBuildL2_t buildL2(parameters.L2);
161 const JBuildL2_t buildSN(parameters.SN);
162 const JBuildL2_t buildNB(parameters.NB);
163
165
170
171
173
176 }
177
180
181
183
185
186 if (scan.getEntries() == 0) {
187 FATAL(
"No summary data." << endl);
188 }
189
191
193
195 Long64_t index = scan.find(*evt);
197
200 }
201
203
204 DEBUG(timeslice << endl);
205
206 timesliceRouter.configure(timeslice);
207
208
209 JTimeslice_t timesliceL0(timeslice.getDAQChronometer());
210 JTimeslice_t timesliceL1(timeslice.getDAQChronometer());
211 JTimeslice_t timesliceL2(timeslice.getDAQChronometer());
212 JTimeslice_t timesliceSN(timeslice.getDAQChronometer());
213 JTimeslice_t timesliceNB(timeslice.getDAQChronometer());
214
215 for (JDAQTimeslice::const_iterator super_frame = timeslice.begin(); super_frame != timeslice.end(); ++super_frame) {
216
217 if (moduleRouter.hasModule(super_frame->getModuleID())) {
218
219
220
221 const JModule& module = moduleRouter.getModule(super_frame->getModuleID());
222 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*super_frame, module);
223
224
225
226 buffer.applyHighRateVeto(parameters.highRateVeto_Hz);
227
228
229
230 timesliceL0.push_back(JSuperFrame1D_t(buffer));
231
232
233
234 if (parameters.triggerNB.enabled) {
235
236 JSuperFrame2D_t::iterator __end = partition(buffer.begin(), buffer.end(), parameters.triggerNB.pmts);
237
238 if (buffer.begin() != __end) {
239
240 timesliceNB.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
241 super_frame->getModuleIdentifier(),
243
244
245 JSuperFrame1D_t zbuf;
246
247 buildL1(buffer.begin(), __end, back_inserter(zbuf));
248
249 buildNB(buffer.begin(), __end, zbuf, back_inserter(*timesliceNB.rbegin()));
250 }
251 }
252
253
254
255 timesliceL1.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
256 super_frame->getModuleIdentifier(),
258
259 buildL1(*timesliceL0.rbegin(), back_inserter(*timesliceL1.rbegin()));
260
261
262
263 timesliceL2.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
264 super_frame->getModuleIdentifier(),
266
267 buildL2(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceL2.rbegin()));
268
269
270 {
271 JTimeslice_t::value_type tv(super_frame->getDAQChronometer(),
272 super_frame->getModuleIdentifier(),
274
275 buildSN(buffer, *timesliceL1.rbegin(), back_inserter(tv));
276
277 if (!tv.empty()) {
278 timesliceSN.push_back(tv);
279 }
280 }
281 }
282 }
283
284
285
286
287 if (parameters.triggerNB.enabled) {
288
290
291 for (JTriggerInput::const_iterator hit = trigger_input.begin(); hit != trigger_input.end(); ++hit) {
292
293 if (parameters.triggerNB.write()) {
294
296 getTriggerMask(triggerNB.getTriggerBit()),
297 *hit,
298 timesliceRouter,
299 moduleRouter,
300 parameters.TMaxLocal_ns,
301 parameters.triggerNB.DMax_m,
302 getTimeRange(parameters.triggerNB));
303
305 }
306 }
307 }
308
311
312 trigger3DMuon (trigger_input, back_inserter(trigger_output));
313 trigger3DShower(trigger_input, back_inserter(trigger_output));
314 triggerMXShower(trigger_input, timesliceL0, back_inserter(trigger_output));
315
317
318 DEBUG(
"Number of triggers: " << trigger_output.size() << endl);
319
320 for (JTriggerOutput::const_iterator event = trigger_output.begin(); event != trigger_output.end(); ++event) {
321
323 timesliceRouter,
324 moduleRouter,
325 parameters.TMaxLocal_ns,
326 getTimeRange(parameters));
327
329
331 }
332 }
334
336
338
340
342}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void merge(const JMatch_t &match)
Merge events.
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
const JPosition3D & getPosition() const
Get position.
Auxiliary class for selection of data type.
Utility class to parse command line options.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
Template definition for direct access of elements in ROOT TChain.
1-dimensional frame with time calibrated data from one optical module.
2-dimensional frame with time calibrated data from one optical module.
Auxiliary class to build KM3NETDAQ::JDAQEvent for a triggered event.
int getFrameIndex() const
Get frame index.
JTriggerCounter_t getCounter() const
Get trigger counter.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::set< JROOTClassSelector > getROOTClassSelection(const bool option=false)
Get ROOT class selection.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
void setDAQLongprint(const bool option)
Set DAQ print option.
double getRTS()
Get TDC dynamic range.
static const int HIGH_RATE_VETO_DISABLE
Enable (disable) use of high-rate veto test if this status bit is 0 (1);.
Match of two events considering overlap in time and position.
Transmission with position.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for ROOT class selection.
void remove()
Remove data type.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...