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 
25 namespace HcalSpecialTimes {
26  // Special value for the rise time used in case the QIE10/11 pulse
27  // is always below the discriminator
29 
30  // "Invalid Code" TDC value
32 
33  // Special value for the rise time used in case the QIE10/11 pulse
34  // is always above the discriminator
36 
37  // Any of the codes indicating DLL failures
39 
40  // Special value for the time to use in case the TDC info is
41  // not available or not meaningful (e.g., for QIE8)
42  constexpr float UNKNOWN_T_NOTDC = -120.f;
43 
44  // Special value which indicates a possible bug in the dataframe
46 
47  // Special value for invalid codes 50-57. I don't know the
48  // exact explanation why they occur, but they do. Their origin
49  // is likely to be just a bit-flip.
50  constexpr float UNKNOWN_T_50TO57 = -130.f;
51 
52  // Check if the given time represents one of the special values
53  constexpr inline bool isSpecial(const float t) { return t <= UNKNOWN_T_UNDERSHOOT; }
54 
55  constexpr float DEFAULT_ccTIME = -999.f;
56 
57  constexpr inline float getTDCTime(const int tdc) {
58  constexpr float tdc_to_ns = 0.5f;
59 
60  constexpr int six_bits_mask = 0x3f;
61  constexpr int tdc_code_largestnormal = 49;
62  constexpr int tdc_code_invalid = 58;
63  constexpr int tdc_code_overshoot = 62;
64  constexpr int tdc_code_undershoot = 63;
65 
66  float t = tdc_to_ns * tdc;
67  if (tdc > six_bits_mask || tdc < 0)
69  else if (tdc > tdc_code_largestnormal) {
70  // The undershoot code happens by far more often
71  // than any other special code. So check for it first.
72  if (tdc == tdc_code_undershoot)
74  else if (tdc == tdc_code_overshoot)
76  else if (tdc == tdc_code_invalid)
78  else if (tdc < tdc_code_invalid)
80  else
82  }
83 
84  return t;
85  }
86 } // namespace HcalSpecialTimes
87 
88 #endif // DataFormats_HcalRecHit_HcalSpecialTimes_h_
constexpr float UNKNOWN_T_DLL_FAILURE
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
constexpr float DEFAULT_ccTIME