Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:34:58

0001 #include "Calibration/IsolatedParticles/interface/FindCaloHit.h"
0002 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0003 #include <iostream>
0004 
0005 namespace spr {
0006 
0007   std::vector<std::vector<PCaloHit>::const_iterator> findHit(std::vector<PCaloHit>& hits, DetId thisDet, bool) {
0008     std::vector<std::vector<PCaloHit>::const_iterator> hit;
0009     std::vector<PCaloHit>::const_iterator ihit;
0010     for (ihit = hits.begin(); ihit != hits.end(); ihit++) {
0011       DetId detId(ihit->id());
0012       if (detId == thisDet) {
0013         hit.push_back(ihit);
0014       }
0015     }
0016     return hit;
0017   }
0018 
0019   void find(edm::Handle<EcalRecHitCollection>& hits,
0020             DetId thisDet,
0021             std::vector<EcalRecHitCollection::const_iterator>& hit,
0022             bool) {
0023     if (hits->find(thisDet) != hits->end())
0024       hit.push_back(hits->find(thisDet));
0025   }
0026 
0027   void find(edm::Handle<HBHERecHitCollection>& hits,
0028             DetId thisDet,
0029             std::vector<HBHERecHitCollection::const_iterator>& hit,
0030             bool) {
0031     if (hits->find(thisDet) != hits->end())
0032       hit.push_back(hits->find(thisDet));
0033   }
0034 
0035   void find(edm::Handle<edm::PCaloHitContainer>& hits,
0036             DetId thisDet,
0037             std::vector<edm::PCaloHitContainer::const_iterator>& hit,
0038             bool) {
0039     edm::PCaloHitContainer::const_iterator ihit;
0040     for (ihit = hits->begin(); ihit != hits->end(); ihit++) {
0041       DetId detId(ihit->id());
0042       if (detId == thisDet) {
0043         hit.push_back(ihit);
0044       }
0045     }
0046   }
0047 }  // namespace spr