CMS 3D CMS Logo

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
 
float amplitudeError () 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 outOfTimeAmplitude (int bx) const
 
float pedestal () const
 
void setAmplitude (float amplitude)
 
void setAmplitudeError (float amplitudeerror)
 
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 setOutOfTimeAmplitude (int bx, float amplitude)
 
void setPedestal (float pedestal)
 

Private Attributes

float amplitude_
 
float amplitudeError_
 
uint32_t aux_
 
float chi2_
 
uint32_t flags_
 
DetId id_
 
float jitter_
 
float OOTamplitudes_ [EcalDataFrame::MAXSAMPLES]
 
float OOTchi2_
 
float pedestal_
 

Detailed Description

Definition at line 8 of file EcalUncalibratedRecHit.h.

Member Typedef Documentation

Definition at line 12 of file EcalUncalibratedRecHit.h.

Member Enumeration Documentation

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 
kLeadingEdgeRecovered 
kHasSwitchToGain6 
kHasSwitchToGain1 

Definition at line 14 of file EcalUncalibratedRecHit.h.

14  {
15  kGood=-1, // channel is good (mutually exclusive with other states) setFlagBit(kGood) reset flags_ to zero
16  kPoorReco, // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.)
17  kSaturated, // saturated channel
18  kOutOfTime, // channel out of time
19  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
20  kHasSwitchToGain6, // at least one data frame is in G6
21  kHasSwitchToGain1 // at least one data frame is in G1
22 
23  };

Constructor & Destructor Documentation

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )

Definition at line 6 of file EcalUncalibratedRecHit.cc.

References EcalDataFrame::MAXSAMPLES, and OOTamplitudes_.

6  :
7  amplitude_(0.), amplitudeError_(0.), pedestal_(0.), jitter_(0.), chi2_(10000.), flags_(0), aux_(0) {
8  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
9  for(unsigned int ibx=0; ibx<nsample; ++ibx) OOTamplitudes_[ibx] = 0.;
10 }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalUncalibratedRecHit::EcalUncalibratedRecHit ( const DetId id,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)

Definition at line 12 of file EcalUncalibratedRecHit.cc.

References EcalDataFrame::MAXSAMPLES, and OOTamplitudes_.

13  :
14  amplitude_(ampl), amplitudeError_(0.), pedestal_(ped), jitter_(jit), chi2_(chi2), flags_(flags), aux_(aux), id_(id) {
15  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
16  for(unsigned int ibx=0; ibx<nsample; ++ibx) OOTamplitudes_[ibx] = 0.;
17 }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48

Member Function Documentation

float EcalUncalibratedRecHit::amplitude ( ) const
inline
float EcalUncalibratedRecHit::amplitudeError ( ) const
inline

Definition at line 32 of file EcalUncalibratedRecHit.h.

References amplitudeError_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

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

Definition at line 113 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

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

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

Definition at line 35 of file EcalUncalibratedRecHit.h.

References chi2_.

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

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

Definition at line 38 of file EcalUncalibratedRecHit.h.

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

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

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

Definition at line 85 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

Referenced by setAux().

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

Definition at line 77 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid(), and setAux().

78 {
79  if(jitterError() <= 0)
80  return false;
81  else
82  return true;
83 }
bool EcalUncalibratedRecHit::isSaturated ( ) const
float EcalUncalibratedRecHit::jitter ( ) const
inline
float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 24 of file EcalUncalibratedRecHit.cc.

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

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

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

Definition at line 95 of file EcalUncalibratedRecHit.cc.

References aux_.

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

96 {
97  uint8_t jitterErrorBits = 0xFF & aux_;
98  return jitterErrorBits;
99 }
float EcalUncalibratedRecHit::outOfTimeAmplitude ( int  bx) const
inline

Definition at line 36 of file EcalUncalibratedRecHit.h.

References OOTamplitudes_.

36 { return OOTamplitudes_[bx]; }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
float EcalUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 33 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

void EcalUncalibratedRecHit::setAmplitude ( float  amplitude)
inline
void EcalUncalibratedRecHit::setAmplitudeError ( float  amplitudeerror)
inline

Definition at line 44 of file EcalUncalibratedRecHit.h.

References amplitudeError_.

Referenced by EcalUncalibRecHitMultiFitAlgo::makeRecHit().

44 { amplitudeError_ = amplitudeerror; }
void EcalUncalibratedRecHit::setAux ( uint32_t  aux)
inline
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 102 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by EcalUncalibRecHitWorkerWeights::run(), EcalUncalibRecHitWorkerGlobal::run(), and setAux().

102  {
103  if (flag == kGood) {
104  //then set all bits to zero;
105  flags_ = 0;
106  return;
107  }
108  // else set the flagbit
109  flags_|= 0x1 << flag;
110 }
void EcalUncalibratedRecHit::setFlags ( uint32_t  flags)
inline
void EcalUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 52 of file EcalUncalibratedRecHit.h.

References id(), and id_.

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

Definition at line 41 of file EcalUncalibratedRecHit.cc.

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

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

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

Definition at line 48 of file EcalUncalibratedRecHit.h.

References amplitude(), OOTamplitudes_, and setJitterError().

48 { OOTamplitudes_[bx] = amplitude; }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
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 62 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

float EcalUncalibratedRecHit::amplitudeError_
private

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by amplitudeError(), and setAmplitudeError().

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::OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
private
float EcalUncalibratedRecHit::OOTchi2_
private

Definition at line 68 of file EcalUncalibratedRecHit.h.

float EcalUncalibratedRecHit::pedestal_
private

Definition at line 64 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().