DataFormats
EcalDetId
src
EcalPnDiodeDetId.cc
Go to the documentation of this file.
1
#include "
DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h
"
2
#include "
FWCore/Utilities/interface/Exception.h
"
3
4
EcalPnDiodeDetId::EcalPnDiodeDetId
() {}
5
6
EcalPnDiodeDetId::EcalPnDiodeDetId
(uint32_t rawid) :
DetId
(rawid) {}
7
8
EcalPnDiodeDetId::EcalPnDiodeDetId
(
int
EcalSubDetectorId,
int
DCCId,
int
PnId) :
DetId
(Ecal,
EcalLaserPnDiode
) {
9
if
((DCCId <
MIN_DCCID
) || (DCCId >
MAX_DCCID
) || (PnId <
MIN_PNID
) || (PnId >
MAX_PNID
) ||
10
(EcalSubDetectorId !=
EcalBarrel
&& EcalSubDetectorId !=
EcalEndcap
))
11
throw
cms::Exception
(
"InvalidDetId"
) <<
"EcalPnDiodeDetId: Cannot create object. Indexes out of bounds."
;
12
id_
|= ((((EcalSubDetectorId ==
EcalBarrel
) ? (0) : (1)) << 11) | ((DCCId & 0x7F) << 4) | (PnId & 0xF));
13
}
14
15
EcalPnDiodeDetId::EcalPnDiodeDetId
(
const
DetId
&
gen
) {
16
if
(!
gen
.null() && (
gen
.det() !=
Ecal
||
gen
.subdetId() !=
EcalLaserPnDiode
)) {
17
throw
cms::Exception
(
"InvalidDetId"
);
18
}
19
id_
=
gen
.rawId();
20
}
21
22
EcalPnDiodeDetId
&
EcalPnDiodeDetId::operator=
(
const
DetId
&
gen
) {
23
if
(!
gen
.null() && (
gen
.det() !=
Ecal
||
gen
.subdetId() !=
EcalLaserPnDiode
)) {
24
throw
cms::Exception
(
"InvalidDetId"
);
25
}
26
id_
=
gen
.rawId();
27
return
*
this
;
28
}
29
30
int
EcalPnDiodeDetId::hashedIndex
()
const
{
throw
cms::Exception
(
"MethodNotImplemented"
); }
31
32
std::ostream&
operator<<
(std::ostream&
s
,
const
EcalPnDiodeDetId
&
id
) {
33
return
s
<<
"(EcalPnDiode "
<<
id
.iEcalSubDetectorId() <<
','
<<
id
.iDCCId() <<
','
<<
id
.iPnId() <<
')'
;
34
}
EcalLaserPnDiode
Definition:
EcalSubdetector.h:10
EcalPnDiodeDetId
Definition:
EcalPnDiodeDetId.h:22
EcalBarrel
Definition:
EcalSubdetector.h:10
DetId
Definition:
DetId.h:17
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
gen
Definition:
PythiaDecays.h:13
EcalPnDiodeDetId::hashedIndex
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
Definition:
EcalPnDiodeDetId.cc:30
operator<<
std::ostream & operator<<(std::ostream &s, const EcalPnDiodeDetId &id)
Definition:
EcalPnDiodeDetId.cc:32
EcalEndcap
Definition:
EcalSubdetector.h:10
EcalPnDiodeDetId::MIN_PNID
static const int MIN_PNID
Definition:
EcalPnDiodeDetId.h:39
EcalPnDiodeDetId.h
DetId::id_
uint32_t id_
Definition:
DetId.h:69
DetId::Ecal
Definition:
DetId.h:27
EcalPnDiodeDetId::EcalPnDiodeDetId
EcalPnDiodeDetId()
Definition:
EcalPnDiodeDetId.cc:4
EcalPnDiodeDetId::operator=
EcalPnDiodeDetId & operator=(const DetId &id)
Definition:
EcalPnDiodeDetId.cc:22
Exception
Definition:
hltDiff.cc:245
Exception.h
EcalPnDiodeDetId::MAX_DCCID
static const int MAX_DCCID
Definition:
EcalPnDiodeDetId.h:36
EcalPnDiodeDetId::MIN_DCCID
static const int MIN_DCCID
Definition:
EcalPnDiodeDetId.h:37
EcalPnDiodeDetId::MAX_PNID
static const int MAX_PNID
Definition:
EcalPnDiodeDetId.h:38
Generated for CMSSW Reference Manual by
1.8.16