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

Definition at line 11 of file HGCUncalibratedRecHit.h.

Member Enumeration Documentation

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 

Definition at line 13 of file HGCUncalibratedRecHit.h.

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

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 11 of file HGCUncalibratedRecHit.cc.

11  {
12 }

Member Function Documentation

float HGCUncalibratedRecHit::amplitude ( ) const
inline

Definition at line 25 of file HGCUncalibratedRecHit.h.

References amplitude_.

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

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

Definition at line 102 of file HGCUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by isSaturated(), and setAux().

102  {
103  if(flag == kGood){ if ( ! flags_ ) return true;else return false;} // if all flags are unset, then hit is good
104  return flags_ & ( 0x1<<flag);
105 }
float HGCUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 28 of file HGCUncalibratedRecHit.h.

References chi2_.

Referenced by setChi2(), and setOutOfTimeChi2().

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

Definition at line 32 of file HGCUncalibratedRecHit.h.

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

Referenced by setFlags().

32 { return flags_; }
DetId HGCUncalibratedRecHit::id ( ) const
inline

Definition at line 35 of file HGCUncalibratedRecHit.h.

References id_.

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

35 { return id_; }
bool HGCUncalibratedRecHit::isJitterErrorValid ( ) const

Definition at line 75 of file HGCUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

Referenced by setAux().

75  {
76  if(!isJitterValid())
77  return false;
78  if(jitterError() >= 10000)
79  return false;
80 
81  return true;
82 }
bool HGCUncalibratedRecHit::isJitterValid ( ) const

Definition at line 68 of file HGCUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid(), and setAux().

68  {
69  if(jitterError() <= 0)
70  return false;
71  else
72  return true;
73 }
bool HGCUncalibratedRecHit::isSaturated ( ) const

Definition at line 14 of file HGCUncalibratedRecHit.cc.

References checkFlag(), and kSaturated.

Referenced by setAux().

float HGCUncalibratedRecHit::jitter ( ) const
inline

Definition at line 27 of file HGCUncalibratedRecHit.h.

References jitter_.

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

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

Definition at line 19 of file HGCUncalibratedRecHit.cc.

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

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

19  {
20  // stored in ps, but return BXs to match with jitter units
21  uint32_t jitterErrorBits = 0xFF & aux_;
22  // all bits off --> time reco bailed out (return negative value)
23  if( (0xFF & jitterErrorBits) == 0x00)
24  return -1;
25  // all bits on --> time error over 5 ns (return large value)
26  if( (0xFF & jitterErrorBits) == 0xFF)
27  return 10000;
28 
29  float LSB = 1.26008;
30  uint8_t exponent = jitterErrorBits>>5;
31  uint8_t significand = jitterErrorBits & ~(0x7<<5);
32  return (float)(pow(2.,exponent)*significand*LSB)/(25.*1000);
33 }
uint8_t jitterErrorBits() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
uint8_t HGCUncalibratedRecHit::jitterErrorBits ( ) const

Definition at line 84 of file HGCUncalibratedRecHit.cc.

References aux_.

Referenced by flags(), jitterError(), and setJitterError().

84  {
85  uint8_t jitterErrorBits = 0xFF & aux_;
86  return jitterErrorBits;
87 }
uint8_t jitterErrorBits() const
float HGCUncalibratedRecHit::outOfTimeChi2 ( ) const
inline

Definition at line 30 of file HGCUncalibratedRecHit.h.

References OOTchi2_.

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

Definition at line 29 of file HGCUncalibratedRecHit.h.

References OOTamplitude_.

float HGCUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 26 of file HGCUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

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

Definition at line 37 of file HGCUncalibratedRecHit.h.

References amplitude(), and amplitude_.

void HGCUncalibratedRecHit::setAux ( uint32_t  aux)
inline
void HGCUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 40 of file HGCUncalibratedRecHit.h.

References chi2(), and chi2_.

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

Definition at line 90 of file HGCUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by setAux().

90  {
91 
92  if (flag == kGood) {
93  //then set all bits to zero;
94  flags_ = 0;
95  return;
96  }
97  // else set the flagbit
98  flags_|= 0x1 << flag;
99 }
void HGCUncalibratedRecHit::setFlags ( uint32_t  flags)
inline
void HGCUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 46 of file HGCUncalibratedRecHit.h.

References id(), and id_.

void HGCUncalibratedRecHit::setJitter ( float  jitter)
inline

Definition at line 39 of file HGCUncalibratedRecHit.h.

References jitter(), and jitter_.

void HGCUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 35 of file HGCUncalibratedRecHit.cc.

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

Referenced by setOutOfTimeChi2().

35  {
36  // use 8 bits (3 exp, 5 mant) and store in ps
37  // has range of 5 ps - 5000 ps
38  // expect input in BX units
39  // all bits off --> time reco bailed out
40  if(jitterErr < 0) {
41  aux_ = (~0xFF & aux_);
42  return;
43  }
44  // all bits on --> time error over 5 ns
45  if(25*jitterErr >= 5) {
46  aux_ = (0xFF | aux_);
47  return;
48  }
49 
50  float LSB = 1.26008;
51  float quantityInLSB = (1000*25*jitterErr)/LSB;
52  int log2OfQuantity = (int) (log2( quantityInLSB ));
53  int exponentTmp = log2OfQuantity - 4;
54  uint8_t exponent=0;
55  if (exponentTmp>0) exponent = exponentTmp;
56  uint8_t significand = (int) ( lround( quantityInLSB / pow(2.,exponent) ) );
57  uint32_t jitterErrorBits = exponent<<5 | significand;
58 
59  if( (0xFF & jitterErrorBits) == 0xFF)
60  jitterErrorBits = 0xFE;
61  if( (0xFF & jitterErrorBits) == 0x00)
62  jitterErrorBits = 0x01;
63 
64  aux_ = (~0xFF & aux_) | (jitterErrorBits & 0xFF);
65 
66 }
uint8_t jitterErrorBits() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCUncalibratedRecHit::setOutOfTimeChi2 ( float  chi2)
inline

Definition at line 42 of file HGCUncalibratedRecHit.h.

References chi2(), OOTchi2_, and setJitterError().

void HGCUncalibratedRecHit::setOutOfTimeEnergy ( float  energy)
inline

Definition at line 41 of file HGCUncalibratedRecHit.h.

References OOTamplitude_.

41 { OOTamplitude_ = energy; }
void HGCUncalibratedRecHit::setPedestal ( float  pedestal)
inline

Definition at line 38 of file HGCUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

float HGCUncalibratedRecHit::amplitude_
private

Definition at line 56 of file HGCUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t HGCUncalibratedRecHit::aux_
private

Definition at line 63 of file HGCUncalibratedRecHit.h.

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

float HGCUncalibratedRecHit::chi2_
private

Definition at line 59 of file HGCUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t HGCUncalibratedRecHit::flags_
private

Definition at line 62 of file HGCUncalibratedRecHit.h.

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

DetId HGCUncalibratedRecHit::id_
private

Definition at line 64 of file HGCUncalibratedRecHit.h.

Referenced by id(), and setId().

float HGCUncalibratedRecHit::jitter_
private

Definition at line 58 of file HGCUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

float HGCUncalibratedRecHit::OOTamplitude_
private

Definition at line 60 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

float HGCUncalibratedRecHit::OOTchi2_
private

Definition at line 61 of file HGCUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

float HGCUncalibratedRecHit::pedestal_
private

Definition at line 57 of file HGCUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().