CMS 3D CMS Logo

EcalPnDiodeDetId.cc
Go to the documentation of this file.
3 
5 }
6 
7 
8 EcalPnDiodeDetId::EcalPnDiodeDetId(uint32_t rawid) : DetId(rawid) {
9 }
10 
11 EcalPnDiodeDetId::EcalPnDiodeDetId(int EcalSubDetectorId, int DCCId, int PnId) : DetId(Ecal,EcalLaserPnDiode) {
12  if ( (DCCId < MIN_DCCID) || (DCCId > MAX_DCCID) ||
13  (PnId < MIN_PNID) || (PnId > MAX_PNID) ||
14  (EcalSubDetectorId != EcalBarrel && EcalSubDetectorId != EcalEndcap))
15  throw cms::Exception("InvalidDetId") << "EcalPnDiodeDetId: Cannot create object. Indexes out of bounds.";
16  id_|= ((((EcalSubDetectorId==EcalBarrel)?(0):(1))<<11) |
17  ((DCCId&0x7F)<<4) |
18  (PnId&0xF));
19 }
20 
22  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalLaserPnDiode)) {
23  throw cms::Exception("InvalidDetId");
24  }
25  id_=gen.rawId();
26 }
27 
29  if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalLaserPnDiode)) {
30  throw cms::Exception("InvalidDetId");
31  }
32  id_=gen.rawId();
33  return *this;
34 }
35 
37 {
38  throw cms::Exception("MethodNotImplemented");
39 }
40 
41 std::ostream& operator<<(std::ostream& s,const EcalPnDiodeDetId& id) {
42  return s << "(EcalPnDiode " << id.iEcalSubDetectorId() << ',' << id.iDCCId() << ',' << id.iPnId() << ')';
43 }
44 
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
EcalPnDiodeDetId & operator=(const DetId &id)
static const int MIN_DCCID
static const int MAX_PNID
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
static const int MAX_DCCID
Definition: DetId.h:18
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
uint32_t id_
Definition: DetId.h:62
std::ostream & operator<<(std::ostream &s, const EcalPnDiodeDetId &id)
static const int MIN_PNID
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39