46 int main(
int argc, 
char **argv)
 
   50   using namespace KM3NETDAQ;
 
   66     JParser<> zap(
"Auxiliary program to convert multiple Monte Carlo events to time slices.");
 
   70     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
   81   catch(
const exception &error) {
 
   82     FATAL(error.what() << endl);
 
   85   gRandom->SetSeed(seed);
 
   90   if (pmtParameters.getQE() != 1.0) {
 
   92     WARNING(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
 
   94     rates_Hz.correct(pmtParameters.getQE());
 
   99   DEBUG(
"PMT paramaters: " << endl << pmtParameters << endl);
 
  100   DEBUG(
"K40 rates:      " << endl << rates_Hz      << endl);
 
  102   if (eventRate_Hz < 0.0) {
 
  103     FATAL(
"Invalid event rate " << eventRate_Hz << 
"; consider using JRandomTimesliceWriter." << endl);
 
  124   catch (
const exception& error) {
 
  125     FATAL(
"Monte Carlo header is invalid");
 
  130   if (liveTimeMC < 0) {
 
  131     FATAL(
"Monte Carlo live time is negative; input file may be corrupted.");
 
  136   JPMTParametersMap::Throw(
false);
 
  158   bool absTime = 
false;
 
  162   if (eventRate_Hz == 0.0 && liveTimeMC == 0.0) {
 
  164     NOTICE(
"Event will be timed according to absolute MC time." << endl);
 
  178     if (eventRate_Hz == 0.0 && liveTimeMC > 0.0) {
 
  179       int nEntries = scan->getEntries();
 
  180       eventRate_Hz = nEntries / liveTimeMC;
 
  181       DEBUG(nEntries << 
" events to be written." << endl);
 
  182       NOTICE(
"MC live time is " << liveTimeMC << 
" s" << endl);
 
  183       NOTICE(
"Event rate set to " <<  eventRate_Hz << 
" Hz from MC header." << endl);
 
  190   bool pendingEvt       = 
false;
 
  191   bool pendingTimeslice = 
false;
 
  205   while (pendingEvt || scan->hasNext()) {
 
  207     if (!pendingTimeslice) {
 
  212       DEBUG(
"evt count: " << setw(10) << evtCount << endl); 
 
  213       STATUS(
"frame index: " << setw(10) << frame_index << 
" | evt count: " << setw(10) << evtCount << 
"\r"); 
DEBUG(endl);
 
  214       pendingTimeslice = 
true;
 
  219       event = scan->next();
 
  221       tOff = timeRange.is_valid() ? timeRange.getLowerLimit() : 0;
 
  226         tDAQ += gRandom->Exp(1.0e9 / eventRate_Hz);
 
  228       DEBUG(
"event time [s] " << setprecision(5) << tDAQ * 1.0e-9 << endl);
 
  236       if (timeRange.is_valid()) {
 
  237         DEBUG(*event << endl);
 
  239         event->mc_t = tDAQ - tOff;
 
  248       DEBUG(timeslice << endl);
 
  250       pendingTimeslice = 
false;
 
  255   if (pendingTimeslice) {
 
  256     DEBUG(timeslice << endl);
 
  258     pendingTimeslice = 
false;
 
  266   NOTICE(evtCount << 
" events written over " << frame_index << 
" timeslices. " << endl);
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
ROOT TTree parameter settings of various packages. 
 
Default implementation of the simulation of K40 background. 
 
Recording of objects on file according a format that follows from the file name extension. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Long64_t counter_type
Type definition for counter. 
 
Data structure for UTC time. 
 
Template definition for direct access of elements in ROOT TChain. 
 
Data structure for detector geometry and calibration. 
 
Auxiliary interface for direct access of elements in ROOT TChain. 
 
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index. 
 
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. 
 
void setDAQLongprint(const bool option)
Set DAQ print option. 
 
Auxiliary class for defining the range of iterations of objects. 
 
static const JEvtEvaluator getEvtValue
Function object for evaluation of DAQ objects. 
 
JAANET::livetime livetime
 
int getFrameIndex(const double t_ns)
Get frame index for a given time in ns. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
Auxiliary class for map of PMT parameters. 
 
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...
 
void reset(JK40Simulator *k40Simulator)
Reset K40 simulator. 
 
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. 
 
Utility class to parse command line options. 
 
const JLimit & getLimit() const 
Get limit. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
double numberOfSeconds
Live time [s]. 
 
Timeslice with random data. 
 
Timeslice with Monte Carlo event. 
 
Auxiliary class for K40 rates. 
 
The Evt class respresent a Monte Carlo (MC) event as well as an offline event. 
 
#define DEBUG(A)
Message macros.