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 
5 #include <vector>
6 
14 class FTLRecHit {
15 public:
16  typedef DetId key_type;
17 
18  // FTLEE recHit flags
19  enum Flags {
20  kGood=0, // channel ok, the energy and time measurement are reliable
21  kKilled, // MC only flag: the channel is killed in the real detector
22  kUnknown // to ease the interface with functions returning flags.
23  };
24 
36  FTLRecHit();
37  // by default a recHit is greated with no flag
38  FTLRecHit(const DetId& id, float energy, float time, float timeError, uint32_t flagBits = 0);
40 
41  float energy() const { return energy_; }
42  void setEnergy(float energy) { energy_=energy; }
43 
44  const DetId& id() const { return id_; }
45  const DetId& detid() const { return id(); }
46 
47  float time() const { return time_; }
48  void setTime(float time) { time_=time; }
49 
50  bool isTimeValid() const;
51  bool isTimeErrorValid() const;
52 
53  float timeError() const { return timeError_; }
54  void setTimeError( float err ) { timeError_ = err; }
55 
57  void setFlag(int flag) {flagBits_|= (0x1 << flag);}
58  void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
59 
61  bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
62 
64  bool checkFlags(const std::vector<int>& flagsvec) const;
65 
66 
67 private:
68 
71 
73  unsigned char flagBits_;
74 };
75 
76 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit);
77 
78 #endif
const DetId & detid() const
Definition: FTLRecHit.h:45
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:61
unsigned char flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: FTLRecHit.h:73
void setTime(float time)
Definition: FTLRecHit.h:48
float timeError() const
Definition: FTLRecHit.h:53
float energy() const
get the id
Definition: FTLRecHit.h:41
float time_
Definition: FTLRecHit.h:70
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:26
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:36
DetId key_type
Definition: FTLRecHit.h:16
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:46
float time() const
Definition: FTLRecHit.h:47
float timeError_
Definition: FTLRecHit.h:70
float energy_
Definition: FTLRecHit.h:70
DetId id_
Definition: FTLRecHit.h:69
void setEnergy(float energy)
Definition: FTLRecHit.h:42
Definition: DetId.h:18
const DetId & id() const
Definition: FTLRecHit.h:44
void unsetFlag(int flag)
Definition: FTLRecHit.h:58
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: FTLRecHit.h:57
bool isTimeValid() const
Definition: FTLRecHit.cc:19
void setTimeError(float err)
Definition: FTLRecHit.h:54