Jpp
JTimesliceL1.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JTIMESLICEL1__
2 #define __JTRIGGER__JTIMESLICEL1__
3 
4 #include <vector>
5 #include <algorithm>
6 
8 #include "JTrigger/JTimeslice.hh"
11 #include "JDetector/JTimeRange.hh"
13 #include "JTrigger/JHitToolkit.hh"
14 
15 
16 /**
17  * \author mdejong
18  */
19 
20 namespace JTRIGGER {}
21 namespace JPP { using namespace JTRIGGER; }
22 
23 namespace JTRIGGER {
24 
26  using JDETECTOR::JModule;
30 
31 
32  /**
33  * Auxiliary class to build JDAQTimeslice for L1 timeslice.
34  */
35  template<class JDAQTimeslice_t>
36  class JTimesliceL1 :
37  public JDAQTimeslice_t
38  {
39  public:
40 
41 
42  /**
43  * Default constructor.
44  */
46  JDAQTimeslice_t()
47  {}
48 
49 
50  /**
51  * Constructor.
52  *
53  * The raw data referenced in the time slice router are sampled according
54  * the triggered time slice data and the given time window.\n
55  * The status of each frame is taken from the raw data.
56  *
57  * \param timeslice triggered timeslice (e.g. L1)
58  * \param timesliceRouter timeslice router
59  * \param moduleRouter module router
60  * \param TMaxLocal_ns time window [ns]
61  */
62  template<class JHit_t>
63  JTimesliceL1(const JTimeslice<JHit_t>& timeslice,
64  const JTimesliceRouter& timesliceRouter,
65  const JModuleRouter& moduleRouter,
66  const double TMaxLocal_ns) :
67  JDAQTimeslice_t()
68  {
69  using namespace std;
70 
71  this->setDAQChronometer(timeslice.getDAQChronometer());
72 
73  vector<JDAQHit> buffer;
74 
75  for (typename JTimeslice<JHit_t>::const_iterator frame = timeslice.begin(); frame != timeslice.end(); ++frame) {
76 
77  const JModule& module = moduleRouter.getModule(frame->getModuleID());
78  const JTimeRange timeOffset = getTimeRange(JTimeRange(0,0), module);
79 
80  buffer.clear();
81 
82  for (typename JFrame<JHit_t>::const_iterator p = frame->begin(); p != frame->end(); ) {
83 
84  double Tmin = frame->getT(*p);
85  double Tmax = Tmin + TMaxLocal_ns;
86 
87  while (++p != frame->end() && frame->getT(*p) <= Tmax) {
88  Tmax = frame->getT(*p) + TMaxLocal_ns;
89  }
90 
91  const JDAQFrameSubset& subset = timesliceRouter.getFrameSubset(frame->getModuleID(), JTimeRange(Tmin, Tmax).add(timeOffset));
92 
93  for (JDAQFrameSubset::const_iterator i = subset.begin(); i != subset.end(); ++i) {
94 
95  const JCalibration& calibration = module.getPMT(i->getPMT()).getCalibration();
96  const double t1 = getTime(*i, calibration);
97 
98  if (t1 >= Tmin && t1 <= Tmax) {
99  buffer.push_back(*i);
100  }
101  }
102  }
103 
104  this->push_back(JDAQSuperFrame(timesliceRouter.getSuperFrame(frame->getModuleID()).getDAQSuperFrameHeader()));
105 
106  this->rbegin()->add(buffer.size(), buffer.data());
107  }
108  }
109  };
110 }
111 
112 #endif
JDETECTOR::getCalibration
JCalibration getCalibration(const JCalibration &first, const JCalibration &second)
Get calibration to go from first to second calibration.
Definition: JDetectorToolkit.hh:866
JTRIGGER::JTimesliceRouter::getFrameSubset
JDAQFrameSubset getFrameSubset(const JDAQModuleIdentifier &module, const JTimeRange &timeRange) const
Get subset of frame given module identifier and range of hit times.
Definition: JTimesliceRouter.hh:270
JAANET::getTimeRange
JTimeRange getTimeRange(const Evt &event)
Get time range (i.e.
Definition: JAAnetToolkit.hh:134
JTRIGGER::JTimesliceL1::JTimesliceL1
JTimesliceL1()
Default constructor.
Definition: JTimesliceL1.hh:45
JDETECTOR::JModuleRouter::getModule
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Definition: JModuleRouter.hh:89
JTimeslice.hh
KM3NETDAQ::JDAQFrameSubset::const_iterator
const typedef JDAQHit * const_iterator
Definition: JDAQFrame.hh:26
JDETECTOR::JCalibration
Data structure for PMT calibration.
Definition: JDetector/JCalibration.hh:35
JTOOLS::JRange::add
range_type & add(argument_type x)
Add offset.
Definition: JRange.hh:437
std::vector
Definition: JSTDTypes.hh:12
JTRIGGER::JFrame::const_iterator
container_type::const_iterator const_iterator
Definition: JFrame.hh:45
KM3NETDAQ::JDAQTimeslice
Data time slice.
Definition: JDAQTimeslice.hh:30
JDAQTimeslice.hh
JTimeRange.hh
JTOOLS::JTimeRange
JRange< double > JTimeRange
Type definition for time range.
Definition: JTools/JTimeRange.hh:19
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
KM3NETDAQ::JDAQFrameSubset::end
const_iterator end() const
Definition: JDAQFrame.hh:43
JDETECTOR::JModule::getPMT
const JPMT & getPMT(const int index) const
Get PMT.
Definition: JModule.hh:173
JTRIGGER::JTimesliceL1
Auxiliary class to build JDAQTimeslice for L1 timeslice.
Definition: JTimesliceL1.hh:36
JHitToolkit.hh
JTRIGGER::JTimesliceRouter::getSuperFrame
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
Definition: JTimesliceRouter.hh:254
JAANET::getTime
double getTime(const Hit &hit)
Get true time of hit.
Definition: JAAnetToolkit.hh:87
JTRIGGER::JTimeslice
Time slice with calibrated data.
Definition: JTimeslice.hh:26
JModuleRouter.hh
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
JDetectorToolkit.hh
JDETECTOR::JModuleRouter
Router for direct addressing of module data in detector data structure.
Definition: JModuleRouter.hh:34
KM3NETDAQ::JDAQFrameSubset
Subset of data frame.
Definition: JDAQFrame.hh:22
JTimesliceRouter.hh
JTRIGGER::JTimeslice::const_iterator
std::vector< value_type >::const_iterator const_iterator
Definition: JTimeslice.hh:34
KM3NETDAQ::JDAQChronometer::getDAQChronometer
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
Definition: JDAQChronometer.hh:88
std
Definition: jaanetDictionary.h:36
KM3NETDAQ::JDAQSuperFrame
Data frame of one optical module.
Definition: JDAQSuperFrame.hh:22
JTRIGGER::JTimesliceL1::JTimesliceL1
JTimesliceL1(const JTimeslice< JHit_t > &timeslice, const JTimesliceRouter &timesliceRouter, const JModuleRouter &moduleRouter, const double TMaxLocal_ns)
Constructor.
Definition: JTimesliceL1.hh:63
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JDETECTOR::getTimeRange
JTimeRange getTimeRange(const JTimeRange &timeRange, const JModule &module)
Get de-calibrated time range.
Definition: JDetectorToolkit.hh:339
JTRIGGER::JTimesliceRouter
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
Definition: JTimesliceRouter.hh:62
KM3NETDAQ::JDAQFrameSubset::begin
const_iterator begin() const
Definition: JDAQFrame.hh:42