CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
12  : FTLRecHit(DetId(), 0, 0, -1.f, -1.f, -1.f, -1.f, -1.f, std::numeric_limits<unsigned char>::max()) {}
13 
15  uint8_t row,
16  uint8_t column,
17  float energy,
18  float time,
19  float timeError,
20  float position,
21  float positionError,
22  uint32_t flagBits)
23  : id_(id),
24  energy_(energy),
25  time_(time),
26  timeError_(timeError),
27  position_(position),
28  positionError_(positionError),
29  row_(row),
30  column_(column),
31  flagBits_(flagBits) {}
32 
34  const DetId& id, float energy, float time, float timeError, float position, float positionError, uint32_t flagBits)
35  : FTLRecHit(id, 0, 0, energy, time, timeError, position, positionError, flagBits) {}
36 
37 bool FTLRecHit::isTimeValid() const {
38  if (timeError() < 0)
39  return false;
40  else
41  return true;
42 }
43 
45  if (!isTimeValid())
46  return false;
47  if (timeError() >= timereso_max)
48  return false;
49 
50  return true;
51 }
52 
54 bool FTLRecHit::checkFlags(const std::vector<int>& flagsvec) const {
55  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end();
56  ++flagPtr) { // check if one of the flags is up
57  if (checkFlag(*flagPtr))
58  return true;
59  }
60  return false;
61 }
62 
63 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) {
64  if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime)
65  return s << FastTimeDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
66  else
67  return s << "FTLRecHit undefined subdetector";
68 }
const DetId & detid() const
Definition: FTLRecHit.h:63
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:90
float timeError() const
Definition: FTLRecHit.h:79
float energy() const
get the id
Definition: FTLRecHit.h:59
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:44
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:54
float time() const
Definition: FTLRecHit.h:70
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
static int position[264][3]
Definition: ReadPGInfo.cc:289
bool isTimeValid() const
Definition: FTLRecHit.cc:37
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46