CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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,
10  uint16_t depth, float tSlice, bool ignoreTkID) :
11  timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID) {
12  setID(unitID, timeSlice, trackID, depth);
13 }
14 
15 CaloHitID::CaloHitID(float tSlice, bool ignoreTkID) :
16  timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID) {
17  reset();
18 }
19 
21  theUnitID = id.theUnitID;
22  theTimeSlice = id.theTimeSlice;
23  theTrackID = id.theTrackID;
24  theTimeSliceID = id.theTimeSliceID;
25  theDepth = id.theDepth;
26  timeSliceUnit = id.timeSliceUnit;
27  ignoreTrackID = id.ignoreTrackID;
28 }
29 
31  theUnitID = id.theUnitID;
32  theTimeSlice = id.theTimeSlice;
33  theTrackID = id.theTrackID;
34  theTimeSliceID = id.theTimeSliceID;
35  theDepth = id.theDepth;
36  timeSliceUnit = id.timeSliceUnit;
37  ignoreTrackID = id.ignoreTrackID;
38 
39  return *this;
40 }
41 
43 
44 void CaloHitID::setID(uint32_t unitID, double timeSlice, int trackID,
45  uint16_t depth) {
46  theUnitID = unitID;
50  theDepth = depth;
51 }
52 
54  theUnitID = 0;
56  theTrackID =-2;
58  theDepth = 0;
59 }
60 
61 bool CaloHitID::operator==(const CaloHitID& id) const {
62  return ((theUnitID == id.unitID()) &&
63  (theTrackID == id.trackID() || ignoreTrackID) &&
64  (theTimeSliceID == id.timeSliceID()) &&
65  (theDepth == id.depth())) ? true : false;
66 }
67 
68 bool CaloHitID::operator<(const CaloHitID& id) const {
69  if (theTrackID != id.trackID()) {
70  return (theTrackID > id.trackID());
71  } else if (theUnitID != id.unitID()) {
72  return (theUnitID > id.unitID());
73  } else if (theDepth != id.depth()) {
74  return (theDepth > id.depth());
75  } else {
76  return (theTimeSliceID > id.timeSliceID());
77  }
78 }
79 
80 bool CaloHitID::operator>(const CaloHitID& id) const {
81  if (theTrackID != id.trackID()) {
82  return (theTrackID < id.trackID());
83  } else if (theUnitID != id.unitID()) {
84  return (theUnitID < id.unitID());
85  } else if (theDepth != id.depth()) {
86  return (theDepth < id.depth());
87  } else {
88  return (theTimeSliceID < id.timeSliceID());
89  }
90 }
91 
92 std::ostream& operator<<(std::ostream& os, const CaloHitID& id) {
93  os << "UnitID 0x" << std::hex << id.unitID() << std::dec << " Depth "
94  << std::setw(6) << id.depth() << " Time " << std::setw(6)
95  << id.timeSlice() << " TrackID " << std::setw(8) << id.trackID();
96  return os;
97 }
bool operator<(const CaloHitID &) const
Definition: CaloHitID.cc:68
bool ignoreTrackID
Definition: CaloHitID.h:43
uint32_t theUnitID
Definition: CaloHitID.h:37
bool operator>(const CaloHitID &) const
Definition: CaloHitID.cc:80
double theTimeSlice
Definition: CaloHitID.h:38
double timeSlice() const
Definition: CaloHitID.h:24
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
uint16_t depth() const
Definition: CaloHitID.h:26
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:53
uint16_t theDepth
Definition: CaloHitID.h:41
int timeSliceID() const
Definition: CaloHitID.h:23
bool operator==(const CaloHitID &) const
Definition: CaloHitID.cc:61
int trackID() const
Definition: CaloHitID.h:25
float timeSliceUnit
Definition: CaloHitID.h:42
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
const CaloHitID & operator=(const CaloHitID &)
Definition: CaloHitID.cc:30
virtual ~CaloHitID()
Definition: CaloHitID.cc:42
int theTimeSliceID
Definition: CaloHitID.h:40
int theTrackID
Definition: CaloHitID.h:39
uint32_t unitID() const
Definition: CaloHitID.h:22