CMS 3D CMS Logo

FTLRecHit.cc
Go to the documentation of this file.
3 #include <cassert>
4 #include <cmath>
5 #include <limits>
6 
7 namespace {
8  constexpr float timereso_max = 10000;
9 }
10 
11 FTLRecHit::FTLRecHit() : id_(DetId()), energy_(-1.f), time_(-1.f), timeError_(-1.f), flagBits_(std::numeric_limits<unsigned char>::max())
12 {}
13 
14 FTLRecHit::FTLRecHit(const DetId& id, float energy, float time, float timeError, uint32_t flagBits) :
15  id_(id), energy_(energy), time_(time), timeError_(timeError), flagBits_(flagBits)
16 {}
17 
18 
19 bool FTLRecHit::isTimeValid() const {
20  if(timeError() < 0)
21  return false;
22  else
23  return true;
24 }
25 
27  if(!isTimeValid())
28  return false;
29  if(timeError() >= timereso_max)
30  return false;
31 
32  return true;
33 }
34 
36 bool FTLRecHit::checkFlags(const std::vector<int>& flagsvec ) const {
37 
38  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
39  flagPtr!= flagsvec.end(); ++flagPtr) { // check if one of the flags is up
40  if (checkFlag(*flagPtr)) return true;
41  }
42  return false;
43 }
44 
45 
46 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) {
47  if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime)
48  return s << FastTimeDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
49  else
50  return s << "FTLRecHit undefined subdetector" ;
51 }
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
float timeError() const
Definition: FTLRecHit.h:53
float energy() const
get the id
Definition: FTLRecHit.h:41
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:46
#define constexpr
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
float time() const
Definition: FTLRecHit.h:47
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
double f[11][100]
float timeError_
Definition: FTLRecHit.h:70
float energy_
Definition: FTLRecHit.h:70
DetId id_
Definition: FTLRecHit.h:69
Definition: DetId.h:18
bool isTimeValid() const
Definition: FTLRecHit.cc:19
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39