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 &detId, 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)
 
virtual ~EcalUncalibratedRecHit ()
 

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

Definition at line 12 of file EcalUncalibratedRecHit.cc.

12  {
13 }

Member Function Documentation

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

Definition at line 110 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

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

110  {
111  if(flag == kGood){ if ( ! flags_ ) return true;else return false;} // if all flags are unset, then hit is good
112  return flags_ & ( 0x1<<flag);
113 }
long int flag
Definition: mlp_lapack.h:47
float EcalUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 32 of file EcalUncalibratedRecHit.h.

References chi2_.

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

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

Definition at line 36 of file EcalUncalibratedRecHit.h.

References flags_.

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

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

Definition at line 81 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

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

Definition at line 73 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

74 {
75  if(jitterError() <= 0)
76  return false;
77  else
78  return true;
79 }
bool EcalUncalibratedRecHit::isSaturated ( ) const
float EcalUncalibratedRecHit::jitter ( ) const
inline
float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 20 of file EcalUncalibratedRecHit.cc.

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

Referenced by isJitterErrorValid(), and isJitterValid().

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

Definition at line 91 of file EcalUncalibratedRecHit.cc.

References aux_.

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

92 {
93  uint8_t jitterErrorBits = 0xFF & aux_;
94  return jitterErrorBits;
95 }
float EcalUncalibratedRecHit::outOfTimeChi2 ( ) const
inline

Definition at line 34 of file EcalUncalibratedRecHit.h.

References OOTchi2_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

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

Definition at line 30 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

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

Definition at line 51 of file EcalUncalibratedRecHit.h.

References printConversionInfo::aux, and aux_.

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 98 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

98  {
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 }
long int flag
Definition: mlp_lapack.h:47
void EcalUncalibratedRecHit::setFlags ( uint32_t  flags)
inline
void EcalUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 50 of file EcalUncalibratedRecHit.h.

References id(), and id_.

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

Definition at line 37 of file EcalUncalibratedRecHit.cc.

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

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

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

Definition at line 46 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 42 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

float EcalUncalibratedRecHit::amplitude_
private

Definition at line 60 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t EcalUncalibratedRecHit::aux_
private

Definition at line 67 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 66 of file EcalUncalibratedRecHit.h.

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

DetId EcalUncalibratedRecHit::id_
private

Definition at line 68 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::OOTamplitude_
private

Definition at line 64 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

float EcalUncalibratedRecHit::OOTchi2_
private

Definition at line 65 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

float EcalUncalibratedRecHit::pedestal_
private

Definition at line 61 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().