CMS 3D CMS Logo

FTLRecHit.cc
Go to the documentation of this file.
2 #include <cassert>
3 #include <cmath>
4 #include <limits>
5 
6 namespace {
7  constexpr float timereso_max = 10000;
8 }
9 
11  : FTLRecHit(DetId(), 0, 0, -1.f, -1.f, -1.f, -1.f, -1.f, std::numeric_limits<unsigned char>::max()) {}
12 
14  uint8_t row,
15  uint8_t column,
16  float energy,
17  float time,
18  float timeError,
19  float position,
20  float positionError,
21  uint32_t flagBits)
22  : id_(id),
23  energy_(energy),
24  time_(time),
25  timeError_(timeError),
26  position_(position),
27  positionError_(positionError),
28  row_(row),
29  column_(column),
30  flagBits_(flagBits) {}
31 
33  const DetId& id, float energy, float time, float timeError, float position, float positionError, uint32_t flagBits)
34  : FTLRecHit(id, 0, 0, energy, time, timeError, position, positionError, flagBits) {}
35 
36 bool FTLRecHit::isTimeValid() const {
37  if (timeError() < 0)
38  return false;
39  else
40  return true;
41 }
42 
44  if (!isTimeValid())
45  return false;
46  if (timeError() >= timereso_max)
47  return false;
48 
49  return true;
50 }
51 
53 bool FTLRecHit::checkFlags(const std::vector<int>& flagsvec) const {
54  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end();
55  ++flagPtr) { // check if one of the flags is up
56  if (checkFlag(*flagPtr))
57  return true;
58  }
59  return false;
60 }
61 
62 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) {
63  if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime)
64  return s << MTDDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
65  else
66  return s << "FTLRecHit undefined subdetector";
67 }
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:53
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:62
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
float timeError() const
Definition: FTLRecHit.h:79
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:43
bool isTimeValid() const
Definition: FTLRecHit.cc:36
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:90
double f[11][100]
Definition: DetId.h:17
static int position[264][3]
Definition: ReadPGInfo.cc:289