Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:15

0001 #include "DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 
0004 EcalPnDiodeDetId::EcalPnDiodeDetId() {}
0005 
0006 EcalPnDiodeDetId::EcalPnDiodeDetId(uint32_t rawid) : DetId(rawid) {}
0007 
0008 EcalPnDiodeDetId::EcalPnDiodeDetId(int EcalSubDetectorId, int DCCId, int PnId) : DetId(Ecal, EcalLaserPnDiode) {
0009   if ((DCCId < MIN_DCCID) || (DCCId > MAX_DCCID) || (PnId < MIN_PNID) || (PnId > MAX_PNID) ||
0010       (EcalSubDetectorId != EcalBarrel && EcalSubDetectorId != EcalEndcap))
0011     throw cms::Exception("InvalidDetId") << "EcalPnDiodeDetId:  Cannot create object.  Indexes out of bounds.";
0012   id_ |= ((((EcalSubDetectorId == EcalBarrel) ? (0) : (1)) << 11) | ((DCCId & 0x7F) << 4) | (PnId & 0xF));
0013 }
0014 
0015 EcalPnDiodeDetId::EcalPnDiodeDetId(const DetId& gen) {
0016   if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalLaserPnDiode)) {
0017     throw cms::Exception("InvalidDetId");
0018   }
0019   id_ = gen.rawId();
0020 }
0021 
0022 EcalPnDiodeDetId& EcalPnDiodeDetId::operator=(const DetId& gen) {
0023   if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalLaserPnDiode)) {
0024     throw cms::Exception("InvalidDetId");
0025   }
0026   id_ = gen.rawId();
0027   return *this;
0028 }
0029 
0030 int EcalPnDiodeDetId::hashedIndex() const { throw cms::Exception("MethodNotImplemented"); }
0031 
0032 std::ostream& operator<<(std::ostream& s, const EcalPnDiodeDetId& id) {
0033   return s << "(EcalPnDiode " << id.iEcalSubDetectorId() << ',' << id.iDCCId() << ',' << id.iPnId() << ')';
0034 }