Skip to content

Commit

Permalink
Merge CMSSW_9_4_X into CMSSW_9_4_AN_X.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Jul 3, 2018
2 parents ec36d29 + 71925d8 commit 77b9f8c
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions DataFormats/HcalDetId/src/HcalDetId.cc
Expand Up @@ -8,7 +8,18 @@ const HcalDetId HcalDetId::Undefined(HcalEmpty,0,0,0);
HcalDetId::HcalDetId() : DetId() {
}

HcalDetId::HcalDetId(uint32_t rawid) : DetId(newForm(rawid)) {
HcalDetId::HcalDetId(uint32_t rawid) {
if ((DetId::Detector(rawid>>DetId::kDetOffset)&0xF) != Hcal) {
id_ = rawid;
} else {
HcalSubdetector subdet = (HcalSubdetector)((rawid>>DetId::kSubdetOffset)&0x7);
if ((subdet==HcalBarrel) || (subdet==HcalEndcap) ||
(subdet==HcalOuter) || (subdet==HcalForward)) {
id_ = newForm(rawid);
} else {
id_ = rawid;
}
}
}

HcalDetId::HcalDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth) : DetId(Hcal,subdet) {
Expand All @@ -27,7 +38,12 @@ HcalDetId::HcalDetId(const DetId& gen) {
subdet!=HcalTriggerTower && subdet!=HcalOther)) {
throw cms::Exception("Invalid DetId") << "Cannot initialize HcalDetId from " << std::hex << gen.rawId() << std::dec;
}
id_ = newForm(gen.rawId());
if ((subdet==HcalBarrel) || (subdet==HcalEndcap) ||
(subdet==HcalOuter) || (subdet==HcalForward)) {
id_ = newForm(gen.rawId());
} else {
id_ = gen.rawId();
}
} else {
id_ = gen.rawId();
}
Expand All @@ -42,7 +58,12 @@ HcalDetId& HcalDetId::operator=(const DetId& gen) {
subdet!=HcalTriggerTower && subdet!=HcalOther)) {
throw cms::Exception("Invalid DetId") << "Cannot assign HcalDetId from " << std::hex << gen.rawId() << std::dec;
}
id_ = newForm(gen.rawId());
if ((subdet==HcalBarrel) || (subdet==HcalEndcap) ||
(subdet==HcalOuter) || (subdet==HcalForward)) {
id_ = newForm(gen.rawId());
} else {
id_ = gen.rawId();
}
} else {
id_ = gen.rawId();
}
Expand Down Expand Up @@ -236,7 +257,7 @@ std::ostream& operator<<(std::ostream& s,const HcalDetId& id) {
case(HcalForward) : return s << "(HF " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ')';
case(HcalOuter) : return s << "(HO " << id.ieta() << ',' << id.iphi() << ')';
case(HcalTriggerTower) : return s << "(HT " << id.ieta() << ',' << id.iphi() << ')';
default : return s << id.rawId();
default : return s << std::hex << id.rawId() << std::dec;
}
}

Expand Down

0 comments on commit 77b9f8c

Please sign in to comment.