SimG4CMS
Calo
src
CaloHitID.cc
Go to the documentation of this file.
1
// File: CaloHitID.cc
3
// Description: Identifier for a calorimetric hit
5
#include "
SimG4CMS/Calo/interface/CaloHitID.h
"
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), theFineTrackID(-1) {
11
setID
(
unitID
,
timeSlice
,
trackID
,
depth
);
12
}
13
14
CaloHitID::CaloHitID
(
float
tSlice,
bool
ignoreTkID) : timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID) {
reset
(); }
15
16
CaloHitID::CaloHitID
(
const
CaloHitID
&
id
) {
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
theFineTrackID
=
id
.theFineTrackID;
25
}
26
27
const
CaloHitID
&
CaloHitID::operator=
(
const
CaloHitID
&
id
) {
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
theFineTrackID
=
id
.theFineTrackID;
36
return
*
this
;
37
}
38
39
CaloHitID::~CaloHitID
() {}
40
41
void
CaloHitID::setID
(uint32_t unitID,
double
timeSlice
,
int
trackID, uint16_t
depth
) {
42
theUnitID
=
unitID
;
43
theTimeSlice
=
timeSlice
;
44
theTrackID
=
trackID
;
45
theTimeSliceID
= (
int
)(
theTimeSlice
/
timeSliceUnit
);
46
theDepth
=
depth
;
47
}
48
49
void
CaloHitID::reset
() {
50
theUnitID
= 0;
51
theTimeSlice
= -2 *
timeSliceUnit
;
52
theTrackID
= -2;
53
theTimeSliceID
= (
int
)(
theTimeSlice
/
timeSliceUnit
);
54
theDepth
= 0;
55
theFineTrackID
= -1;
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
()) && (
fineTrackID
() ==
id
.
fineTrackID
()))
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
(
fineTrackID
() !=
id
.
fineTrackID
()) {
69
return
(
fineTrackID
() >
id
.
fineTrackID
());
70
}
else
if
(
theUnitID
!=
id
.
unitID
()) {
71
return
(
theUnitID
>
id
.
unitID
());
72
}
else
if
(
theDepth
!=
id
.
depth
()) {
73
return
(
theDepth
>
id
.
depth
());
74
}
else
{
75
return
(
theTimeSliceID
>
id
.
timeSliceID
());
76
}
77
}
78
79
bool
CaloHitID::operator>
(
const
CaloHitID
&
id
)
const
{
80
if
(
theTrackID
!=
id
.
trackID
()) {
81
return
(
theTrackID
<
id
.
trackID
());
82
}
else
if
(
fineTrackID
() !=
id
.
fineTrackID
()) {
83
return
(
fineTrackID
() <
id
.
fineTrackID
());
84
}
else
if
(
theUnitID
!=
id
.
unitID
()) {
85
return
(
theUnitID
<
id
.
unitID
());
86
}
else
if
(
theDepth
!=
id
.
depth
()) {
87
return
(
theDepth
<
id
.
depth
());
88
}
else
{
89
return
(
theTimeSliceID
<
id
.
timeSliceID
());
90
}
91
}
92
93
std::ostream&
operator<<
(std::ostream& os,
const
CaloHitID
&
id
) {
94
os <<
"UnitID 0x"
<< std::hex <<
id
.unitID() <<
std::dec
<<
" Depth "
<< std::setw(6) <<
id
.depth() <<
" Time "
95
<< std::setw(6) <<
id
.timeSlice() <<
" TrackID "
<< std::setw(8) <<
id
.trackID();
96
if
(
id
.hasFineTrackID())
97
os <<
" fineTrackID "
<<
id
.fineTrackID();
98
return
os;
99
}
CaloHitID::operator=
const CaloHitID & operator=(const CaloHitID &)
Definition:
CaloHitID.cc:27
CaloHitID::depth
uint16_t depth() const
Definition:
CaloHitID.h:24
CaloHitID::operator>
bool operator>(const CaloHitID &) const
Definition:
CaloHitID.cc:79
CaloHitID::theDepth
uint16_t theDepth
Definition:
CaloHitID.h:42
CaloHitID::operator<
bool operator<(const CaloHitID &) const
Definition:
CaloHitID.cc:65
CaloHitID::trackID
int trackID() const
Definition:
CaloHitID.h:23
CaloHitID.h
CaloHitID::unitID
uint32_t unitID() const
Definition:
CaloHitID.h:20
CaloHitID::theFineTrackID
int theFineTrackID
Definition:
CaloHitID.h:45
CaloHitID::timeSliceUnit
float timeSliceUnit
Definition:
CaloHitID.h:43
CaloHitID::setID
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition:
CaloHitID.cc:41
CaloHitID::timeSlice
double timeSlice() const
Definition:
CaloHitID.h:22
LEDCalibrationChannels.depth
depth
Definition:
LEDCalibrationChannels.py:65
CaloHitID::~CaloHitID
virtual ~CaloHitID()
Definition:
CaloHitID.cc:39
funct::true
true
Definition:
Factorize.h:173
CaloHitID::theTimeSlice
double theTimeSlice
Definition:
CaloHitID.h:39
CaloHitID::theTrackID
int theTrackID
Definition:
CaloHitID.h:40
CaloHitID::theTimeSliceID
int theTimeSliceID
Definition:
CaloHitID.h:41
createfilelist.int
int
Definition:
createfilelist.py:10
CaloHitID::ignoreTrackID
bool ignoreTrackID
Definition:
CaloHitID.h:44
CaloHitID::operator==
bool operator==(const CaloHitID &) const
Definition:
CaloHitID.cc:58
operator<<
std::ostream & operator<<(std::ostream &os, const CaloHitID &id)
Definition:
CaloHitID.cc:93
CaloHitID::timeSliceID
int timeSliceID() const
Definition:
CaloHitID.h:21
CaloHitID::reset
void reset()
Definition:
CaloHitID.cc:49
CaloHitID
Definition:
CaloHitID.h:11
CaloHitID::fineTrackID
int fineTrackID() const
Definition:
CaloHitID.h:31
cscdqm::timeSlice
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
Definition:
CSCDQM_EventProcessor_processCSC.cc:29
CaloHitID::CaloHitID
CaloHitID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0, float tSlice=1, bool ignoreTkID=false)
Definition:
CaloHitID.cc:9
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:142
CaloHitID::theUnitID
uint32_t theUnitID
Definition:
CaloHitID.h:38
Generated for CMSSW Reference Manual by
1.8.16