CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

Definition at line 9 of file HGCUncalibratedRecHit.h.

Member Enumeration Documentation

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::HGCUncalibratedRecHit ( )
HGCUncalibratedRecHit::HGCUncalibratedRecHit ( const DetId detId,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)
HGCUncalibratedRecHit::~HGCUncalibratedRecHit ( )
virtual

Definition at line 26 of file HGCUncalibratedRecHit.cc.

26 {}

Member Function Documentation

float HGCUncalibratedRecHit::amplitude ( ) const
inline

Definition at line 23 of file HGCUncalibratedRecHit.h.

References amplitude_.

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

23 { return amplitude_; }
bool HGCUncalibratedRecHit::checkFlag ( HGCUncalibratedRecHit::Flags  flag) const

Definition at line 110 of file HGCUncalibratedRecHit.cc.

References 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 }
float HGCUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 26 of file HGCUncalibratedRecHit.h.

References chi2_.

Referenced by setChi2(), and setOutOfTimeChi2().

26 { return chi2_; }
uint32_t HGCUncalibratedRecHit::flags ( ) const
inline

Definition at line 30 of file HGCUncalibratedRecHit.h.

References flags_.

Referenced by setFlags().

30 { return flags_; }
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_; }
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 }
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 }
bool HGCUncalibratedRecHit::isSaturated ( ) const
float HGCUncalibratedRecHit::jitter ( ) const
inline

Definition at line 25 of file HGCUncalibratedRecHit.h.

References jitter_.

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

25 { return jitter_; }
float HGCUncalibratedRecHit::jitterError ( ) const

Definition at line 30 of file HGCUncalibratedRecHit.cc.

References aux_, HLT_FULL_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 }
uint8_t jitterErrorBits() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
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 }
uint8_t jitterErrorBits() const
float HGCUncalibratedRecHit::outOfTimeChi2 ( ) const
inline

Definition at line 28 of file HGCUncalibratedRecHit.h.

References OOTchi2_.

28 { return OOTchi2_; }
float HGCUncalibratedRecHit::outOfTimeEnergy ( ) const
inline

Definition at line 27 of file HGCUncalibratedRecHit.h.

References OOTamplitude_.

27 { return OOTamplitude_; }
float HGCUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 24 of file HGCUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

24 { return pedestal_; }
void HGCUncalibratedRecHit::setAmplitude ( float  amplitude)
inline

Definition at line 35 of file HGCUncalibratedRecHit.h.

References amplitude(), and amplitude_.

void HGCUncalibratedRecHit::setAux ( uint32_t  aux)
inline

Definition at line 45 of file HGCUncalibratedRecHit.h.

References printConversionInfo::aux, and aux_.

void HGCUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 38 of file HGCUncalibratedRecHit.h.

References chi2(), and chi2_.

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

Definition at line 100 of file HGCUncalibratedRecHit.cc.

References 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 }
void HGCUncalibratedRecHit::setFlags ( uint32_t  flags)
inline

Definition at line 43 of file HGCUncalibratedRecHit.h.

References flags(), and flags_.

void HGCUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 44 of file HGCUncalibratedRecHit.h.

References id(), and id_.

void HGCUncalibratedRecHit::setJitter ( float  jitter)
inline

Definition at line 37 of file HGCUncalibratedRecHit.h.

References jitter(), and jitter_.

void HGCUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 46 of file HGCUncalibratedRecHit.cc.

References aux_, HLT_FULL_cff::exponent, 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 }
uint8_t jitterErrorBits() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void HGCUncalibratedRecHit::setOutOfTimeChi2 ( float  chi2)
inline

Definition at line 40 of file HGCUncalibratedRecHit.h.

References chi2(), and OOTchi2_.

void HGCUncalibratedRecHit::setOutOfTimeEnergy ( float  energy)
inline
void HGCUncalibratedRecHit::setPedestal ( float  pedestal)
inline

Definition at line 36 of file HGCUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

float HGCUncalibratedRecHit::amplitude_
private

Definition at line 54 of file HGCUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t HGCUncalibratedRecHit::aux_
private

Definition at line 61 of file HGCUncalibratedRecHit.h.

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

float HGCUncalibratedRecHit::chi2_
private

Definition at line 57 of file HGCUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t HGCUncalibratedRecHit::flags_
private

Definition at line 60 of file HGCUncalibratedRecHit.h.

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

DetId HGCUncalibratedRecHit::id_
private

Definition at line 62 of file HGCUncalibratedRecHit.h.

Referenced by id(), and setId().

float HGCUncalibratedRecHit::jitter_
private

Definition at line 56 of file HGCUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

float HGCUncalibratedRecHit::OOTamplitude_
private

Definition at line 58 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

float HGCUncalibratedRecHit::OOTchi2_
private

Definition at line 59 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

float HGCUncalibratedRecHit::pedestal_
private

Definition at line 55 of file HGCUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().