CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PSimHitMap.cc
Go to the documentation of this file.
4 
6  theMap.clear();
8  LogTrace("PSimHitMap") << "getting CrossingFrame<PSimHit> collection ";
9  e.getByToken(sh_token, cf);
10 
12  LogTrace("PSimHitMap") << "... size = " << simHits.size();
13 
14  // arrange the hits by detUnit
15  for (MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
16  theMap[hitItr->detUnitId()].push_back(*hitItr);
17  }
18 }
19 
20 const edm::PSimHitContainer &PSimHitMap::hits(int detId) const {
21  std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.find(detId);
22  if (mapItr != theMap.end()) {
23  return mapItr->second;
24  } else {
25  return theEmptyContainer;
26  }
27 }
28 
29 std::vector<int> PSimHitMap::detsWithHits() const {
30  std::vector<int> result;
31  result.reserve(theMap.size());
32  for (std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.begin(), mapEnd = theMap.end();
33  mapItr != mapEnd;
34  ++mapItr) {
35  result.push_back(mapItr->first);
36  }
37  return result;
38 }
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:25
void fill(const edm::Event &e)
Definition: PSimHitMap.cc:5
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:27
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:29
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:24
T const * product() const
Definition: Handle.h:70
tuple simHits
Definition: trackerHits.py:16
std::vector< PSimHit > PSimHitContainer