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 nonCorrectedTime () 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 setNonCorrectedTime (const float correctedJittter, const float nonCorrectedJitter)
 
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

◆ key_type

Definition at line 10 of file EcalUncalibratedRecHit.h.

Member Enumeration Documentation

◆ Flags

Enumerator
kGood 
kPoorReco 
kSaturated 
kOutOfTime 
kLeadingEdgeRecovered 
kHasSwitchToGain6 
kHasSwitchToGain1 

Definition at line 12 of file EcalUncalibratedRecHit.h.

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

Constructor & Destructor Documentation

◆ EcalUncalibratedRecHit() [1/2]

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )

Definition at line 5 of file EcalUncalibratedRecHit.cc.

References EcalDataFrame::MAXSAMPLES, and OOTamplitudes_.

6  : amplitude_(0.), amplitudeError_(0.), pedestal_(0.), jitter_(0.), chi2_(10000.), flags_(0), aux_(0) {
7  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
8  for (unsigned int ibx = 0; ibx < nsample; ++ibx)
9  OOTamplitudes_[ibx] = 0.;
10 }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ EcalUncalibratedRecHit() [2/2]

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_.

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

Member Function Documentation

◆ amplitude()

float EcalUncalibratedRecHit::amplitude ( ) const
inline

◆ amplitudeError()

float EcalUncalibratedRecHit::amplitudeError ( ) const
inline

Definition at line 29 of file EcalUncalibratedRecHit.h.

References amplitudeError_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

◆ checkFlag()

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

Definition at line 109 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

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

109  {
110  if (flag == kGood) {
111  if (!flags_)
112  return true;
113  else
114  return false;
115  } // if all flags are unset, then hit is good
116  return flags_ & (0x1 << flag);
117 }

◆ chi2()

float EcalUncalibratedRecHit::chi2 ( void  ) const
inline

Definition at line 32 of file EcalUncalibratedRecHit.h.

References chi2_.

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

32 { return chi2_; }

◆ flags()

uint32_t EcalUncalibratedRecHit::flags ( ) const
inline

Definition at line 35 of file EcalUncalibratedRecHit.h.

References flags_.

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

35 { return flags_; }

◆ id()

DetId EcalUncalibratedRecHit::id ( ) const
inline

◆ isJitterErrorValid()

bool EcalUncalibratedRecHit::isJitterErrorValid ( ) const

Definition at line 85 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

85  {
86  if (!isJitterValid())
87  return false;
88  if (jitterError() >= 10000)
89  return false;
90 
91  return true;
92 }

◆ isJitterValid()

bool EcalUncalibratedRecHit::isJitterValid ( ) const

Definition at line 78 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

78  {
79  if (jitterError() <= 0)
80  return false;
81  else
82  return true;
83 }

◆ isSaturated()

bool EcalUncalibratedRecHit::isSaturated ( ) const

◆ jitter()

float EcalUncalibratedRecHit::jitter ( ) const
inline

◆ jitterError()

float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 29 of file EcalUncalibratedRecHit.cc.

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

Referenced by isJitterErrorValid(), and isJitterValid().

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

◆ jitterErrorBits()

uint8_t EcalUncalibratedRecHit::jitterErrorBits ( ) const

Definition at line 94 of file EcalUncalibratedRecHit.cc.

References aux_.

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

94  {
95  uint8_t jitterErrorBits = 0xFF & aux_;
96  return jitterErrorBits;
97 }

◆ nonCorrectedTime()

float EcalUncalibratedRecHit::nonCorrectedTime ( ) const

Definition at line 120 of file EcalUncalibratedRecHit.cc.

References ecalcctiming::clockToNS, ecalcctiming::encodingOffest, ecalcctiming::encodingValue, jitter_, jitterErrorBits(), and ecalcctiming::nonCorrectedSlope.

120  {
121  float encBits = static_cast<float>(jitterErrorBits());
122  float decJitter =
124  float nonCorrectedTime = (encBits > 1 && encBits < 254) ? ecalcctiming::clockToNS * decJitter : -30.0;
125  return nonCorrectedTime;
126 }
constexpr const float encodingValue
Definition: EcalConstants.h:13
constexpr const float nonCorrectedSlope
Definition: EcalConstants.h:11
constexpr const float clockToNS
Definition: EcalConstants.h:10
constexpr const float encodingOffest
Definition: EcalConstants.h:12

◆ outOfTimeAmplitude()

float EcalUncalibratedRecHit::outOfTimeAmplitude ( int  bx) const
inline

Definition at line 33 of file EcalUncalibratedRecHit.h.

References nano_mu_digi_cff::bx, and OOTamplitudes_.

33 { return OOTamplitudes_[bx]; }
float OOTamplitudes_[EcalDataFrame::MAXSAMPLES]

◆ pedestal()

float EcalUncalibratedRecHit::pedestal ( ) const
inline

Definition at line 30 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

◆ setAmplitude()

void EcalUncalibratedRecHit::setAmplitude ( float  amplitude)
inline

◆ setAmplitudeError()

void EcalUncalibratedRecHit::setAmplitudeError ( float  amplitudeerror)
inline

◆ setAux()

void EcalUncalibratedRecHit::setAux ( uint32_t  aux)
inline

◆ setChi2()

void EcalUncalibratedRecHit::setChi2 ( float  chi2)
inline

Definition at line 44 of file EcalUncalibratedRecHit.h.

References chi2(), and chi2_.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

◆ setFlagBit()

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

Definition at line 99 of file EcalUncalibratedRecHit.cc.

References RemoveAddSevLevel::flag, flags_, and kGood.

Referenced by EcalUncalibRecHitPhase2WeightsProducer::produce(), EcalUncalibRecHitWorkerWeights::run(), and EcalUncalibRecHitWorkerGlobal::run().

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 }

◆ setFlags()

void EcalUncalibratedRecHit::setFlags ( uint32_t  flags)
inline

Definition at line 48 of file EcalUncalibratedRecHit.h.

References flags(), and flags_.

◆ setId()

void EcalUncalibratedRecHit::setId ( DetId  id)
inline

Definition at line 49 of file EcalUncalibratedRecHit.h.

References id(), and id_.

◆ setJitter()

void EcalUncalibratedRecHit::setJitter ( float  jitter)
inline

◆ setJitterError()

void EcalUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 45 of file EcalUncalibratedRecHit.cc.

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

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

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

◆ setNonCorrectedTime()

void EcalUncalibratedRecHit::setNonCorrectedTime ( const float  correctedJittter,
const float  nonCorrectedJitter 
)

Definition at line 128 of file EcalUncalibratedRecHit.cc.

References aux_, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, ecalcctiming::encodingOffest, ecalcctiming::encodingValue, and ecalcctiming::nonCorrectedSlope.

128  {
129  float fDiff = ecalcctiming::nonCorrectedSlope * correctedJitter - nonCorrectedJitter + ecalcctiming::encodingOffest;
130  int encBits = std::floor((fDiff * ecalcctiming::encodingValue) + 0.5);
131  int bits = (encBits < 1) ? 1 : (encBits > 254) ? 254 : encBits;
132  aux_ = (~0xFF & aux_) | (static_cast<uint8_t>(bits) & 0xFF);
133 }
constexpr const float encodingValue
Definition: EcalConstants.h:13
constexpr const float nonCorrectedSlope
Definition: EcalConstants.h:11
constexpr const float encodingOffest
Definition: EcalConstants.h:12

◆ setOutOfTimeAmplitude()

void EcalUncalibratedRecHit::setOutOfTimeAmplitude ( int  bx,
float  amplitude 
)
inline

Definition at line 45 of file EcalUncalibratedRecHit.h.

References amplitude(), nano_mu_digi_cff::bx, and OOTamplitudes_.

◆ setPedestal()

void EcalUncalibratedRecHit::setPedestal ( float  pedestal)
inline

Definition at line 42 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.

Member Data Documentation

◆ amplitude_

float EcalUncalibratedRecHit::amplitude_
private

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

◆ amplitudeError_

float EcalUncalibratedRecHit::amplitudeError_
private

Definition at line 64 of file EcalUncalibratedRecHit.h.

Referenced by amplitudeError(), and setAmplitudeError().

◆ aux_

uint32_t EcalUncalibratedRecHit::aux_
private

◆ chi2_

float EcalUncalibratedRecHit::chi2_
private

Definition at line 67 of file EcalUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

◆ flags_

uint32_t EcalUncalibratedRecHit::flags_
private

Definition at line 71 of file EcalUncalibratedRecHit.h.

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

◆ id_

DetId EcalUncalibratedRecHit::id_
private

Definition at line 73 of file EcalUncalibratedRecHit.h.

Referenced by id(), and setId().

◆ jitter_

float EcalUncalibratedRecHit::jitter_
private

Definition at line 66 of file EcalUncalibratedRecHit.h.

Referenced by jitter(), nonCorrectedTime(), and setJitter().

◆ OOTamplitudes_

float EcalUncalibratedRecHit::OOTamplitudes_[EcalDataFrame::MAXSAMPLES]
private

◆ OOTchi2_

float EcalUncalibratedRecHit::OOTchi2_
private

Definition at line 70 of file EcalUncalibratedRecHit.h.

◆ pedestal_

float EcalUncalibratedRecHit::pedestal_
private

Definition at line 65 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().