41{
   44 
   47  JLimit_t&      numberOfEvents = inputFile.getLimit();
 
   48  string         detectorFile;
   51  UInt_t         seed;
   53 
   54  try { 
   55 
   56    JParser<> zap(
"Auxiliary program to generate noise in Monte Carlo event.");
 
   57    
   66 
   67    zap(argc, argv);
   68  }
   69  catch(const exception &error) {
   70    FATAL(error.what() << endl);
 
   71  }
   72 
   73 
   74  gRandom->SetSeed(seed);
   75 
   76  const int NPE = 1;
   77 
   78 
   80 
   81  try {
   83  }
   86  }
   87 
   88 
   90 
   92 
   94  }
   95 
   96 
   98 
  100 
  103  }
  104 
  107 
  108  if (!inputFile.empty()) {
  109 
  111 
  113 
  115 
  117 
  119 
  121 
  123 
  125 
  127 
  128          iter_swap(i, --__end);
  129 
  130        } else {
  131 
  132          time_range.include(
getTime(*i));
 
  133        
  134          ++i;
  135        }
  136      }
  137 
  138      event->mc_hits.erase(__end, event->mc_hits.end());
  139    
  140      if (time_range.is_valid())
  141        time_range.add(period);
  142      else
  143        time_range = period;
  144 
  145 
  147 
  148      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  149 
  150        buffer.
reset(module->size());
 
  151      
  152        modk40.generateHits(*module, time_range, buffer);
  153      
  154        for (unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
  155        
  156          const JModuleData::value_type& frame = buffer[pmt];
  157        
  158          for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
  159          
  160            event->mc_hits.push_back(
JHit_t(event->mc_hits.size() + 1,
 
  161                                            module->getPMT(pmt).getID(),
  163                                            0,
  164                                            hit->t_ns,
  165                                            NPE));
  166          }
  167        }
  168      }
  169 
  170 
  172    }
  173  } else {
  174 
  175    for (
counter_type counter = 0; counter != numberOfEvents; ++counter) {
 
  176 
  177      STATUS(
"event: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
  178 
  180 
  182 
  183      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  184 
  185        buffer.
reset(module->size());
 
  186      
  187        modk40.generateHits(*module, period, buffer);
  188      
  189        for (unsigned int pmt = 0; pmt != buffer.size(); ++pmt) {
  190        
  191          const JModuleData::value_type& frame = buffer[pmt];
  192        
  193          for (JModuleData::value_type::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
  194          
  196                                           module->getPMT(pmt).getID(),
  198                                           0,
  199                                           hit->t_ns,
  200                                           NPE));
  201          }
  202        }
  203      }
  204 
  205 
  207    }
  208  }
  210 
  213}
#define DEBUG(A)
Message macros.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Default implementation of the simulation of K40 background.
 
Data structure for PMT data corresponding to a detector module.
 
void reset(size_t size)
Reset buffers.
 
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.
 
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.