25 const auto& simClusters = *simClusH.
product();
31 const auto&
tp = *tpIt;
32 unsigned int tpTrackId =
tp.g4Tracks()[0].trackId();
36 tpIdMap[std::make_pair(tpTrackId, tpEventId.
rawId())] = tpRef;
41 LogDebug(
"MtdSimLayerClusterToTPAssociator")
42 <<
" Found " << simClusters.size() <<
" MtdSimLayerClusters in the event";
44 for (
auto simClusIt = simClusters.begin(); simClusIt != simClusters.end(); simClusIt++) {
45 const auto& simClus = *simClusIt;
46 size_t simClusIndex = simClusIt - simClusters.begin();
48 unsigned int simClusTrackId = simClus.g4Tracks()[0].trackId();
56 std::pair uniqueId = std::make_pair(simClusTrackId, simClusEventId.
rawId());
57 auto it = tpIdMap.find(uniqueId);
59 if (
it != tpIdMap.end()) {
61 outputCollection.
insert(simClusterRef, tpRef);
63 LogDebug(
"MtdSimLayerClusterToTPAssociator::associateSimToTP")
64 <<
"MtdSimLayerCluster: index = " << simClusIndex <<
" simClus TrackId = " << simClusTrackId
65 <<
" simClus EventId = " << simClusEventId.
rawId() <<
" simClus Eta = " << simClus.eta()
66 <<
" simClus Phi = " << simClus.phi() <<
" simClus Time = " << simClus.simLCTime()
67 <<
" simClus Energy = " << simClus.simLCEnergy() << std::endl;
68 LogDebug(
"MtdSimLayerClusterToTPAssociator::associateSimToTP")
69 <<
" --> Found associated tracking particle: tp TrackId = " << (*tpRef).g4Tracks()[0].trackId()
70 <<
" tp EventId = " << (*tpRef).eventId().rawId() << std::endl;
75 return outputCollection;
84 const auto& simClusters = *simClusH.
product();
88 std::map<std::pair<unsigned int, uint32_t>, std::vector<MtdSimLayerClusterRef>> simClusIdMap;
89 for (
auto simClusIt = simClusters.begin(); simClusIt != simClusters.end(); simClusIt++) {
90 const auto& simClus = *simClusIt;
91 unsigned int simClusTrackId = simClus.g4Tracks()[0].trackId();
95 simClusIdMap[std::make_pair(simClusTrackId, simClusEventId.
rawId())].
push_back(simClusterRef);
100 const auto&
tp = *tpIt;
103 unsigned int tpTrackId =
tp.g4Tracks()[0].trackId();
106 std::pair uniqueId = std::make_pair(tpTrackId, tpEventId.
rawId());
107 auto it = simClusIdMap.find(uniqueId);
109 if (
it != simClusIdMap.end()) {
110 for (
unsigned int i = 0;
i < simClusIdMap[uniqueId].size();
i++) {
117 outputCollection.
insert(tpRef, simClusterRef);
119 LogDebug(
"MtdSimLayerClusterToTPAssociator")
120 <<
"Tracking particle: index = " << tpIndex <<
" tp TrackId = " << tpTrackId
121 <<
" tp EventId = " << tpEventId.
rawId();
122 LogDebug(
"MtdSimLayerClusterToTPAssociator")
123 <<
" --> Found associated MtdSimLayerCluster: simClus TrackId = " 124 << (*simClusterRef).g4Tracks()[0].trackId() <<
" simClus EventId = " << (*simClusterRef).eventId().rawId()
125 <<
" simClus Eta = " << (*simClusterRef).eta() <<
" simClus Phi = " << (*simClusterRef).phi()
126 <<
" simClus Time = " << (*simClusterRef).simLCTime()
127 <<
" simClus Energy = " << (*simClusterRef).simLCEnergy() << std::endl;
132 return outputCollection;
reco::TPToSimCollectionMtd associateTPToSim(const edm::Handle< MtdSimLayerClusterCollection > &simClusH, const edm::Handle< TrackingParticleCollection > &trackingParticleH) const override
Associate a TrackingParticle to MtdSimLayerCluster.
uint32_t rawId() const
get the raw id
T const * product() const
edm::EDProductGetter const * productGetter_
MtdSimLayerClusterToTPAssociatorByTrackIdImpl(edm::EDProductGetter const &)
reco::SimToTPCollectionMtd associateSimToTP(const edm::Handle< MtdSimLayerClusterCollection > &simClusH, const edm::Handle< TrackingParticleCollection > &trackingParticleH) const override
Associate a MtdSimLayerCluster to TrackingParticle.
void insert(const key_type &k, const data_type &v)
insert an association
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
EDProductGetter const * productGetter(std::atomic< void const *> const &iCache)