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 //
19 // (end of Zimmerman's special code explanation).
20 //
21 // In addition, during normal operation, codes above 49 are not supposed
22 // to happen. If, due to jitter or something, the upcrossing would happen
23 // at TDC=50, it would be reported as TDC=0 in the next BX.
24 
26 {
27  // Special value for the rise time used in case the QIE10/11 pulse
28  // is always below the discriminator
30 
31  // "Invalid Code" TDC value
33 
34  // Special value for the rise time used in case the QIE10/11 pulse
35  // is always above the discriminator
37 
38  // Any of the codes indicating DLL failures
40 
41  // Special value for the time to use in case the TDC info is
42  // not available or not meaningful (e.g., for QIE8)
43  constexpr float UNKNOWN_T_NOTDC = -120.f;
44 
45  // Special value which indicates a possible bug in the dataframe
47 
48  // Special value for invalid codes 50-57. I don't know the
49  // exact explanation why they occur, but they do. Their origin
50  // is likely to be just a bit-flip.
51  constexpr float UNKNOWN_T_50TO57 = -130.f;
52 
53  // Check if the given time represents one of the special values
54  constexpr inline bool isSpecial(const float t)
55  {
56  return t <= UNKNOWN_T_UNDERSHOOT;
57  }
58 
59  constexpr inline float getTDCTime(const int tdc)
60  {
61  constexpr float tdc_to_ns = 0.5f;
62 
63  constexpr int six_bits_mask = 0x3f;
64  constexpr int tdc_code_largestnormal = 49;
65  constexpr int tdc_code_invalid = 58;
66  constexpr int tdc_code_overshoot = 62;
67  constexpr int tdc_code_undershoot = 63;
68 
69  float t = tdc_to_ns*tdc;
70  if (tdc > six_bits_mask || tdc < 0)
72  else if (tdc > tdc_code_largestnormal)
73  {
74  // The undershoot code happens by far more often
75  // than any other special code. So check for it first.
76  if (tdc == tdc_code_undershoot)
78  else if (tdc == tdc_code_overshoot)
80  else if (tdc == tdc_code_invalid)
82  else if (tdc < tdc_code_invalid)
83  t = UNKNOWN_T_50TO57;
84  else
86  }
87 
88  return t;
89  }
90 }
91 
92 #endif // DataFormats_HcalRecHit_HcalSpecialTimes_h_
constexpr float UNKNOWN_T_DLL_FAILURE
#define constexpr
constexpr float UNKNOWN_T_UNDERSHOOT
constexpr float getTDCTime(const int tdc)
constexpr float UNKNOWN_T_INVALID_RANGE
constexpr float UNKNOWN_T_OVERSHOOT
constexpr float UNKNOWN_T_INVALID_CODE
constexpr float UNKNOWN_T_50TO57
constexpr bool isSpecial(const float t)
constexpr float UNKNOWN_T_NOTDC