CMS 3D CMS Logo

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

#include <HGCUncalibratedRecHit.h>

Public Types

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

Public Member Functions

float amplitude () const
 
bool checkFlag (Flags flag) const
 
float chi2 () const
 
uint32_t flags () const
 
 HGCUncalibratedRecHit ()
 
 HGCUncalibratedRecHit (const DetId &detId, float ampl, float ped, float jit, float chi2, uint32_t flags=0, uint32_t aux=0)
 
DetId id () const
 
bool isJitterErrorValid () const
 
bool isJitterValid () const
 
bool isSaturated () const
 
float jitter () const
 
float jitterError () const
 
uint8_t jitterErrorBits () const
 
float outOfTimeChi2 () const
 
float outOfTimeEnergy () const
 
float pedestal () const
 
void setAmplitude (float amplitude)
 
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 setOutOfTimeChi2 (float chi2)
 
void setOutOfTimeEnergy (float energy)
 
void setPedestal (float pedestal)
 
virtual ~HGCUncalibratedRecHit ()
 

Private Attributes

float amplitude_
 
uint32_t aux_
 
float chi2_
 
uint32_t flags_
 
DetId id_
 
float jitter_
 
float OOTamplitude_
 
float OOTchi2_
 
float pedestal_
 

Detailed Description

Definition at line 7 of file HGCUncalibratedRecHit.h.

Member Typedef Documentation

◆ key_type

Definition at line 9 of file HGCUncalibratedRecHit.h.

Member Enumeration Documentation

◆ Flags

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 

Definition at line 11 of file HGCUncalibratedRecHit.h.

11  {
12  kGood = -1, // channel is good (mutually exclusive with other states) setFlagBit(kGood) reset flags_ to zero
13  kPoorReco, // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.)
14  kSaturated, // saturated channel
15  kOutOfTime // channel out of time
16  };

Constructor & Destructor Documentation

◆ HGCUncalibratedRecHit() [1/2]

HGCUncalibratedRecHit::HGCUncalibratedRecHit ( )

◆ HGCUncalibratedRecHit() [2/2]

HGCUncalibratedRecHit::HGCUncalibratedRecHit ( const DetId detId,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)

◆ ~HGCUncalibratedRecHit()

HGCUncalibratedRecHit::~HGCUncalibratedRecHit ( )
virtual

Definition at line 26 of file HGCUncalibratedRecHit.cc.

26 {}

Member Function Documentation

◆ amplitude()

float HGCUncalibratedRecHit::amplitude ( ) const
inline

Definition at line 23 of file HGCUncalibratedRecHit.h.

References amplitude_.

Referenced by HGCalRecHitSimpleAlgo::makeRecHit(), and setAmplitude().

23 { return amplitude_; }

◆ checkFlag()

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

Definition at line 110 of file HGCUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by isSaturated().

110  {
111  if (flag == kGood) {
112  if (!flags_)
113  return true;
114  else
115  return false;
116  } // if all flags are unset, then hit is good
117  return flags_ & (0x1 << flag);
118 }

◆ chi2()

float HGCUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 26 of file HGCUncalibratedRecHit.h.

References chi2_.

Referenced by setChi2(), and setOutOfTimeChi2().

26 { return chi2_; }

◆ flags()

uint32_t HGCUncalibratedRecHit::flags ( ) const
inline

Definition at line 30 of file HGCUncalibratedRecHit.h.

References flags_.

Referenced by setFlags().

30 { return flags_; }

◆ id()

DetId HGCUncalibratedRecHit::id ( ) const
inline

Definition at line 33 of file HGCUncalibratedRecHit.h.

References id_.

Referenced by HGCalRecHitSimpleAlgo::makeRecHit(), HGCalRecHitWorkerSimple::run(), and setId().

33 { return id_; }

◆ isJitterErrorValid()

bool HGCUncalibratedRecHit::isJitterErrorValid ( ) const

Definition at line 86 of file HGCUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

86  {
87  if (!isJitterValid())
88  return false;
89  if (jitterError() >= 10000)
90  return false;
91 
92  return true;
93 }

◆ isJitterValid()

bool HGCUncalibratedRecHit::isJitterValid ( ) const

Definition at line 79 of file HGCUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

79  {
80  if (jitterError() <= 0)
81  return false;
82  else
83  return true;
84 }

◆ isSaturated()

bool HGCUncalibratedRecHit::isSaturated ( ) const

◆ jitter()

float HGCUncalibratedRecHit::jitter ( ) const
inline

Definition at line 25 of file HGCUncalibratedRecHit.h.

References jitter_.

Referenced by HGCalRecHitSimpleAlgo::makeRecHit(), and setJitter().

25 { return jitter_; }

◆ jitterError()

float HGCUncalibratedRecHit::jitterError ( ) const

Definition at line 30 of file HGCUncalibratedRecHit.cc.

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

Referenced by isJitterErrorValid(), and isJitterValid().

30  {
31  // stored in ps, but return BXs to match with jitter units
32  uint32_t jitterErrorBits = 0xFF & aux_;
33  // all bits off --> time reco bailed out (return negative value)
34  if ((0xFF & jitterErrorBits) == 0x00)
35  return -1;
36  // all bits on --> time error over 5 ns (return large value)
37  if ((0xFF & jitterErrorBits) == 0xFF)
38  return 10000;
39 
40  float LSB = 1.26008;
41  uint8_t exponent = jitterErrorBits >> 5;
42  uint8_t significand = jitterErrorBits & ~(0x7 << 5);
43  return (float)(pow(2., exponent) * significand * LSB) / (25. * 1000);
44 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ jitterErrorBits()

uint8_t HGCUncalibratedRecHit::jitterErrorBits ( ) const

Definition at line 95 of file HGCUncalibratedRecHit.cc.

References aux_.

Referenced by jitterError(), and setJitterError().

95  {
96  uint8_t jitterErrorBits = 0xFF & aux_;
97  return jitterErrorBits;
98 }

◆ outOfTimeChi2()

float HGCUncalibratedRecHit::outOfTimeChi2 ( ) const
inline

Definition at line 28 of file HGCUncalibratedRecHit.h.

References OOTchi2_.

28 { return OOTchi2_; }

◆ outOfTimeEnergy()

float HGCUncalibratedRecHit::outOfTimeEnergy ( ) const
inline

Definition at line 27 of file HGCUncalibratedRecHit.h.

References OOTamplitude_.

◆ pedestal()

float HGCUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 24 of file HGCUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

24 { return pedestal_; }

◆ setAmplitude()

void HGCUncalibratedRecHit::setAmplitude ( float  amplitude)
inline

Definition at line 35 of file HGCUncalibratedRecHit.h.

References amplitude(), and amplitude_.

◆ setAux()

void HGCUncalibratedRecHit::setAux ( uint32_t  aux)
inline

◆ setChi2()

void HGCUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 38 of file HGCUncalibratedRecHit.h.

References chi2(), and chi2_.

◆ setFlagBit()

void HGCUncalibratedRecHit::setFlagBit ( HGCUncalibratedRecHit::Flags  flag)

Definition at line 100 of file HGCUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

100  {
101  if (flag == kGood) {
102  //then set all bits to zero;
103  flags_ = 0;
104  return;
105  }
106  // else set the flagbit
107  flags_ |= 0x1 << flag;
108 }

◆ setFlags()

void HGCUncalibratedRecHit::setFlags ( uint32_t  flags)
inline

Definition at line 43 of file HGCUncalibratedRecHit.h.

References flags(), and flags_.

◆ setId()

void HGCUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 44 of file HGCUncalibratedRecHit.h.

References id(), and id_.

◆ setJitter()

void HGCUncalibratedRecHit::setJitter ( float  jitter)
inline

Definition at line 37 of file HGCUncalibratedRecHit.h.

References jitter(), and jitter_.

◆ setJitterError()

void HGCUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 46 of file HGCUncalibratedRecHit.cc.

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

46  {
47  // use 8 bits (3 exp, 5 mant) and store in ps
48  // has range of 5 ps - 5000 ps
49  // expect input in BX units
50  // all bits off --> time reco bailed out
51  if (jitterErr < 0) {
52  aux_ = (~0xFF & aux_);
53  return;
54  }
55  // all bits on --> time error over 5 ns
56  if (25 * jitterErr >= 5) {
57  aux_ = (0xFF | aux_);
58  return;
59  }
60 
61  float LSB = 1.26008;
62  float quantityInLSB = (1000 * 25 * jitterErr) / LSB;
63  int log2OfQuantity = (int)(log2(quantityInLSB));
64  int exponentTmp = log2OfQuantity - 4;
65  uint8_t exponent = 0;
66  if (exponentTmp > 0)
67  exponent = exponentTmp;
68  uint8_t significand = (int)(lround(quantityInLSB / pow(2., exponent)));
69  uint32_t jitterErrorBits = exponent << 5 | significand;
70 
71  if ((0xFF & jitterErrorBits) == 0xFF)
72  jitterErrorBits = 0xFE;
73  if ((0xFF & jitterErrorBits) == 0x00)
74  jitterErrorBits = 0x01;
75 
76  aux_ = (~0xFF & aux_) | (jitterErrorBits & 0xFF);
77 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ setOutOfTimeChi2()

void HGCUncalibratedRecHit::setOutOfTimeChi2 ( float  chi2)
inline

Definition at line 40 of file HGCUncalibratedRecHit.h.

References chi2(), and OOTchi2_.

◆ setOutOfTimeEnergy()

void HGCUncalibratedRecHit::setOutOfTimeEnergy ( float  energy)
inline

◆ setPedestal()

void HGCUncalibratedRecHit::setPedestal ( float  pedestal)
inline

Definition at line 36 of file HGCUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

◆ amplitude_

float HGCUncalibratedRecHit::amplitude_
private

Definition at line 54 of file HGCUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

◆ aux_

uint32_t HGCUncalibratedRecHit::aux_
private

Definition at line 61 of file HGCUncalibratedRecHit.h.

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

◆ chi2_

float HGCUncalibratedRecHit::chi2_
private

Definition at line 57 of file HGCUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

◆ flags_

uint32_t HGCUncalibratedRecHit::flags_
private

Definition at line 60 of file HGCUncalibratedRecHit.h.

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

◆ id_

DetId HGCUncalibratedRecHit::id_
private

Definition at line 62 of file HGCUncalibratedRecHit.h.

Referenced by id(), and setId().

◆ jitter_

float HGCUncalibratedRecHit::jitter_
private

Definition at line 56 of file HGCUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

◆ OOTamplitude_

float HGCUncalibratedRecHit::OOTamplitude_
private

Definition at line 58 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

◆ OOTchi2_

float HGCUncalibratedRecHit::OOTchi2_
private

Definition at line 59 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

◆ pedestal_

float HGCUncalibratedRecHit::pedestal_
private

Definition at line 55 of file HGCUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().