CMS 3D CMS Logo

HcalSpecialTimes.h
Go to the documentation of this file.
1 #ifndef DataFormats_HcalRecHit_HcalSpecialTimes_h_
2 #define DataFormats_HcalRecHit_HcalSpecialTimes_h_
3 
4 // This is an excerpt from QIE10/QIE11 TDC specifications (by T. Zimmerman):
5 //
6 // Special codes: Special code 62 is generated when the discriminator
7 // starts high. Special code 63 is generated when the TDC discriminator
8 // starts low and remains low (nothing happened). Special code 58 indicates
9 // "Invalid Code". This can be caused by an SEU in the TDC encoder logic.
10 // It can also happen in certain situations when the TDC is operated in
11 // "Last Mode", as discussed above. Code 59 is generated if the either
12 // of the Delay Locked Loops on the QIE10 (the Phase DLL or the TDC DLL)
13 // are not locked. Code 60 is generated when the Phase DLL is unlocked
14 // (but the TDC DLL is locked), and code 61 for the TDC DLL unlocked
15 // (but the Phase DLL is locked). If either of the DLLs on the chip are
16 // unlocked, this takes precedence over any TDC data that might be present,
17 // and the appropriate DLL no-lock condition is reported.
18 
20 {
21  // Special value for the rise time used in case the QIE10/11 pulse
22  // is always below the discriminator
24 
25  // "Invalid Code" TDC value
27 
28  // Special value for the rise time used in case the QIE10/11 pulse
29  // is always above the discriminator
31 
32  // Any of the codes indicating DLL failures
34 
35  // Special value for the time to use in case the TDC info is
36  // not available or not meaningful (e.g., for QIE8)
37  constexpr float UNKNOWN_T_NOTDC = -120.f;
38 
39  // Special value which indicates a possible bug in the dataframe
41 
42  // Check if the given time represents one of the special values
43  inline bool isSpecial(const float t)
44  {
45  return t <= UNKNOWN_T_UNDERSHOOT;
46  }
47 
48  inline float getTDCTime(const int tdc)
49  {
50  constexpr float tdc_to_ns = 0.5f;
51 
52  constexpr int six_bits_mask = 0x3f;
53  constexpr int tdc_code_overshoot = 62;
54  constexpr int tdc_code_undershoot = 63;
55  constexpr int tdc_code_invalid = 58;
56 
57  float t = tdc_to_ns*tdc;
58  if (tdc > six_bits_mask || tdc < 0)
60  else if (tdc == tdc_code_overshoot)
62  else if (tdc == tdc_code_undershoot)
64  else if (tdc == tdc_code_invalid)
66  else if (tdc > tdc_code_invalid)
68 
69  return t;
70  }
71 }
72 
73 #endif // DataFormats_HcalRecHit_HcalSpecialTimes_h_
float getTDCTime(const int tdc)
constexpr float UNKNOWN_T_DLL_FAILURE
#define constexpr
constexpr float UNKNOWN_T_UNDERSHOOT
constexpr float UNKNOWN_T_INVALID_RANGE
constexpr float UNKNOWN_T_OVERSHOOT
constexpr float UNKNOWN_T_INVALID_CODE
bool isSpecial(const float t)
constexpr float UNKNOWN_T_NOTDC