CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
EcalUncalibratedRecHit Class Reference

#include <EcalUncalibratedRecHit.h>

Public Types

enum  Flags {
  kGood = -1, kPoorReco, kSaturated, kOutOfTime,
  kLeadingEdgeRecovered, kHasSwitchToGain6, kHasSwitchToGain1
}
 
typedef DetId key_type
 

Public Member Functions

float amplitude () const
 
float amplitudeError () const
 
bool checkFlag (Flags flag) const
 
float chi2 () const
 
 EcalUncalibratedRecHit ()
 
 EcalUncalibratedRecHit (const DetId &id, float ampl, float ped, float jit, float chi2, uint32_t flags=0, uint32_t aux=0)
 
uint32_t flags () const
 
DetId id () const
 
bool isJitterErrorValid () const
 
bool isJitterValid () const
 
bool isSaturated () const
 
float jitter () const
 
float jitterError () const
 
uint8_t jitterErrorBits () const
 
float outOfTimeAmplitude (int bx) const
 
float pedestal () const
 
void setAmplitude (float amplitude)
 
void setAmplitudeError (float amplitudeerror)
 
void setAux (uint32_t aux)
 
void setChi2 (float chi2)
 
void setFlagBit (Flags flag)
 
void setFlags (uint32_t flags)
 
void setId (DetId id)
 
void setJitter (float jitter)
 
void setJitterError (float jitterErr)
 
void setOutOfTimeAmplitude (int bx, float amplitude)
 
void setPedestal (float pedestal)
 

Private Attributes

float amplitude_
 
float amplitudeError_
 
uint32_t aux_
 
float chi2_
 
uint32_t flags_
 
DetId id_
 
float jitter_
 
float OOTamplitudes_ [EcalDataFrame::MAXSAMPLES]
 
float OOTchi2_
 
float pedestal_
 

Detailed Description

Definition at line 8 of file EcalUncalibratedRecHit.h.

Member Typedef Documentation

Definition at line 10 of file EcalUncalibratedRecHit.h.

Member Enumeration Documentation

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 
kLeadingEdgeRecovered 
kHasSwitchToGain6 
kHasSwitchToGain1 

Definition at line 12 of file EcalUncalibratedRecHit.h.

12  {
13  kGood = -1, // channel is good (mutually exclusive with other states) setFlagBit(kGood) reset flags_ to zero
14  kPoorReco, // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.)
15  kSaturated, // saturated channel
16  kOutOfTime, // channel out of time
17  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
18  kHasSwitchToGain6, // at least one data frame is in G6
19  kHasSwitchToGain1 // at least one data frame is in G1
20 
21  };

Constructor & Destructor Documentation

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )

Definition at line 5 of file EcalUncalibratedRecHit.cc.

References EcalDataFrame::MAXSAMPLES, and OOTamplitudes_.

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 }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalUncalibratedRecHit::EcalUncalibratedRecHit ( const DetId id,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)

Definition at line 12 of file EcalUncalibratedRecHit.cc.

References EcalDataFrame::MAXSAMPLES, and OOTamplitudes_.

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 }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

Member Function Documentation

float EcalUncalibratedRecHit::amplitude ( ) const
inline
float EcalUncalibratedRecHit::amplitudeError ( ) const
inline

Definition at line 29 of file EcalUncalibratedRecHit.h.

References amplitudeError_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

bool EcalUncalibratedRecHit::checkFlag ( EcalUncalibratedRecHit::Flags  flag) const

Definition at line 109 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by isSaturated(), EcalRecHitSimpleAlgo::makeRecHit(), and setAux().

109  {
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 }
float EcalUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 32 of file EcalUncalibratedRecHit.h.

References chi2_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit(), and setChi2().

32 { return chi2_; }
uint32_t EcalUncalibratedRecHit::flags ( ) const
inline

Definition at line 35 of file EcalUncalibratedRecHit.h.

References flags_, jitterError(), and jitterErrorBits().

Referenced by EcalRecHitWorkerRecover::run(), and setFlags().

35 { return flags_; }
DetId EcalUncalibratedRecHit::id ( ) const
inline
bool EcalUncalibratedRecHit::isJitterErrorValid ( ) const

Definition at line 85 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

Referenced by setAux().

85  {
86  if (!isJitterValid())
87  return false;
88  if (jitterError() >= 10000)
89  return false;
90 
91  return true;
92 }
bool EcalUncalibratedRecHit::isJitterValid ( ) const

Definition at line 78 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid(), and setAux().

78  {
79  if (jitterError() <= 0)
80  return false;
81  else
82  return true;
83 }
bool EcalUncalibratedRecHit::isSaturated ( ) const
float EcalUncalibratedRecHit::jitter ( ) const
inline
float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 29 of file EcalUncalibratedRecHit.cc.

References aux_, HLT_2018_cff::exponent, jitterErrorBits(), and funct::pow().

Referenced by flags(), isJitterErrorValid(), and isJitterValid().

29  {
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 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
uint8_t EcalUncalibratedRecHit::jitterErrorBits ( ) const

Definition at line 94 of file EcalUncalibratedRecHit.cc.

References aux_.

Referenced by flags(), jitterError(), EcalRecHitSimpleAlgo::makeRecHit(), and setJitterError().

94  {
95  uint8_t jitterErrorBits = 0xFF & aux_;
96  return jitterErrorBits;
97 }
float EcalUncalibratedRecHit::outOfTimeAmplitude ( int  bx) const
inline

Definition at line 33 of file EcalUncalibratedRecHit.h.

References l1GtPatternGenerator_cfi::bx, and OOTamplitudes_.

33 { return OOTamplitudes_[bx]; }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
float EcalUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 30 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

void EcalUncalibratedRecHit::setAmplitude ( float  amplitude)
inline
void EcalUncalibratedRecHit::setAmplitudeError ( float  amplitudeerror)
inline

Definition at line 41 of file EcalUncalibratedRecHit.h.

References amplitudeError_.

Referenced by EcalUncalibRecHitMultiFitAlgo::makeRecHit().

41 { amplitudeError_ = amplitudeerror; }
void EcalUncalibratedRecHit::setAux ( uint32_t  aux)
inline
void EcalUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 44 of file EcalUncalibratedRecHit.h.

References chi2(), and chi2_.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

void EcalUncalibratedRecHit::setFlagBit ( EcalUncalibratedRecHit::Flags  flag)

Definition at line 99 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by EcalUncalibRecHitWorkerWeights::run(), EcalUncalibRecHitWorkerGlobal::run(), and setAux().

99  {
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 }
void EcalUncalibratedRecHit::setFlags ( uint32_t  flags)
inline
void EcalUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 49 of file EcalUncalibratedRecHit.h.

References id(), and id_.

void EcalUncalibratedRecHit::setJitter ( float  jitter)
inline
void EcalUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 45 of file EcalUncalibratedRecHit.cc.

References aux_, HLT_2018_cff::exponent, createfilelist::int, jitterErrorBits(), and funct::pow().

Referenced by EcalUncalibRecHitWorkerRatio::run(), EcalUncalibRecHitWorkerGlobal::run(), and setOutOfTimeAmplitude().

45  {
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 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
void EcalUncalibratedRecHit::setOutOfTimeAmplitude ( int  bx,
float  amplitude 
)
inline
void EcalUncalibratedRecHit::setPedestal ( float  pedestal)
inline

Definition at line 42 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

float EcalUncalibratedRecHit::amplitude_
private

Definition at line 59 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

float EcalUncalibratedRecHit::amplitudeError_
private

Definition at line 60 of file EcalUncalibratedRecHit.h.

Referenced by amplitudeError(), and setAmplitudeError().

uint32_t EcalUncalibratedRecHit::aux_
private

Definition at line 68 of file EcalUncalibratedRecHit.h.

Referenced by jitterError(), jitterErrorBits(), setAux(), and setJitterError().

float EcalUncalibratedRecHit::chi2_
private

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t EcalUncalibratedRecHit::flags_
private

Definition at line 67 of file EcalUncalibratedRecHit.h.

Referenced by checkFlag(), flags(), setFlagBit(), and setFlags().

DetId EcalUncalibratedRecHit::id_
private

Definition at line 69 of file EcalUncalibratedRecHit.h.

Referenced by id(), and setId().

float EcalUncalibratedRecHit::jitter_
private

Definition at line 62 of file EcalUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

float EcalUncalibratedRecHit::OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
private
float EcalUncalibratedRecHit::OOTchi2_
private

Definition at line 66 of file EcalUncalibratedRecHit.h.

float EcalUncalibratedRecHit::pedestal_
private

Definition at line 61 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().