src
DataFormats
CaloTowers
src
CaloTowerDetId.cc
Go to the documentation of this file.
1
#include "
DataFormats/CaloTowers/interface/CaloTowerDetId.h
"
2
#include "
FWCore/Utilities/interface/Exception.h
"
3
#include <iostream>
4
5
CaloTowerDetId::CaloTowerDetId
() :
DetId
() {}
6
7
CaloTowerDetId::CaloTowerDetId
(uint32_t rawid) :
DetId
(rawid & 0xFFF0FFFFu) {}
8
9
CaloTowerDetId::CaloTowerDetId
(
int
ieta
,
int
iphi
) :
DetId
(
Calo
, SubdetId) {
10
id_
|= ((
ieta
> 0) ? (0x2000 | ((
ieta
& 0x3F) << 7)) : (((-
ieta
) & 0x3f) << 7)) | (
iphi
& 0x7F);
11
}
12
13
CaloTowerDetId::CaloTowerDetId
(
const
DetId
&
gen
) {
14
if
(!
gen
.null() && (
gen
.det() !=
Calo
||
gen
.subdetId() !=
SubdetId
)) {
15
throw
cms::Exception
(
"Invalid DetId"
)
16
<<
"Cannot initialize CaloTowerDetId from "
<< std::hex <<
gen
.rawId() <<
std::dec
;
17
}
18
id_
=
gen
.rawId();
19
}
20
21
CaloTowerDetId
&
CaloTowerDetId::operator=
(
const
DetId
&
gen
) {
22
if
(!
gen
.null() && (
gen
.det() !=
Calo
||
gen
.subdetId() !=
SubdetId
)) {
23
throw
cms::Exception
(
"Invalid DetId"
)
24
<<
"Cannot assign CaloTowerDetId from "
<< std::hex <<
gen
.rawId() <<
std::dec
;
25
}
26
id_
=
gen
.rawId();
27
return
*
this
;
28
}
29
30
int
CaloTowerDetId::iphi
()
const
{
31
int
retval =
id_
& 0x7F;
32
return
retval;
33
}
34
35
std::ostream&
operator<<
(std::ostream&
s
,
const
CaloTowerDetId
&
id
) {
36
return
s
<<
"Tower ("
<<
id
.ieta() <<
","
<<
id
.iphi() <<
")"
;
37
}
operator<<
std::ostream & operator<<(std::ostream &s, const CaloTowerDetId &id)
Definition:
CaloTowerDetId.cc:35
DetId::Calo
Definition:
DetId.h:29
Exception
Definition:
hltDiff.cc:245
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
hcalRecHitTable_cff.ieta
ieta
Definition:
hcalRecHitTable_cff.py:15
CaloTowerDetId::operator=
CaloTowerDetId & operator=(const DetId &id)
Definition:
CaloTowerDetId.cc:21
CaloTowerDetId::SubdetId
static const int SubdetId
Definition:
CaloTowerDetId.h:34
CaloTowerDetId
Definition:
CaloTowerDetId.h:12
gen
Definition:
PythiaDecays.h:13
hcalRecHitTable_cff.iphi
iphi
Definition:
hcalRecHitTable_cff.py:16
CaloTowerDetId.h
DetId
Definition:
DetId.h:17
Exception.h
CaloTowerDetId::iphi
int iphi() const
get the tower iphi
Definition:
CaloTowerDetId.cc:30
DetId::id_
uint32_t id_
Definition:
DetId.h:69
CaloTowerDetId::CaloTowerDetId
CaloTowerDetId()
Definition:
CaloTowerDetId.cc:5
CaloTowerDetId::ieta
int ieta() const
get the tower ieta
Definition:
CaloTowerDetId.h:30
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:142
dumpRecoGeometry_cfg.Calo
Calo
Definition:
dumpRecoGeometry_cfg.py:227
Generated for CMSSW Reference Manual by
1.8.14