CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DataFormats/EcalDetId/src/EcalPnDiodeDetId.cc

Go to the documentation of this file.
00001 #include "DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003 
00004 EcalPnDiodeDetId::EcalPnDiodeDetId() {
00005 }
00006   
00007   
00008 EcalPnDiodeDetId::EcalPnDiodeDetId(uint32_t rawid) : DetId(rawid) {
00009 }
00010   
00011 EcalPnDiodeDetId::EcalPnDiodeDetId(int EcalSubDetectorId, int DCCId, int PnId) : DetId(Ecal,EcalLaserPnDiode) {
00012   if ( (DCCId < MIN_DCCID) || (DCCId > MAX_DCCID) ||  
00013        (PnId < MIN_PNID) || (PnId > MAX_PNID) ||  
00014        (EcalSubDetectorId != EcalBarrel && EcalSubDetectorId != EcalEndcap))
00015     throw cms::Exception("InvalidDetId") << "EcalPnDiodeDetId:  Cannot create object.  Indexes out of bounds.";
00016   id_|= ((((EcalSubDetectorId==EcalBarrel)?(0):(1))<<11) | 
00017         ((DCCId&0x7F)<<4) |
00018         (PnId&0xF));
00019 }
00020   
00021 EcalPnDiodeDetId::EcalPnDiodeDetId(const DetId& gen) {
00022   if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalLaserPnDiode)) {
00023     throw cms::Exception("InvalidDetId");
00024   }
00025   id_=gen.rawId();
00026 }
00027   
00028 EcalPnDiodeDetId& EcalPnDiodeDetId::operator=(const DetId& gen) {
00029   if (!gen.null() && ( gen.det()!=Ecal || gen.subdetId()!=EcalLaserPnDiode)) {
00030     throw cms::Exception("InvalidDetId");
00031   }
00032   id_=gen.rawId();
00033   return *this;
00034 }
00035 
00036 int EcalPnDiodeDetId::hashedIndex() const
00037 {
00038   throw cms::Exception("MethodNotImplemented");
00039 }    
00040 
00041 std::ostream& operator<<(std::ostream& s,const EcalPnDiodeDetId& id) {
00042   return s << "(EcalPnDiode " << id.iEcalSubDetectorId() << ',' << id.iDCCId() << ',' << id.iPnId() << ')';
00043 }
00044