CMS 3D CMS Logo

FTLRecHit.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_FTLRECHIT_H
2 #define DATAFORMATS_FTLRECHIT_H 1
3 
6 #include <vector>
7 
15 class FTLRecHit {
16 public:
17  typedef DetId key_type;
18 
19  // FTLEE recHit flags
20  enum Flags {
21  kGood = 0, // channel ok, the energy and time measurement are reliable
22  kKilled, // MC only flag: the channel is killed in the real detector
23  kUnknown // to ease the interface with functions returning flags.
24  };
25 
37  FTLRecHit();
38  // by default a recHit is greated with no flag
39  FTLRecHit(const DetId& id,
40  uint8_t row,
41  uint8_t column,
42  float energy,
43  float time,
44  float timeError,
45  float position,
46  float positionError,
47  uint32_t flagBits = 0);
48 
49  FTLRecHit(const DetId& id,
50  float energy,
51  float time,
52  float timeError,
53  float position,
54  float positionError,
55  uint32_t flagBits = 0);
56 
58 
59  float energy() const { return energy_; }
60  void setEnergy(float energy) { energy_ = energy; }
61 
62  const DetId& id() const { return id_; }
63  const DetId& detid() const { return id(); }
64 
65  const MTDDetId mtdId() const { return MTDDetId(id_); }
66 
67  int row() const { return row_; }
68  int column() const { return column_; }
69 
70  float time() const { return time_; }
71  void setTime(float time) { time_ = time; }
72 
73  float position() const { return position_; }
75 
76  bool isTimeValid() const;
77  bool isTimeErrorValid() const;
78 
79  float timeError() const { return timeError_; }
80  void setTimeError(float err) { timeError_ = err; }
81 
82  float positionError() const { return positionError_; }
83  void setPositionError(float poserr) { positionError_ = poserr; }
84 
86  void setFlag(int flag) { flagBits_ |= (0x1 << flag); }
87  void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); }
88 
90  bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); }
91 
93  bool checkFlags(const std::vector<int>& flagsvec) const;
94 
95 private:
97  float energy_;
98  float time_;
99  float timeError_;
101  float position_;
103  uint8_t row_;
104  uint8_t column_;
105 
107  unsigned char flagBits_;
108 };
109 
110 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit);
111 
112 #endif
float positionError_
Definition: FTLRecHit.h:102
unsigned char flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: FTLRecHit.h:107
uint8_t column_
Definition: FTLRecHit.h:104
void setTime(float time)
Definition: FTLRecHit.h:71
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:54
void setPosition(float position)
Definition: FTLRecHit.h:74
const DetId & detid() const
Definition: FTLRecHit.h:63
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
float time_
Definition: FTLRecHit.h:98
float positionError() const
Definition: FTLRecHit.h:82
float timeError() const
Definition: FTLRecHit.h:79
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:44
DetId key_type
Definition: FTLRecHit.h:17
bool isTimeValid() const
Definition: FTLRecHit.cc:37
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:63
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:90
int column() const
Definition: FTLRecHit.h:68
float timeError_
Definition: FTLRecHit.h:99
float energy_
Definition: FTLRecHit.h:97
float time() const
Definition: FTLRecHit.h:70
DetId id_
Definition: FTLRecHit.h:96
void setEnergy(float energy)
Definition: FTLRecHit.h:60
const MTDDetId mtdId() const
Definition: FTLRecHit.h:65
Definition: DetId.h:17
int row() const
Definition: FTLRecHit.h:67
uint8_t row_
Definition: FTLRecHit.h:103
void unsetFlag(int flag)
Definition: FTLRecHit.h:87
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: FTLRecHit.h:86
float energy() const
get the id
Definition: FTLRecHit.h:59
void setPositionError(float poserr)
Definition: FTLRecHit.h:83
float position() const
Definition: FTLRecHit.h:73
const DetId & id() const
Definition: FTLRecHit.h:62
float position_
position is the distance from the center of the bar to hit
Definition: FTLRecHit.h:101
void setTimeError(float err)
Definition: FTLRecHit.h:80