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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#include "Calibration/IsolatedParticles/interface/FindCaloHit.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include <iostream>

namespace spr {

  std::vector<std::vector<PCaloHit>::const_iterator> findHit(std::vector<PCaloHit>& hits, DetId thisDet, bool) {
    std::vector<std::vector<PCaloHit>::const_iterator> hit;
    std::vector<PCaloHit>::const_iterator ihit;
    for (ihit = hits.begin(); ihit != hits.end(); ihit++) {
      DetId detId(ihit->id());
      if (detId == thisDet) {
        hit.push_back(ihit);
      }
    }
    return hit;
  }

  void find(edm::Handle<EcalRecHitCollection>& hits,
            DetId thisDet,
            std::vector<EcalRecHitCollection::const_iterator>& hit,
            bool) {
    if (hits->find(thisDet) != hits->end())
      hit.push_back(hits->find(thisDet));
  }

  void find(edm::Handle<HBHERecHitCollection>& hits,
            DetId thisDet,
            std::vector<HBHERecHitCollection::const_iterator>& hit,
            bool) {
    if (hits->find(thisDet) != hits->end())
      hit.push_back(hits->find(thisDet));
  }

  void find(edm::Handle<edm::PCaloHitContainer>& hits,
            DetId thisDet,
            std::vector<edm::PCaloHitContainer::const_iterator>& hit,
            bool) {
    edm::PCaloHitContainer::const_iterator ihit;
    for (ihit = hits->begin(); ihit != hits->end(); ihit++) {
      DetId detId(ihit->id());
      if (detId == thisDet) {
        hit.push_back(ihit);
      }
    }
  }
}  // namespace spr