64 int main(
int argc,
char **argv)
67 using namespace KM3NETDAQ;
83 JParser<> zap(
"Auxiliary program to trigger time slice data.");
85 zap[
'f'] =
make_field(inputFile,
"input file.");
87 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
88 zap[
'a'] =
make_field(detectorFile,
"detector file.");
91 zap[
'C'] =
make_field(selector,
"timeslice selector, e.g. JDAQTimesliceL1.") = getROOTClassSelection<JDAQTimesliceTypes_t>();
96 catch(
const exception &error) {
97 FATAL(error.what() << endl);
106 DEBUG(
"Reset time [ms] " <<
getRTS() * 1e-6 << endl);
122 NOTICE(
"Disabling high-rate veto of all PMTs." << endl);
146 JTimer timerCC(
"Calibration");
151 JTimer timerRX(
"Timeslice router");
152 JTimer timerTR(
"Trigger");
153 JTimer timerTX(
"Trigger router");
154 JTimer timerTW(
"Timeslice writer");
155 JTimer timerSW(
"Summary writer");
178 DEBUG(
"Input file has no Monte Carlo header.");
181 unsigned int numberOfTriggers = 0;
187 for ( ; in.
hasNext() && counter != inputFile.getLimit(); ++counter) {
189 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
193 DEBUG(*timeslice << endl);
208 for (JDAQTimeslice::const_iterator super_frame = timeslice->begin(); super_frame != timeslice->end(); ++super_frame) {
210 if (moduleRouter.
hasModule(super_frame->getModuleID())) {
217 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*super_frame, module);
223 buffer.applyHighRateVeto(
parameters.highRateVeto_Hz);
229 timesliceL0.push_back(JSuperFrame1D_t(buffer));
237 JSuperFrame2D_t::iterator __end = partition(buffer.begin(), buffer.end(),
parameters.triggerNB.pmts);
239 if (buffer.begin() != __end) {
241 timesliceNB.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
242 super_frame->getModuleIdentifier(),
245 JSuperFrame1D_t zbuf;
247 buildL1(buffer.begin(), __end , back_inserter(zbuf));
249 buildNB(buffer.begin() , __end, zbuf, back_inserter(*timesliceNB.rbegin()));
257 timesliceL1.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
258 super_frame->getModuleIdentifier(),
261 buildL1(*timesliceL0.rbegin(), back_inserter(*timesliceL1.rbegin()));
269 timesliceL2.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
270 super_frame->getModuleIdentifier(),
273 buildL2(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceL2.rbegin()));
281 timesliceSN.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
282 super_frame->getModuleIdentifier(),
285 buildSN(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceSN.rbegin()));
299 for (JTriggerInput::const_iterator hit = trigger_input.begin(); hit != trigger_input.end(); ++hit) {
324 trigger3DMuon (trigger_input, back_inserter(trigger_output));
325 trigger3DShower(trigger_input, back_inserter(trigger_output));
326 triggerMXShower(trigger_input, timesliceL0, back_inserter(trigger_output));
330 numberOfTriggers += trigger_output.size();
334 DEBUG(
"Number of triggers: " << trigger_output.size() << endl);
336 for (JTriggerOutput::const_iterator event = trigger_output.begin();
event != trigger_output.end(); ++event) {
400 const double factor = 1.0 / (double) counter;
402 for (
const JTimer* p : { &timerCC, &timerL0, &timerL1, &timerL2, &timerSN, &timerRX, &timerTR, &timerTX, &timerTW, &timerSW }) {
403 p->print(cout, factor);
406 NOTICE(
"Number of trigger/slices " << numberOfTriggers <<
"/" << counter << endl);
407 NOTICE(
"Trigger rate [Hz] " << numberOfTriggers * 1.0e9 * factor /
getFrameTime() << endl);
Utility class to parse command line options.
JTriggerMask_t getTriggerMask(const unsigned int bit)
Convert trigger bit to trigger mask.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
void configure(const JDAQTimeslice ×lice)
Configure.
Auxiliary class to select ROOT class based on class name.
Recording of objects on file according a format that follows from the file name extension.
Router for direct addressing of module data in detector data structure.
static const int HIGH_RATE_VETO_DISABLE
Enable (disable) use of high-rate veto test if this status bit is 0 (1);.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Long64_t counter_type
Type definition for counter.
Auxiliary class for multiplexing object iterators.
Basic data structure for time and time over threshold information of hit.
Data structure for detector geometry and calibration.
1-dimensional frame with time calibrated data from one optical module.
JTimeRange getTimeRange(const Evt &event)
Get time range (i.e. time between earliest and latest hit) of Monte Carlo event.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Basic data structure for L0 hit.
void setDAQLongprint(const bool option)
Set DAQ print option.
Auxiliary class for defining the range of iterations of objects.
void merge(const JMatch_t &match)
Merge events.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getFrameTime()
Get frame time duration.
Auxiliary class for CPU timing and usage.
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
Auxiliary class to build JDAQEvent for a triggered event.
virtual const pointer_type & next() override
Get next element.
Auxiliary class to set DAQ system clock parameters.
virtual bool hasNext() override
Check availability of next element.
const JPosition3D & getPosition() const
Get position.
General purpose messaging.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to build JDAQTimeslice for L1 timeslice.
double getRTS()
Get TDC dynamic range.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
JTriggerbit_t getTriggerBit() const
Get the trigger bit.
bool hasModule(const JObjectID &id) const
Has module.
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
2-dimensional frame with time calibrated data from one optical module.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Match of two events considering overlap in time.
Basic data structure for L1 hit.
Time slice with calibrated data.
#define DEBUG(A)
Message macros.