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, float energy, float time, float timeError, uint32_t flagBits = 0);
40 
41  FTLRecHit(const DetId& id, uint8_t row, uint8_t column, float energy,
42  float time, float timeError, uint32_t flagBits = 0);
43 
45 
46  float energy() const { return energy_; }
47  void setEnergy(float energy) { energy_=energy; }
48 
49  const DetId& id() const { return id_; }
50  const DetId& detid() const { return id(); }
51 
52  const MTDDetId mtdId() const { return MTDDetId(id_); }
53 
54  int row() const { return row_; }
55  int column() const { return column_; }
56 
57  float time() const { return time_; }
58  void setTime(float time) { time_=time; }
59 
60  bool isTimeValid() const;
61  bool isTimeErrorValid() const;
62 
63  float timeError() const { return timeError_; }
64  void setTimeError( float err ) { timeError_ = err; }
65 
67  void setFlag(int flag) {flagBits_|= (0x1 << flag);}
68  void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
69 
71  bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
72 
74  bool checkFlags(const std::vector<int>& flagsvec) const;
75 
76 
77 private:
78 
81  uint8_t row_, column_;
82 
84  unsigned char flagBits_;
85 };
86 
87 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit);
88 
89 #endif
int row() const
Definition: FTLRecHit.h:54
const DetId & detid() const
Definition: FTLRecHit.h:50
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:71
unsigned char flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: FTLRecHit.h:84
uint8_t column_
Definition: FTLRecHit.h:81
void setTime(float time)
Definition: FTLRecHit.h:58
float timeError() const
Definition: FTLRecHit.h:63
float energy() const
get the id
Definition: FTLRecHit.h:46
const MTDDetId mtdId() const
Definition: FTLRecHit.h:52
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
float time_
Definition: FTLRecHit.h:80
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:30
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:40
DetId key_type
Definition: FTLRecHit.h:17
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:50
float time() const
Definition: FTLRecHit.h:57
float timeError_
Definition: FTLRecHit.h:80
int column() const
Definition: FTLRecHit.h:55
float energy_
Definition: FTLRecHit.h:80
DetId id_
Definition: FTLRecHit.h:79
void setEnergy(float energy)
Definition: FTLRecHit.h:47
Definition: DetId.h:18
const DetId & id() const
Definition: FTLRecHit.h:49
uint8_t row_
Definition: FTLRecHit.h:81
void unsetFlag(int flag)
Definition: FTLRecHit.h:68
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: FTLRecHit.h:67
bool isTimeValid() const
Definition: FTLRecHit.cc:23
void setTimeError(float err)
Definition: FTLRecHit.h:64