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
37 
38  // HGCbhe recHit flags
40 
41  // HFnose rechit flags
42  enum HFNoseFlags {
55  };
56 
68  HGCRecHit();
69  // by default a recHit is greated with no flag
70  HGCRecHit(const DetId& id,
71  float energy,
72  float time,
73  uint32_t flags = 0,
74  uint32_t flagBits = 0,
75  uint8_t son = 0,
76  float timeError = 0.f);
78  // For the moment not returning a specific id for subdetector
79  DetId id() const { return DetId(detid()); }
81  bool isTimeValid() const;
82  bool isTimeErrorValid() const;
83 
84  float chi2() const;
85  float outOfTimeChi2() const;
86  float signalOverSigmaNoise() const;
87 
88  // set the energy for out of time events
89  // (only energy >= 0 will be stored)
90  float outOfTimeEnergy() const;
91  float timeError() const;
92 
93  void setChi2(float chi2);
94  void setOutOfTimeChi2(float chi2);
95  void setOutOfTimeEnergy(float energy);
96  void setSignalOverSigmaNoise(float sOverNoise);
97 
98  void setTimeError(float timeErr);
99 
101  void setFlag(int flag) { flagBits_ |= (0x1 << flag); }
102  void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); }
103 
105  bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); }
106 
108  bool checkFlags(const std::vector<int>& flagsvec) const;
109 
110  //added for validation
111  uint32_t flagBits() const { return flagBits_; }
112 
113  //define operator== for std::find
114  bool operator==(const HGCRecHit& hit) const { return id().rawId() == hit.id().rawId(); }
115  bool operator==(const DetId& otherid) const { return id().rawId() == otherid.rawId(); }
116 
117  //define operator< for std::sort
118  bool operator<(const HGCRecHit& hit) const {
119  if (id().rawId() == hit.id().rawId())
120  return energy() < hit.energy();
121  return id().rawId() < hit.id().rawId();
122  }
123 
124 private:
126  uint32_t flagBits_;
128  float timeError_;
129 };
130 
131 std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit);
132 
133 #endif
bool checkFlag(int flag) const
check if the flag is true
Definition: HGCRecHit.h:105
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
bool isTimeValid() const
Definition: HGCRecHit.cc:81
void setSignalOverSigmaNoise(float sOverNoise)
Definition: HGCRecHit.cc:64
uint8_t signalOverSigmaNoise_
Definition: HGCRecHit.h:127
bool operator==(const HGCRecHit &hit) const
Definition: HGCRecHit.h:114
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:72
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: HGCRecHit.h:101
void unsetFlag(int flag)
Definition: HGCRecHit.h:102
DetId id() const
get the id
Definition: HGCRecHit.h:79
bool isTimeErrorValid() const
Definition: HGCRecHit.cc:88
bool operator==(const DetId &otherid) const
Definition: HGCRecHit.h:115
constexpr float energy() const
Definition: CaloRecHit.h:29
bool operator<(const HGCRecHit &hit) const
Definition: HGCRecHit.h:118
void setOutOfTimeEnergy(float energy)
Definition: HGCRecHit.cc:43
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:126
double f[11][100]
unsigned int id
float chi2() const
Definition: HGCRecHit.cc:16
void setTimeError(float timeErr)
Definition: HGCRecHit.cc:74
Definition: DetId.h:17
float outOfTimeChi2() const
Definition: HGCRecHit.cc:21
DetId key_type
Definition: HGCRecHit.h:16
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: HGCRecHit.cc:98
void setOutOfTimeChi2(float chi2)
Definition: HGCRecHit.cc:54
constexpr float time() const
Definition: CaloRecHit.h:31
float outOfTimeEnergy() const
Definition: HGCRecHit.cc:26
float timeError() const
Definition: HGCRecHit.cc:79
uint32_t flagBits() const
Definition: HGCRecHit.h:111
float timeError_
Definition: HGCRecHit.h:128
void setChi2(float chi2)
Definition: HGCRecHit.cc:33
std::ostream & operator<<(std::ostream &s, const HGCRecHit &hit)
Definition: HGCRecHit.cc:107