CMS 3D CMS Logo

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 }
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:61
PSimHitMap::sh_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:27
PSimHitMap::theMap
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:24
MixCollection.h
MixCollection
Definition: MixCollection.h:10
PSimHitMap.h
PSimHitMap::fill
void fill(const edm::Event &e)
Definition: PSimHitMap.cc:5
PSimHitMap::theEmptyContainer
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:25
PSimHitMap::detsWithHits
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:29
PSimHitMap::hits
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
edm::Event
Definition: Event.h:73
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37