CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloHitID.cc
Go to the documentation of this file.
1 // File: CaloHitID.cc
3 // Description: Identifier for a calorimetric hit
6 
7 #include <iomanip>
8 
9 CaloHitID::CaloHitID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth, float tSlice, bool ignoreTkID)
10  : timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID), isFinecaloTrackID_(false) {
11  setID(unitID, timeSlice, trackID, depth);
12 }
13 
14 CaloHitID::CaloHitID(float tSlice, bool ignoreTkID) : timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID) { reset(); }
15 
17  theUnitID = id.theUnitID;
18  theTimeSlice = id.theTimeSlice;
19  theTrackID = id.theTrackID;
20  theTimeSliceID = id.theTimeSliceID;
21  theDepth = id.theDepth;
22  timeSliceUnit = id.timeSliceUnit;
23  ignoreTrackID = id.ignoreTrackID;
24  isFinecaloTrackID_ = id.isFinecaloTrackID_;
25 }
26 
28  theUnitID = id.theUnitID;
29  theTimeSlice = id.theTimeSlice;
30  theTrackID = id.theTrackID;
31  theTimeSliceID = id.theTimeSliceID;
32  theDepth = id.theDepth;
33  timeSliceUnit = id.timeSliceUnit;
34  ignoreTrackID = id.ignoreTrackID;
35  isFinecaloTrackID_ = id.isFinecaloTrackID_;
36  return *this;
37 }
38 
40 
41 void CaloHitID::setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth) {
42  theUnitID = unitID;
46  theDepth = depth;
47 }
48 
50  theUnitID = 0;
52  theTrackID = -2;
54  theDepth = 0;
55  isFinecaloTrackID_ = false;
56 }
57 
58 bool CaloHitID::operator==(const CaloHitID& id) const {
59  return ((theUnitID == id.unitID()) && (theTrackID == id.trackID() || ignoreTrackID) &&
60  (theTimeSliceID == id.timeSliceID()) && (theDepth == id.depth()))
61  ? true
62  : false;
63 }
64 
65 bool CaloHitID::operator<(const CaloHitID& id) const {
66  if (theTrackID != id.trackID()) {
67  return (theTrackID > id.trackID());
68  } else if (theUnitID != id.unitID()) {
69  return (theUnitID > id.unitID());
70  } else if (theDepth != id.depth()) {
71  return (theDepth > id.depth());
72  } else {
73  return (theTimeSliceID > id.timeSliceID());
74  }
75 }
76 
77 bool CaloHitID::operator>(const CaloHitID& id) const {
78  if (theTrackID != id.trackID()) {
79  return (theTrackID < id.trackID());
80  } else if (theUnitID != id.unitID()) {
81  return (theUnitID < id.unitID());
82  } else if (theDepth != id.depth()) {
83  return (theDepth < id.depth());
84  } else {
85  return (theTimeSliceID < id.timeSliceID());
86  }
87 }
88 
89 std::ostream& operator<<(std::ostream& os, const CaloHitID& id) {
90  os << "UnitID 0x" << std::hex << id.unitID() << std::dec << " Depth " << std::setw(6) << id.depth() << " Time "
91  << std::setw(6) << id.timeSlice() << " TrackID " << std::setw(8) << id.trackID();
92  return os;
93 }
bool operator<(const CaloHitID &) const
Definition: CaloHitID.cc:65
bool ignoreTrackID
Definition: CaloHitID.h:43
uint32_t theUnitID
Definition: CaloHitID.h:37
bool operator>(const CaloHitID &) const
Definition: CaloHitID.cc:77
double theTimeSlice
Definition: CaloHitID.h:38
double timeSlice() const
Definition: CaloHitID.h:22
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
uint16_t depth() const
Definition: CaloHitID.h:24
CaloHitID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0, float tSlice=1, bool ignoreTkID=false)
Definition: CaloHitID.cc:9
void reset()
Definition: CaloHitID.cc:49
uint16_t theDepth
Definition: CaloHitID.h:41
int timeSliceID() const
Definition: CaloHitID.h:21
bool operator==(const CaloHitID &) const
Definition: CaloHitID.cc:58
int trackID() const
Definition: CaloHitID.h:23
float timeSliceUnit
Definition: CaloHitID.h:42
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:41
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
const CaloHitID & operator=(const CaloHitID &)
Definition: CaloHitID.cc:27
virtual ~CaloHitID()
Definition: CaloHitID.cc:39
int theTimeSliceID
Definition: CaloHitID.h:40
bool isFinecaloTrackID_
Definition: CaloHitID.h:44
int theTrackID
Definition: CaloHitID.h:39
uint32_t unitID() const
Definition: CaloHitID.h:20