SimMuon
MCTruth
src
PSimHitMap.cc
Go to the documentation of this file.
1
#include "
SimDataFormats/CrossingFrame/interface/MixCollection.h
"
2
#include "
SimMuon/MCTruth/interface/PSimHitMap.h
"
3
4
void
PSimHitMap::fill
(
const
edm::Event
&
e
) {
5
theMap
.clear();
6
edm::Handle<CrossingFrame<PSimHit>
> cf;
7
LogTrace
(
"PSimHitMap"
) <<
"getting CrossingFrame<PSimHit> collection "
;
8
e
.getByToken(
sh_token
, cf);
9
10
MixCollection<PSimHit>
simHits
(cf.
product
());
11
LogTrace
(
"PSimHitMap"
) <<
"... size = "
<<
simHits
.size();
12
13
// arrange the hits by detUnit
14
for
(
MixCollection<PSimHit>::MixItr
hitItr =
simHits
.begin(); hitItr !=
simHits
.end(); ++hitItr) {
15
theMap
[hitItr->detUnitId()].push_back(*hitItr);
16
}
17
}
18
19
const
edm::PSimHitContainer
&
PSimHitMap::hits
(
int
detId)
const
{
20
std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
theMap
.find(detId);
21
if
(mapItr !=
theMap
.end()) {
22
return
mapItr->second;
23
}
else
{
24
return
theEmptyContainer
;
25
}
26
}
27
28
std::vector<int>
PSimHitMap::detsWithHits
()
const
{
29
std::vector<int>
result
;
30
result
.reserve(
theMap
.size());
31
for
(std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
theMap
.begin(), mapEnd =
theMap
.end();
32
mapItr != mapEnd;
33
++mapItr) {
34
result
.push_back(mapItr->first);
35
}
36
return
result
;
37
}
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:62
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:11
PSimHitMap.h
PSimHitMap::fill
void fill(const edm::Event &e)
Definition:
PSimHitMap.cc:4
PSimHitMap::theEmptyContainer
edm::PSimHitContainer theEmptyContainer
Definition:
PSimHitMap.h:25
PSimHitMap::detsWithHits
std::vector< int > detsWithHits() const
Definition:
PSimHitMap.cc:28
PSimHitMap::hits
const edm::PSimHitContainer & hits(int detId) const
Definition:
PSimHitMap.cc:19
mps_fire.result
result
Definition:
mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:224
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
Generated for CMSSW Reference Manual by
1.8.16