Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include "DataFormats/HcalDetId/interface/HcalOtherDetId.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <iostream>
HcalOtherDetId::HcalOtherDetId() {}

HcalOtherDetId::HcalOtherDetId(uint32_t rawid) : DetId(rawid) {}

HcalOtherDetId::HcalOtherDetId(HcalOtherSubdetector other_type) : DetId(Hcal, HcalOther) {
  id_ |= (int(other_type & 0x1F) << 20);
}

HcalOtherDetId::HcalOtherDetId(const DetId& gen) {
  if (gen.det() != Hcal || gen.subdetId() != HcalOther) {
    throw cms::Exception("Invalid DetId")
        << "Cannot initialize HcalOtherDetId from " << std::hex << gen.rawId() << std::dec;
  }
  id_ = gen.rawId();
}

HcalOtherDetId& HcalOtherDetId::operator=(const DetId& gen) {
  if (gen.det() != Hcal || gen.subdetId() != HcalOther) {
    throw cms::Exception("Invalid DetId")
        << "Cannot assign HcalOtherDetId from " << std::hex << gen.rawId() << std::dec;
  }
  id_ = gen.rawId();
  return *this;
}