Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/HcalDetId/interface/HcalOtherDetId.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #include <iostream>
0004 HcalOtherDetId::HcalOtherDetId() {}
0005 
0006 HcalOtherDetId::HcalOtherDetId(uint32_t rawid) : DetId(rawid) {}
0007 
0008 HcalOtherDetId::HcalOtherDetId(HcalOtherSubdetector other_type) : DetId(Hcal, HcalOther) {
0009   id_ |= (int(other_type & 0x1F) << 20);
0010 }
0011 
0012 HcalOtherDetId::HcalOtherDetId(const DetId& gen) {
0013   if (gen.det() != Hcal || gen.subdetId() != HcalOther) {
0014     throw cms::Exception("Invalid DetId")
0015         << "Cannot initialize HcalOtherDetId from " << std::hex << gen.rawId() << std::dec;
0016   }
0017   id_ = gen.rawId();
0018 }
0019 
0020 HcalOtherDetId& HcalOtherDetId::operator=(const DetId& gen) {
0021   if (gen.det() != Hcal || gen.subdetId() != HcalOther) {
0022     throw cms::Exception("Invalid DetId")
0023         << "Cannot assign HcalOtherDetId from " << std::hex << gen.rawId() << std::dec;
0024   }
0025   id_ = gen.rawId();
0026   return *this;
0027 }