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