CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalRecHit.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_ECALRECHIT_H
2 #define DATAFORMATS_ECALRECHIT_H 1
3 
5 #include <vector>
6 
12 class EcalRecHit : public CaloRecHit {
13 public:
14  typedef DetId key_type;
15 
16  // recHit flags
17  enum Flags {
18  kGood=0, // channel ok, the energy and time measurement are reliable
19  kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
20  kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
21  kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
22  kNoisy, // the channel is very noisy
23  kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
24  kSaturated, // saturated channel (recovery not tried)
25  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
26  kNeighboursRecovered, // saturated/isolated dead: energy estimated from neighbours
27  kTowerRecovered, // channel in TT with no data link, info retrieved from Trigger Primitive
28  kDead, // channel is dead and any recovery fails
29  kKilled, // MC only flag: the channel is killed in the real detector
30  kTPSaturated, // the channel is in a region with saturated TP
31  kL1SpikeFlag, // the channel is in a region with TP with sFGVB = 0
32  kWeird, // the signal is believed to originate from an anomalous deposit (spike)
33  kDiWeird, // the signal is anomalous, and neighbors another anomalous signal
34  kHasSwitchToGain6, // at least one data frame is in G6
35  kHasSwitchToGain1, // at least one data frame is in G1
36  //
37  kUnknown // to ease the interface with functions returning flags.
38  };
39 
40  // ES recHit flags
41  enum ESFlags {
58  };
59 
72  // by default a recHit is greated with no flag
73  EcalRecHit(const DetId& id, float energy, float time, uint32_t flags = 0, uint32_t flagBits = 0) :
74  CaloRecHit(id,energy,time,flags),
75  flagBits_(flagBits){}
76 
77 
79  // For the moment not returning a specific id for subdetector
80  DetId id() const { return DetId(detid());}
81  bool isRecovered() const;
82  bool isTimeValid() const;
83  bool isTimeErrorValid() const;
84 
85 
86  float chi2() const;
87  float outOfTimeChi2() const;
88 
89  // set the energy for out of time events
90  // (only energy >= 0 will be stored)
91  float outOfTimeEnergy() const;
92  float timeError() const;
93 
94  void setChi2( float chi2 );
95  void setOutOfTimeChi2( float chi2 );
96  void setOutOfTimeEnergy( float energy );
97 
98  void setTimeError( uint8_t timeErrBits );
99 
100 
102  void setFlag(int flag) {flagBits_|= (0x1 << flag);}
103  void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
104 
106  bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
107 
109  bool checkFlags(const std::vector<int>& flagsvec) const;
110 
112  bool checkFlagMask(uint32_t mask) const { return flagBits_&mask; }
113 
115  Flags recoFlag() const ;
116 
117 private:
118 
120  uint32_t flagBits_;
121 };
122 
123 std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit);
124 
125 #endif
void unsetFlag(int flag)
Definition: EcalRecHit.h:103
bool isTimeErrorValid() const
Definition: EcalRecHit.cc:113
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: EcalRecHit.cc:125
const DetId & detid() const
Definition: CaloRecHit.h:20
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
Definition: EcalRecHit.cc:135
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:102
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float time() const
Definition: CaloRecHit.h:19
bool isTimeValid() const
Definition: EcalRecHit.cc:104
bool isRecovered() const
Definition: EcalRecHit.cc:10
void setTimeError(uint8_t timeErrBits)
Definition: EcalRecHit.cc:80
float outOfTimeEnergy() const
Definition: EcalRecHit.cc:32
EcalRecHit(const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
Definition: EcalRecHit.h:73
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
float outOfTimeChi2() const
Definition: EcalRecHit.cc:26
float energy() const
Definition: CaloRecHit.h:17
float chi2() const
Definition: EcalRecHit.cc:18
uint32_t flags() const
Definition: CaloRecHit.h:21
float timeError() const
Definition: EcalRecHit.cc:87
void setOutOfTimeChi2(float chi2)
Definition: EcalRecHit.cc:69
Definition: DetId.h:18
DetId id() const
get the id
Definition: EcalRecHit.h:80
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
Definition: EcalRecHit.h:112
void setChi2(float chi2)
Definition: EcalRecHit.cc:44
void setOutOfTimeEnergy(float energy)
Definition: EcalRecHit.cc:54
DetId key_type
Definition: EcalRecHit.h:14
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120