Jpp
JTimeConverter.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JTIMECONVERTER__
2 #define __JTRIGGER__JTIMECONVERTER__
3 
4 #include "JTrigger/JHit.hh"
5 #include "JTrigger/JHitL1.hh"
6 
7 #include "evt/Evt.hh"
8 #include "evt/Hit.hh"
10 
12 
13 #include "JDAQ/JDAQClock.hh"
14 #include "JDAQ/JDAQChronometer.hh"
15 #include "JDAQ/JDAQHit.hh"
16 
17 
18 /**
19  * \author mdejong
20  */
21 
22 namespace JTRIGGER {}
23 namespace JPP { using namespace JTRIGGER; }
24 
25 namespace JTRIGGER {
26 
29  using KM3NETDAQ::JDAQHit;
31 
32 
33  /**
34  * Auxiliary class to convert DAQ/trigger hit time to/from Monte Carlo hit time.
35  */
37  {
38  public:
39  /**
40  * Default constructor.
41  */
43  __t0(0.0),
44  __t1(0.0)
45  {}
46 
47 
48  /**
49  * Constructor.
50  *
51  * \param event Monte Carlo event
52  * \param chronometer DAQ chronometer
53  */
54  JTimeConverter(const Evt& event,
55  const JDAQChronometer& chronometer) :
56  __t0(event.mc_t),
57  __t1(getTimeOfRTS(chronometer))
58  {}
59 
60 
61  /**
62  * Get DAQ/trigger minus Monte Carlo hit time.
63  *
64  * \return time difference [ns]
65  */
66  double getTime() const
67  {
68  return __t1 - __t0;
69  }
70 
71 
72  /**
73  * Get Monte Carlo minus DAQ/trigger hit time.
74  *
75  * \return time difference [ns]
76  */
77  double putTime() const
78  {
79  return __t0 - __t1;
80  }
81 
82 
83  /**
84  * Get Monte Carlo hit time.
85  *
86  * \param t0 DAQ/trigger hit time [ns]
87  * \return Monte Carlo hit time [ns]
88  */
89  double getTime(const double t0) const
90  {
91  return t0 + __t1 - __t0;
92  }
93 
94 
95  /**
96  * Get DAQ hit time.
97  *
98  * \param t0 Monte Carlo hit time [ns]
99  * \return DAQ/trigger hit time [ns]
100  */
101  double putTime(const double t0) const
102  {
103  return t0 - __t1 + __t0;
104  }
105 
106 
107  /**
108  * Get Monte Carlo hit time.
109  *
110  * \param hit trigger hit
111  * \return Monte Carlo hit time [ns]
112  */
113  double getTime(const JHit& hit) const
114  {
115  return this->getTime(hit.getT());
116  }
117 
118 
119  /**
120  * Get Monte Carlo hit time.
121  *
122  * \param hit trigger hit
123  * \return Monte Carlo hit time [ns]
124  */
125  double getTime(const JHitL1& hit) const
126  {
127  return this->getTime(hit.getT());
128  }
129 
130 
131  /**
132  * Get Monte Carlo hit time.
133  *
134  * \param hit DAQ hit
135  * \param calibration PMT calibration
136  * \return Monte Carlo hit time [ns]
137  */
138  double getTime(const JDAQHit& hit, const JCalibration& calibration) const
139  {
140  return this->getTime(JDETECTOR::getTime(hit.getT(), calibration));
141  }
142 
143 
144  /**
145  * Get DAQ hit time.
146  *
147  * \param hit Monte Carlo hit time [ns]
148  * \return DAQ hit time [ns]
149  */
150  double putTime(const Hit& hit) const
151  {
152  return this->putTime(JAANET::getTime(hit));
153  }
154 
155 
156  protected:
157  double __t0; // Monte Carlo event time [ns]
158  double __t1; // DAQ RTS [ns]
159  };
160 }
161 
162 #endif
JTRIGGER::JTimeConverter::getTime
double getTime(const JDAQHit &hit, const JCalibration &calibration) const
Get Monte Carlo hit time.
Definition: JTimeConverter.hh:138
JTRIGGER::JTimeConverter::getTime
double getTime(const double t0) const
Get Monte Carlo hit time.
Definition: JTimeConverter.hh:89
JTRIGGER::JTimeConverter::JTimeConverter
JTimeConverter(const Evt &event, const JDAQChronometer &chronometer)
Constructor.
Definition: JTimeConverter.hh:54
JDETECTOR::JCalibration
Data structure for PMT calibration.
Definition: JDetector/JCalibration.hh:35
JTRIGGER::JTimeConverter::getTime
double getTime(const JHitL1 &hit) const
Get Monte Carlo hit time.
Definition: JTimeConverter.hh:125
JTRIGGER::JTimeConverter::__t1
double __t1
Definition: JTimeConverter.hh:158
JTRIGGER::JTimeConverter::putTime
double putTime() const
Get Monte Carlo minus DAQ/trigger hit time.
Definition: JTimeConverter.hh:77
JTRIGGER::JTimeConverter
Auxiliary class to convert DAQ/trigger hit time to/from Monte Carlo hit time.
Definition: JTimeConverter.hh:36
JDAQClock.hh
JTRIGGER::JTimeConverter::putTime
double putTime(const double t0) const
Get DAQ hit time.
Definition: JTimeConverter.hh:101
JDAQChronometer.hh
JTRIGGER::JHitL1::getT
double getT(const unsigned int i) const
Get time of hit i.
Definition: JHitL1.hh:181
JTRIGGER::JHit::getT
double getT() const
Get calibrated time of hit.
Definition: JHit.hh:143
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
KM3NETDAQ::JDAQHit::getT
JTDC_t getT() const
Get time.
Definition: JDAQHit.hh:89
JDETECTOR::getTime
double getTime(const T &t1, const JCalibration &cal)
Get calibrated time.
Definition: JDetector/JCalibration.hh:202
JTRIGGER::JTimeConverter::putTime
double putTime(const Hit &hit) const
Get DAQ hit time.
Definition: JTimeConverter.hh:150
JAAnetToolkit.hh
JHit.hh
JAANET::getTime
double getTime(const Hit &hit)
Get true time of hit.
Definition: JAAnetToolkit.hh:87
JTRIGGER::JTimeConverter::getTime
double getTime(const JHit &hit) const
Get Monte Carlo hit time.
Definition: JTimeConverter.hh:113
JCalibration.hh
JHitL1.hh
KM3NETDAQ::getTimeOfRTS
double getTimeOfRTS(const JDAQChronometer &chronometer)
Get time of last RTS in ns since start of run for a given chronometer.
Definition: JDAQChronometer.hh:273
JTRIGGER::JTimeConverter::getTime
double getTime() const
Get DAQ/trigger minus Monte Carlo hit time.
Definition: JTimeConverter.hh:66
JTRIGGER::JHit
Hit data structure.
Definition: JHit.hh:22
JTRIGGER::JTimeConverter::JTimeConverter
JTimeConverter()
Default constructor.
Definition: JTimeConverter.hh:42
KM3NETDAQ::JDAQHit
Hit data structure.
Definition: JDAQHit.hh:40
JDAQHit.hh
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JTRIGGER::JTimeConverter::__t0
double __t0
Definition: JTimeConverter.hh:157
JTRIGGER::JHitL1
Data structure for L1 hit.
Definition: JHitL1.hh:34
KM3NETDAQ::JDAQChronometer
DAQ chronometer.
Definition: JDAQChronometer.hh:26