CMS 3D CMS Logo

EcalUncalibratedRecHit.cc
Go to the documentation of this file.
3 #include <cmath>
4 
6  : amplitude_(0.), amplitudeError_(0.), pedestal_(0.), jitter_(0.), chi2_(10000.), flags_(0), aux_(0) {
7  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
8  for (unsigned int ibx = 0; ibx < nsample; ++ibx)
9  OOTamplitudes_[ibx] = 0.;
10 }
11 
13  const DetId& id, float ampl, float ped, float jit, float chi2, uint32_t flags, uint32_t aux)
14  : amplitude_(ampl),
15  amplitudeError_(0.),
16  pedestal_(ped),
17  jitter_(jit),
18  chi2_(chi2),
19  flags_(flags),
20  aux_(aux),
21  id_(id) {
22  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
23  for (unsigned int ibx = 0; ibx < nsample; ++ibx)
24  OOTamplitudes_[ibx] = 0.;
25 }
26 
28 
30  // stored in ps, but return BXs to match with jitter units
31  uint32_t jitterErrorBits = 0xFF & aux_;
32  // all bits off --> time reco bailed out (return negative value)
33  if ((0xFF & jitterErrorBits) == 0x00)
34  return -1;
35  // all bits on --> time error over 5 ns (return large value)
36  if ((0xFF & jitterErrorBits) == 0xFF)
37  return 10000;
38 
39  float LSB = 1.26008;
40  uint8_t exponent = jitterErrorBits >> 5;
41  uint8_t significand = jitterErrorBits & ~(0x7 << 5);
42  return (float)(std::pow(2, exponent) * significand * LSB) / (25. * 1000);
43 }
44 
46  // use 8 bits (3 exp, 5 mant) and store in ps
47  // has range of 5 ps - 5000 ps
48  // expect input in BX units
49  // all bits off --> time reco bailed out
50  if (jitterErr <= 0) {
51  aux_ = (~0xFF & aux_);
52  return;
53  }
54  // all bits on --> time error over 5 ns
55  if (25 * jitterErr >= 5) {
56  aux_ = (0xFF | aux_);
57  return;
58  }
59 
60  float LSB = 1.26008;
61  float quantityInLSB = (1000 * 25 * jitterErr) / LSB;
62  int log2OfQuantity = (int)(log2(quantityInLSB));
63  int exponentTmp = log2OfQuantity - 4;
64  uint8_t exponent = 0;
65  if (exponentTmp > 0)
66  exponent = exponentTmp;
67  uint8_t significand = (int)(std::lround(quantityInLSB / std::pow(2, exponent)));
68  uint32_t jitterErrorBits = exponent << 5 | significand;
69 
70  if ((0xFF & jitterErrorBits) == 0xFF)
71  jitterErrorBits = 0xFE;
72  if ((0xFF & jitterErrorBits) == 0x00)
73  jitterErrorBits = 0x01;
74 
75  aux_ = (~0xFF & aux_) | (jitterErrorBits & 0xFF);
76 }
77 
79  if (jitterError() <= 0)
80  return false;
81  else
82  return true;
83 }
84 
86  if (!isJitterValid())
87  return false;
88  if (jitterError() >= 10000)
89  return false;
90 
91  return true;
92 }
93 
95  uint8_t jitterErrorBits = 0xFF & aux_;
96  return jitterErrorBits;
97 }
98 
100  if (flag == kGood) {
101  //then set all bits to zero;
102  flags_ = 0;
103  return;
104  }
105  // else set the flagbit
106  flags_ |= 0x1 << flag;
107 }
108 
110  if (flag == kGood) {
111  if (!flags_)
112  return true;
113  else
114  return false;
115  } // if all flags are unset, then hit is good
116  return flags_ & (0x1 << flag);
117 }
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
MessageLogger.h
EcalUncalibratedRecHit::isJitterErrorValid
bool isJitterErrorValid() const
Definition: EcalUncalibratedRecHit.cc:85
EcalUncalibratedRecHit::jitterError
float jitterError() const
Definition: EcalUncalibratedRecHit.cc:29
EcalUncalibratedRecHit::jitterErrorBits
uint8_t jitterErrorBits() const
Definition: EcalUncalibratedRecHit.cc:94
EcalUncalibratedRecHit::kGood
Definition: EcalUncalibratedRecHit.h:13
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
EcalUncalibratedRecHit::EcalUncalibratedRecHit
EcalUncalibratedRecHit()
Definition: EcalUncalibratedRecHit.cc:5
EcalUncalibratedRecHit::setFlagBit
void setFlagBit(Flags flag)
Definition: EcalUncalibratedRecHit.cc:99
DetId
Definition: DetId.h:17
EcalUncalibratedRecHit::isJitterValid
bool isJitterValid() const
Definition: EcalUncalibratedRecHit.cc:78
HLT_FULL_cff.exponent
exponent
Definition: HLT_FULL_cff.py:52824
EcalUncalibratedRecHit.h
EcalUncalibratedRecHit::aux_
uint32_t aux_
Definition: EcalUncalibratedRecHit.h:68
EcalUncalibratedRecHit::checkFlag
bool checkFlag(Flags flag) const
Definition: EcalUncalibratedRecHit.cc:109
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
createfilelist.int
int
Definition: createfilelist.py:10
EcalUncalibratedRecHit::flags_
uint32_t flags_
Definition: EcalUncalibratedRecHit.h:67
EcalUncalibratedRecHit::Flags
Flags
Definition: EcalUncalibratedRecHit.h:12
EcalUncalibratedRecHit::setJitterError
void setJitterError(float jitterErr)
Definition: EcalUncalibratedRecHit.cc:45
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EcalUncalibratedRecHit::isSaturated
bool isSaturated() const
Definition: EcalUncalibratedRecHit.cc:27
EcalUncalibratedRecHit::kSaturated
Definition: EcalUncalibratedRecHit.h:15
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13168
EcalUncalibratedRecHit::OOTamplitudes_
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
Definition: EcalUncalibratedRecHit.h:65
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117