101   using namespace KM3NETDAQ;
 
  108   string                 detectorFileA;
 
  109   string                 detectorFileB;
 
  112   bool                   triggeredEventsOnly;
 
  122     JParser<> zap(
"Auxiliary program to trigger Monte Carlo events.");
 
  124     zap[
'f'] = 
make_field(inputFile,           
"input file (output of detector simulation)");
 
  126     zap[
'n'] = 
make_field(numberOfEvents)                     = JLimit::max();
 
  127     zap[
'a'] = 
make_field(detectorFileA,       
"detector used for conversion from Monte Carlo truth to raw data.");
 
  128     zap[
'b'] = 
make_field(detectorFileB,       
"detector used for conversion of raw data to calibrated data.")     = 
"";
 
  129     zap[
'R'] = 
make_field(run,                 
"run number")  = -1;
 
  132     zap[
'O'] = 
make_field(triggeredEventsOnly, 
"optionally write only triggered events.");
 
  141   catch(
const exception &error) {
 
  142     FATAL(error.what() << endl);
 
  145   gRandom->SetSeed(seed);
 
  147   JK40DefaultSimulatorInterface::setSigma(sigma_ns);
 
  153   if (detectorFileB == 
"") {
 
  154     detectorFileB = detectorFileA;
 
  162     load(detectorFileA, detectorA);
 
  163     load(detectorFileB, detectorB);
 
  169   JPMTParametersMap::Throw(
true);
 
  171   if (!pmtParameters.is_valid()) {
 
  172     FATAL(
"Invalid PMT parameters " << pmtParameters << endl);
 
  175   if (pmtParameters.getQE() != 1.0) {
 
  177     WARNING(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
 
  179     rates_Hz.correct(pmtParameters.getQE());
 
  186   if (runbyrun.is_valid()) {
 
  188     NOTICE(
"Using run-by-run:" << endl << runbyrun << endl);
 
  190     if (!runbyrun.hasNext()) {
 
  191       FATAL(
"Run-by-run simulation yields no input." << endl);
 
  194     if (rates_Hz.getSinglesRate() != 0.0) {
 
  195       WARNING(
"Run-by-run simulation discards singles rate [Hz] " << rates_Hz.getSinglesRate() << endl);
 
  211       NOTICE(
"Set trigger parameters from run-by-run input." << endl);
 
  214       WARNING(
"No trigger parameters from run-by-run input;\nrun with default/user input." << endl);
 
  219     NOTICE(
"Using fixed rates [Hz]: " << rates_Hz << endl);
 
  234   DEBUG(
"PMT parameters:" << endl << pmtParameters << endl); 
 
  270   const JPosition3D center = get<JPosition3D>(header);
 
  272   NOTICE(
"Apply detector offset from Monte Carlo run header (" << center << 
")" << endl);
 
  293   int          trigger_counter  = 0;
 
  303       mc_run_id = head.start_run.run_id;
 
  311     limit.setLowerLimit(limit.getLowerLimit() - 
in.skip(limit.getLowerLimit()));
 
  313     for ( ; 
in.hasNext() && number_of_events != limit; ++number_of_events) {
 
  315       STATUS(
"event: " << setw(10) << number_of_events << 
'\r'); 
DEBUG(endl);
 
  317       Evt* 
event = 
in.next();
 
  319       event->mc_run_id = mc_run_id;
 
  321       DEBUG(*event << endl);
 
  323       bool trigger = 
false;
 
  325       if (!event->mc_hits.empty()) {
 
  327         int frame_index = (int) 
in.getCounter() + 1;                        
 
  329         if (runbyrun.is_valid() && runbyrun.hasNext()) {
 
  331           summaryRouter.update(runbyrun.next());
 
  333           summaryRouter.correct(dynamic_cast<const JPMTDefaultSimulatorInterface&>(simbad.getPMTSimulator()));
 
  335           frame_index = summaryRouter.getFrameIndex();
 
  336           run         = summaryRouter.getRunNumber();
 
  352         timeRange.
add(event->mc_t);
 
  353         timeRange.
add(period);
 
  357         if (event->mc_event_time != TTimeStamp(0)) {
 
  361         const JDAQChronometer chronometer(detectorB.getID(), (run != -1 ? run : mc_run_id), frame_index, utc);
 
  365         DEBUG(timeslice << endl);
 
  368         timesliceRouter.configure(timeslice);
 
  370         JTimeslice_t    timesliceL0(timeslice.getDAQChronometer());
 
  371         JTimeslice_t    timesliceL1(timeslice.getDAQChronometer());
 
  372         JTimeslice_t    timesliceL2(timeslice.getDAQChronometer());
 
  373         JTimeslice_t    timesliceSN(timeslice.getDAQChronometer());
 
  375         for (JDAQTimeslice::const_iterator super_frame = timeslice.begin(); super_frame != timeslice.end(); ++super_frame) {
 
  377           if (moduleRouter.hasModule(super_frame->getModuleID())) {
 
  381             const JModule&         module = moduleRouter.getModule(super_frame->getModuleID()); 
 
  382             const JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*super_frame, module);
 
  386             timesliceL0.push_back(JSuperFrame1D_t(buffer));
 
  390             timesliceL1.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
 
  391                                                   super_frame->getModuleIdentifier(),
 
  394             buildL1(*timesliceL0.rbegin(), back_inserter(*timesliceL1.rbegin()));
 
  398             timesliceL2.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
 
  399                                                   super_frame->getModuleIdentifier(),
 
  402             buildL2(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceL2.rbegin()));
 
  406             timesliceSN.push_back(JSuperFrame1D_t(super_frame->getDAQChronometer(),
 
  407                                                   super_frame->getModuleIdentifier(),
 
  410             buildSN(buffer, *timesliceL1.rbegin(), back_inserter(*timesliceSN.rbegin()));
 
  412             DEBUG(
"L0 " << setw(8) << timesliceL0.rbegin()->getModuleID() << 
' ' << setw(8) << timesliceL0.rbegin()->size() << endl);
 
  413             DEBUG(
"L1 " << setw(8) << timesliceL1.rbegin()->getModuleID() << 
' ' << setw(8) << timesliceL1.rbegin()->size() << endl);
 
  414             DEBUG(
"L2 " << setw(8) << timesliceL2.rbegin()->getModuleID() << 
' ' << setw(8) << timesliceL2.rbegin()->size() << endl);
 
  415             DEBUG(
"SN " << setw(8) << timesliceSN.rbegin()->getModuleID() << 
' ' << setw(8) << timesliceSN.rbegin()->size() << endl);
 
  425         trigger3DMuon  (trigger_input, back_inserter(trigger_output));
 
  426         trigger3DShower(trigger_input, back_inserter(trigger_output));
 
  427         triggerMXShower(trigger_input, timesliceL0, back_inserter(trigger_output));
 
  431         for (JTriggerOutput::const_iterator to = trigger_output.begin(); to != trigger_output.end(); ++to) {
 
  433           for (
int i = 0; i != 
h1.GetNbinsX(); ++i) {
 
  434             if (to->hasTriggerBit(i)) {
 
  442                 << to->getFrameIndex() << 
' '  
  444                 << timeRange           << endl);
 
  446           if (timeRange.
overlap(eventTime)) {
 
  456             tev.setCounter(trigger_counter);
 
  465         if (!triggeredEventsOnly || trigger) {
 
  489       if (!triggeredEventsOnly || trigger) {
 
Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file...
 
Utility class to parse command line options. 
 
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits. 
 
Default implementation of the simulation of K40 background. 
 
Data structure for a composite optical module. 
 
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi set_variable RUNBYRUN file
 
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
 
double getSigma(vector< double > &v)
get standard deviation of vector content 
 
Router for direct addressing of module data in detector data structure. 
 
*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
 
then for HISTOGRAM in h0 h1
 
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 getTimeOfRTS(const JDAQChronometer &chronometer)
Get time of last RTS in ns since start of run for a given chronometer. 
 
Data structure for UTC time. 
 
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index. 
 
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. 
 
K40 simulation based on run-by-run information. 
 
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header. 
 
void setDAQLongprint(const bool option)
Set DAQ print option. 
 
Auxiliary class for defining the range of iterations of objects. 
 
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector. 
 
void merge(const JMatch_t &match)
Merge events. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
CLB simulation based on run-by-run information. 
 
double getFrameTime()
Get frame time duration. 
 
Auxiliary class to create summary data. 
 
Auxiliary class to build JDAQEvent for a triggered event. 
 
Auxiliary class for map of PMT parameters. 
 
const JPosition3D & getPosition() const 
Get position. 
 
double getMaximalTime(const double R_Hz)
Get maximal time for given rate. 
 
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
 
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
 
PMT simulation based on run-by-run information. 
 
virtual const char * what() const override
Get error message. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Auxiliary class to build JDAQTimeslice for L1 timeslice. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
2-dimensional frame with time calibrated data from one optical module. 
 
Data structure for position in three dimensions. 
 
const JLimit & getLimit() const 
Get limit. 
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
JDAQUTCExtended getDAQUTCExtended(const TTimeStamp &t0, const double t1=0.0)
Get DAQ UTC time. 
 
Match of two events considering overlap in time. 
 
Timeslice with Monte Carlo event. 
 
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters. 
 
Auxiliary class for K40 rates. 
 
The Evt class respresent a Monte Carlo (MC) event as well as an offline event. 
 
Time slice with calibrated data.