Jpp
JRandomTimeslice.hh
Go to the documentation of this file.
1 #ifndef __JTIMESLICE__JRANDOMTIMESLICE__
2 #define __JTIMESLICE__JRANDOMTIMESLICE__
3 
4 #include <exception>
5 
6 #include <TRandom3.h>
7 
10 #include "JDetector/JPMTAddress.hh"
11 #include "JDetector/JTimeRange.hh"
12 #include "JDAQ/JDAQ.hh"
13 #include "JDAQ/JDAQClock.hh"
15 
16 
17 /**
18  * \author mdejong
19  */
20 
21 namespace KM3NETDAQ {
22 
24 
25 
26  /**
27  * Timeslice with random data.
28  */
30  public JTimesliceL0
31  {
32  /**
33  * Default constructor.
34  */
36  {}
37 
38 
39  /**
40  * Constructor.
41  *
42  * \param chronometer chronometer
43  * \param simbad detector simulator
44  */
45  JRandomTimeslice(const JDAQChronometer& chronometer,
46  const JDetectorSimulator& simbad)
47  {
48  using namespace JPP;
49 
50  setDAQChronometer(chronometer);
51 
52  if (simbad.hasK40Simulator() &&
53  simbad.hasPMTSimulator() &&
54  simbad.hasCLBSimulator()) {
55 
56  const double Tmin = getTimeSinceRTS(chronometer.getFrameIndex()); // [ns]
57 
58  const JTimeRange period(Tmin, Tmin + getFrameTime()); // [ns]
59 
60  JModuleData buffer;
61 
62  for (JDetector::const_iterator module = simbad->begin(); module != simbad->end(); ++module) {
63 
64  buffer.reset(module->size());
65 
66  simbad.generateHits(*module, period, buffer);
67 
68  this->push_back(JDAQSuperFrame(JDAQSuperFrameHeader(chronometer, module->getID())));
69 
70  simbad(*module, buffer, *(this->rbegin()));
71  }
72  }
73 
74  try {
75  applyHighRateVeto(dynamic_cast<const JPMTDefaultSimulatorInterface&>(simbad.getPMTSimulator()));
76  }
77  catch(const std::exception& error) {};
78  }
79  };
80 }
81 
82 
83 #endif
84 
KM3NETDAQ::JDAQChronometer::setDAQChronometer
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
Definition: JDAQChronometer.hh:99
JDAQ.hh
KM3NETDAQ::JRandomTimeslice::JRandomTimeslice
JRandomTimeslice(const JDAQChronometer &chronometer, const JDetectorSimulator &simbad)
Constructor.
Definition: JRandomTimeslice.hh:45
JDETECTOR::JModuleData
Data structure for PMT data corresponding to a detector module.
Definition: JPMTSimulator.hh:211
KM3NETDAQ::JDAQChronometer::getFrameIndex
int getFrameIndex() const
Get frame index.
Definition: JDAQChronometer.hh:132
JTOOLS::JRange< double >
JDAQClock.hh
JTimeRange.hh
KM3NETDAQ::JTimesliceL0
Auxiliary class for time slice data.
Definition: JTimesliceL0.hh:25
KM3NETDAQ::getFrameTime
double getFrameTime()
Get frame time duration.
Definition: JDAQClock.hh:162
KM3NETDAQ::JRandomTimeslice::JRandomTimeslice
JRandomTimeslice()
Default constructor.
Definition: JRandomTimeslice.hh:35
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDetectorSimulator.hh
JDETECTOR::JDetectorSimulator::hasPMTSimulator
bool hasPMTSimulator() const
Check availability of PMT simulator.
Definition: JDetectorSimulator.hh:80
KM3NETDAQ::JRandomTimeslice
Timeslice with random data.
Definition: JRandomTimeslice.hh:29
KM3NETDAQ::JDAQSuperFrameHeader
DAQ super frame header.
Definition: JDAQSuperFrameHeader.hh:25
KM3NETDAQ::getTimeSinceRTS
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
Definition: JDAQClock.hh:263
JTimesliceL0.hh
JDETECTOR::JDetectorSimulator
Detector simulation.
Definition: JDetectorSimulator.hh:33
JPMTDefaultSimulatorInterface.hh
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
KM3NETDAQ::JTimesliceL0::applyHighRateVeto
void applyHighRateVeto(const JPMTDefaultSimulatorInterface &pmtSimulator)
Apply high-rate veto.
Definition: JTimesliceL0.hh:40
KM3NETDAQ::JDAQSuperFrame
Data frame of one optical module.
Definition: JDAQSuperFrame.hh:27
JDETECTOR::JDetectorSimulator::hasK40Simulator
bool hasK40Simulator() const
Check availability of K40 simulator.
Definition: JDetectorSimulator.hh:68
JDETECTOR::JDetectorSimulator::getPMTSimulator
const JPMTSimulator & getPMTSimulator() const
Get PMT simulator.
Definition: JDetectorSimulator.hh:116
JDETECTOR::JDetectorSimulator::generateHits
virtual void generateHits(const JModule &module, const JTimeRange &period, JModuleData &output) const
Generate hits.
Definition: JDetectorSimulator.hh:180
JDETECTOR::JModuleData::reset
void reset(size_t size)
Reset buffers.
Definition: JPMTSimulator.hh:228
JPMTAddress.hh
JDETECTOR::JDetectorSimulator::hasCLBSimulator
bool hasCLBSimulator() const
Check availability of CLB simulator.
Definition: JDetectorSimulator.hh:91
KM3NETDAQ::JDAQChronometer
DAQ chronometer.
Definition: JDAQChronometer.hh:26