Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
0002 #include "DataFormats/HcalRecHit/interface/HBHERecHitAuxSetter.h"
0003 #include "DataFormats/HcalRecHit/interface/CaloRecHitAuxSetter.h"
0004 
0005 HcalDetId HBHERecHit::idFront() const {
0006   if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) {
0007     const HcalDetId myId(id());
0008     return HcalDetId(myId.subdet(), myId.ieta(), myId.iphi(), auxHBHE_ & 0xf);
0009   } else {
0010     return id();
0011   }
0012 }
0013 
0014 bool HBHERecHit::isMerged() const { return auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED); }
0015 
0016 std::ostream& operator<<(std::ostream& s, const HBHERecHit& hit) {
0017   s << hit.id() << ": " << hit.energy() << " GeV";
0018   if (hit.eraw() > -0.9e21) {
0019     s << ", eraw=" << hit.eraw() << " GeV";
0020   }
0021   if (hit.eaux() > -0.9e21) {
0022     s << ", eaux=" << hit.eaux() << " GeV";
0023   }
0024   if (hit.time() > -998) {
0025     s << ", t= " << hit.time() << " to " << hit.timeFalling() << " ns";
0026   }
0027   return s;
0028 }
0029 
0030 void HBHERecHit::getMergedIds(std::vector<HcalDetId>* ids) const {
0031   if (ids) {
0032     ids->clear();
0033     if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) {
0034       const unsigned nMerged = CaloRecHitAuxSetter::getField(
0035           auxPhase1_, HBHERecHitAuxSetter::MASK_NSAMPLES, HBHERecHitAuxSetter::OFF_NSAMPLES);
0036       ids->reserve(nMerged);
0037       const HcalDetId myId(id());
0038       for (unsigned i = 0; i < nMerged; ++i) {
0039         const unsigned depth = CaloRecHitAuxSetter::getField(auxHBHE_, 0xf, i * 4);
0040         ids->emplace_back(myId.subdet(), myId.ieta(), myId.iphi(), depth);
0041       }
0042     }
0043   }
0044 }