CMS 3D CMS Logo

HGCRecHit.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HGCRECHIT_H
2 #define DATAFORMATS_HGCRECHIT_H 1
3 
5 #include <vector>
6 
14 class HGCRecHit : public CaloRecHit {
15 public:
16  typedef DetId key_type;
17 
18  // HGCEE recHit flags
19  enum Flags {
20  kGood=0, // channel ok, the energy and time measurement are reliable
21  kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
22  kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
23  kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
24  kNoisy, // the channel is very noisy
25  kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
26  kSaturated, // saturated channel (recovery not tried)
27  kDead, // channel is dead and any recovery fails
28  kKilled, // MC only flag: the channel is killed in the real detector
29  kWeird, // the signal is believed to originate from an anomalous deposit (spike)
30  kDiWeird, // the signal is anomalous, and neighbors another anomalous signal
31  //
32  kUnknown // to ease the interface with functions returning flags.
33  };
34 
35  // HGCfhe recHit flags
36  enum HGCfheFlags {
42  };
43 
44  // HGCbhe recHit flags
45  enum HGCbheFlags {
51  };
52 
64  HGCRecHit();
65  // by default a recHit is greated with no flag
66  HGCRecHit(const DetId& id, float energy, float time, uint32_t flags = 0, uint32_t flagBits = 0);
68  // For the moment not returning a specific id for subdetector
69  DetId id() const { return DetId(detid());}
71  bool isTimeValid() const;
72  bool isTimeErrorValid() const;
73 
74 
75  float chi2() const;
76  float outOfTimeChi2() const;
77  float signalOverSigmaNoise() const;
78 
79 
80  // set the energy for out of time events
81  // (only energy >= 0 will be stored)
82  float outOfTimeEnergy() const;
83  float timeError() const;
84 
85  void setChi2( float chi2 );
86  void setOutOfTimeChi2( float chi2 );
87  void setOutOfTimeEnergy( float energy );
88  void setSignalOverSigmaNoise( float sOverNoise );
89 
90 
91  void setTimeError( uint8_t timeErrBits );
92 
93 
95  void setFlag(int flag) {flagBits_|= (0x1 << flag);}
96  void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
97 
99  bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
100 
102  bool checkFlags(const std::vector<int>& flagsvec) const;
103 
104 
105 private:
106 
108  uint32_t flagBits_;
110 };
111 
112 std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit);
113 
114 #endif
constexpr float energy() const
Definition: CaloRecHit.h:31
void setSignalOverSigmaNoise(float sOverNoise)
Definition: HGCRecHit.cc:62
uint8_t signalOverSigmaNoise_
Definition: HGCRecHit.h:109
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: HGCRecHit.cc:110
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: HGCRecHit.h:95
HGCRecHit()
Definition: HGCRecHit.cc:9
bool isTimeErrorValid() const
Definition: HGCRecHit.cc:100
void unsetFlag(int flag)
Definition: HGCRecHit.h:96
float outOfTimeEnergy() const
Definition: HGCRecHit.cc:26
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:69
bool checkFlag(int flag) const
check if the flag is true
Definition: HGCRecHit.h:99
bool isTimeValid() const
Definition: HGCRecHit.cc:93
float timeError() const
Definition: HGCRecHit.cc:78
void setOutOfTimeEnergy(float energy)
Definition: HGCRecHit.cc:42
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:108
constexpr float time() const
Definition: CaloRecHit.h:33
DetId id() const
get the id
Definition: HGCRecHit.h:69
Definition: DetId.h:18
DetId key_type
Definition: HGCRecHit.h:16
void setOutOfTimeChi2(float chi2)
Definition: HGCRecHit.cc:53
float chi2() const
Definition: HGCRecHit.cc:16
float outOfTimeChi2() const
Definition: HGCRecHit.cc:21
void setChi2(float chi2)
Definition: HGCRecHit.cc:33
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
void setTimeError(uint8_t timeErrBits)
Definition: HGCRecHit.cc:73
std::ostream & operator<<(std::ostream &s, const HGCRecHit &hit)
Definition: HGCRecHit.cc:120