CMS 3D CMS Logo

FindCaloHit.cc
Go to the documentation of this file.
3 #include <iostream>
4 
5 namespace spr {
6 
7  std::vector<std::vector<PCaloHit>::const_iterator> findHit(std::vector<PCaloHit>& hits, DetId thisDet, bool ) {
8 
9  std::vector<std::vector<PCaloHit>::const_iterator> hit;
10  std::vector<PCaloHit>::const_iterator ihit;
11  for (ihit=hits.begin(); ihit!=hits.end(); ihit++) {
12  DetId detId(ihit->id());
13  if (detId == thisDet) {
14  hit.push_back(ihit);
15  }
16  }
17  return hit;
18  }
19 
20  void find(edm::Handle<EcalRecHitCollection>& hits, DetId thisDet, std::vector<EcalRecHitCollection::const_iterator>& hit, bool ) {
21 
22  if (hits->find(thisDet) != hits->end())
23  hit.push_back( hits->find(thisDet) );
24  }
25 
26  void find(edm::Handle<HBHERecHitCollection>& hits, DetId thisDet, std::vector<HBHERecHitCollection::const_iterator>& hit, bool ) {
27 
28  if (hits->find(thisDet) != hits->end())
29  hit.push_back( hits->find(thisDet) );
30  }
31 
32  void find(edm::Handle<edm::PCaloHitContainer>& hits, DetId thisDet, std::vector<edm::PCaloHitContainer::const_iterator>& hit, bool ) {
33 
34  edm::PCaloHitContainer::const_iterator ihit;
35  for (ihit=hits->begin(); ihit!=hits->end(); ihit++) {
36  DetId detId(ihit->id());
37  if (detId == thisDet) {
38  hit.push_back(ihit);
39  }
40  }
41  }
42 }
std::vector< typename T::const_iterator > findHit(edm::Handle< T > &hits, DetId thisDet, bool debug=false)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const_iterator end() const
Definition: DetId.h:18
iterator find(key_type k)