CMS 3D CMS Logo

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

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 EcalUncalibratedRecHit.h.

Member Typedef Documentation

Definition at line 11 of file EcalUncalibratedRecHit.h.

Member Enumeration Documentation

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 
kLeadingEdgeRecovered 
kHasSwitchToGain6 
kHasSwitchToGain1 

Definition at line 13 of file EcalUncalibratedRecHit.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  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
19  kHasSwitchToGain6, // at least one data frame is in G6
20  kHasSwitchToGain1 // at least one data frame is in G1
21 
22  };

Constructor & Destructor Documentation

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )
inline
EcalUncalibratedRecHit::EcalUncalibratedRecHit ( const DetId id,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)
inline

Member Function Documentation

float EcalUncalibratedRecHit::amplitude ( ) const
inline
bool EcalUncalibratedRecHit::checkFlag ( EcalUncalibratedRecHit::Flags  flag) const

Definition at line 101 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

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

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

Definition at line 35 of file EcalUncalibratedRecHit.h.

References chi2_.

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

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

Definition at line 39 of file EcalUncalibratedRecHit.h.

References flags_.

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

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

Definition at line 73 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

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

Definition at line 65 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

66 {
67  if(jitterError() <= 0)
68  return false;
69  else
70  return true;
71 }
bool EcalUncalibratedRecHit::isSaturated ( ) const
float EcalUncalibratedRecHit::jitter ( ) const
inline
float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 12 of file EcalUncalibratedRecHit.cc.

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

Referenced by isJitterErrorValid(), and isJitterValid().

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

Definition at line 83 of file EcalUncalibratedRecHit.cc.

References aux_.

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

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

Definition at line 37 of file EcalUncalibratedRecHit.h.

References OOTchi2_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

37 { return OOTchi2_; }
float EcalUncalibratedRecHit::outOfTimeEnergy ( ) const
inline
float EcalUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 33 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

33 { return pedestal_; }
void EcalUncalibratedRecHit::setAmplitude ( float  amplitude)
inline
void EcalUncalibratedRecHit::setAux ( uint32_t  aux)
inline

Definition at line 54 of file EcalUncalibratedRecHit.h.

References printConversionInfo::aux, and aux_.

void EcalUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 47 of file EcalUncalibratedRecHit.h.

References chi2(), and chi2_.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

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

Definition at line 90 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

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

Definition at line 53 of file EcalUncalibratedRecHit.h.

References id(), and id_.

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

Definition at line 29 of file EcalUncalibratedRecHit.cc.

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

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

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

Definition at line 49 of file EcalUncalibratedRecHit.h.

References chi2(), and OOTchi2_.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

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

Definition at line 45 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

float EcalUncalibratedRecHit::amplitude_
private

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t EcalUncalibratedRecHit::aux_
private

Definition at line 70 of file EcalUncalibratedRecHit.h.

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

float EcalUncalibratedRecHit::chi2_
private

Definition at line 66 of file EcalUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t EcalUncalibratedRecHit::flags_
private

Definition at line 69 of file EcalUncalibratedRecHit.h.

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

DetId EcalUncalibratedRecHit::id_
private

Definition at line 71 of file EcalUncalibratedRecHit.h.

Referenced by id(), and setId().

float EcalUncalibratedRecHit::jitter_
private

Definition at line 65 of file EcalUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

float EcalUncalibratedRecHit::OOTamplitude_
private

Definition at line 67 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

float EcalUncalibratedRecHit::OOTchi2_
private

Definition at line 68 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

float EcalUncalibratedRecHit::pedestal_
private

Definition at line 64 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().