SimG4CMS
HGCalTestBeam
src
AHCalDetId.cc
Go to the documentation of this file.
1
#include "
SimG4CMS/HGCalTestBeam/interface/AHCalDetId.h
"
2
#include <ostream>
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
5
const
AHCalDetId
AHCalDetId::Undefined
(0, 0, 0);
6
7
AHCalDetId::AHCalDetId
() :
DetId
() {}
8
9
AHCalDetId::AHCalDetId
(uint32_t rawid) :
DetId
(rawid) {}
10
11
AHCalDetId::AHCalDetId
(
int
row,
int
col
,
int
depth
) :
DetId
(Hcal,
HcalOther
) {
12
int
icol
= (
col
> 0) ?
col
:
kMaxRowCol
-
col
;
13
int
irow
= (row > 0) ? row :
kMaxRowCol
- row;
14
id_
|= ((
depth
&
kHcalDepthMask
) <<
HcalDetId::kHcalDepthOffset1
) | (
HcalDetId::kHcalZsideMask1
) |
15
((
irow
&
HcalDetId::kHcalEtaMask1
) <<
HcalDetId::kHcalEtaOffset1
) | (
icol
&
HcalDetId::kHcalPhiMask1
);
16
}
17
18
AHCalDetId::AHCalDetId
(
const
DetId
&
gen
) {
19
if
(!
gen
.null()) {
20
HcalSubdetector
subdet
= (
HcalSubdetector
(
gen
.subdetId()));
21
if
(
gen
.det() !=
Hcal
||
subdet
!=
HcalOther
) {
22
throw
cms::Exception
(
"Invalid DetId"
)
23
<<
"Cannot initialize AHCalDetId from "
<< std::hex <<
gen
.rawId() <<
std::dec
;
24
}
25
}
26
id_
=
gen
.rawId();
27
}
28
29
int
AHCalDetId::irow
()
const
{
30
int
value
= ((
id_
>>
HcalDetId::kHcalEtaOffset1
) &
HcalDetId::kHcalEtaMask1
);
31
if
(
value
>=
kMaxRowCol
)
32
value
= (
kMaxRowCol
-
value
);
33
return
value
;
34
}
35
36
int
AHCalDetId::icol
()
const
{
37
int
value
= (
id_
&
HcalDetId::kHcalPhiMask1
);
38
if
(
value
>=
kMaxRowCol
)
39
value
= (
kMaxRowCol
-
value
);
40
return
value
;
41
}
42
43
int
AHCalDetId::depth
()
const
{
return
((
id_
>>
HcalDetId::kHcalDepthOffset1
) &
kHcalDepthMask
); }
44
45
std::ostream&
operator<<
(std::ostream&
s
,
const
AHCalDetId
&
id
) {
46
return
s
<<
"(AHCal "
<<
id
.irow() <<
','
<<
id
.icol() <<
','
<<
id
.depth() <<
')'
;
47
}
HcalOther
Definition:
HcalAssistant.h:38
HcalDetId::kHcalDepthOffset1
static constexpr uint32_t kHcalDepthOffset1
Definition:
HcalDetId.h:22
AHCalDetId::irow
int irow() const
get the row number
Definition:
AHCalDetId.cc:29
HcalDetId::kHcalEtaOffset1
static constexpr uint32_t kHcalEtaOffset1
Definition:
HcalDetId.h:16
AHCalDetId::AHCalDetId
AHCalDetId()
Definition:
AHCalDetId.cc:7
cuy.col
col
Definition:
cuy.py:1010
DetId::Hcal
Definition:
DetId.h:28
AHCalDetId::Undefined
static const AHCalDetId Undefined
Definition:
AHCalDetId.h:42
AHCalDetId::subdet
HcalSubdetector subdet() const
get the subdetector
Definition:
AHCalDetId.h:30
AHCalDetId::kMaxRowCol
static constexpr int kMaxRowCol
Definition:
AHCalDetId.h:45
DetId
Definition:
DetId.h:17
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
AHCalDetId::depth
int depth() const
get the layer number
Definition:
AHCalDetId.cc:43
AHCalDetId::icol
int icol() const
get the column number
Definition:
AHCalDetId.cc:36
operator<<
std::ostream & operator<<(std::ostream &s, const AHCalDetId &id)
Definition:
AHCalDetId.cc:45
gen
Definition:
PythiaDecays.h:13
LEDCalibrationChannels.depth
depth
Definition:
LEDCalibrationChannels.py:65
AHCalDetId
Definition:
AHCalDetId.h:13
DetId::id_
uint32_t id_
Definition:
DetId.h:69
value
Definition:
value.py:1
HcalDetId::kHcalZsideMask1
static constexpr uint32_t kHcalZsideMask1
Definition:
HcalDetId.h:20
AHCalDetId::kHcalDepthMask
static constexpr uint32_t kHcalDepthMask
Definition:
AHCalDetId.h:46
HcalSubdetector
HcalSubdetector
Definition:
HcalAssistant.h:31
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
Exception
Definition:
hltDiff.cc:245
Exception.h
HcalDetId::kHcalEtaMask1
static constexpr uint32_t kHcalEtaMask1
Definition:
HcalDetId.h:18
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:143
AHCalDetId.h
HcalDetId::kHcalPhiMask1
static constexpr uint32_t kHcalPhiMask1
Definition:
HcalDetId.h:14
Generated for CMSSW Reference Manual by
1.8.16