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 
12  : id_(DetId()),
13  energy_(-1.f),
14  time_(-1.f),
15  timeError_(-1.f),
16  row_(0),
17  column_(0),
18  flagBits_(std::numeric_limits<unsigned char>::max()) {}
19 
20 FTLRecHit::FTLRecHit(const DetId& id, float energy, float time, float timeError, uint32_t flagBits)
21  : id_(id), energy_(energy), time_(time), timeError_(timeError), row_(0), column_(0), flagBits_(flagBits) {}
22 
24  const DetId& id, uint8_t row, uint8_t column, float energy, float time, float timeError, uint32_t flagBits)
25  : id_(id), energy_(energy), time_(time), timeError_(timeError), row_(row), column_(column), flagBits_(flagBits) {}
26 
27 bool FTLRecHit::isTimeValid() const {
28  if (timeError() < 0)
29  return false;
30  else
31  return true;
32 }
33 
35  if (!isTimeValid())
36  return false;
37  if (timeError() >= timereso_max)
38  return false;
39 
40  return true;
41 }
42 
44 bool FTLRecHit::checkFlags(const std::vector<int>& flagsvec) const {
45  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end();
46  ++flagPtr) { // check if one of the flags is up
47  if (checkFlag(*flagPtr))
48  return true;
49  }
50  return false;
51 }
52 
53 std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) {
54  if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime)
55  return s << FastTimeDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns";
56  else
57  return s << "FTLRecHit undefined subdetector";
58 }
FTLRecHit
Definition: FTLRecHit.h:15
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FastTimeDetId.h
FTLRecHit::FTLRecHit
FTLRecHit()
Definition: FTLRecHit.cc:11
FTLRecHit::isTimeErrorValid
bool isTimeErrorValid() const
Definition: FTLRecHit.cc:34
operator<<
std::ostream & operator<<(std::ostream &s, const FTLRecHit &hit)
Definition: FTLRecHit.cc:53
FTLRecHit::checkFlag
bool checkFlag(int flag) const
check if the flag is true
Definition: FTLRecHit.h:71
FTLRecHit::timeError
float timeError() const
Definition: FTLRecHit.h:63
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
FTLRecHit.h
FTLRecHit::checkFlags
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: FTLRecHit.cc:44
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FastTime
Definition: ForwardSubdetector.h:6
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
FastTimeDetId
Definition: FastTimeDetId.h:8
FTLRecHit::isTimeValid
bool isTimeValid() const
Definition: FTLRecHit.cc:27
DetId::Forward
Definition: DetId.h:30
ntuplemaker.time
time
Definition: ntuplemaker.py:310
hit
Definition: SiStripHitEffFromCalibTree.cc:88