34 : m_hitExtractor(&iHitExtractor), m_resources(iResources), m_helper(iHelper) {}
54 std::vector<edm::OwnVector<TrackingRecHit>> TMRecHits;
62 muonHitRefs.push_back(std::make_pair(mur->
track()->recHitsBegin(), mur->
track()->recHitsEnd()));
64 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
72 muonHitRefs.push_back(std::make_pair(mur->
outerTrack()->recHitsBegin(), mur->
outerTrack()->recHitsEnd()));
74 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
82 muonHitRefs.push_back(std::make_pair(mur->
globalTrack()->recHitsBegin(), mur->
globalTrack()->recHitsEnd()));
84 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
90 std::vector<std::pair<size_t, size_t>> muonHitIndices;
93 std::pair<size_t, size_t> indices(allTMRecHits.
size(), allTMRecHits.
size());
96 for (std::vector<const TrackingRecHit *>::const_iterator ith = hits.begin(), edh = hits.end(); ith != edh;
100 indices.second += hits.size();
102 muonHitIndices.push_back(indices);
105 typedef std::pair<size_t, size_t> index_pair;
107 for (std::vector<std::pair<size_t, size_t>>::const_iterator idxs = muonHitIndices.begin(),
108 idxend = muonHitIndices.end();
111 muonHitRefs.push_back(std::make_pair(hitRefBegin + idxs->first, hitRefBegin + idxs->second));
118 <<
"There are " << muons.
size() <<
" selected reco::Muons.";
125 <<
" #" << isel <<
", reco::Muon key = " << mur.
key() <<
", q*p = " << mur->
charge() * mur->
p()
126 <<
", pT = " << mur->
pt() <<
", eta = " << mur->
eta() <<
", phi = " << mur->
phi();
131 <<
"\t this is a Global Muon with valid muon hits";
132 muonHitRefs.push_back(std::make_pair(mur->
globalTrack()->recHitsBegin(), mur->
globalTrack()->recHitsEnd()));
137 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t this is a Tracker Muon";
141 for (std::vector<const TrackingRecHit *>::const_iterator ith = hits.begin(), edh = hits.end(); ith != edh;
146 TMRecHits.push_back(TMvec);
148 muonHitRefs.push_back(std::make_pair(TMRecHits.rbegin()->data().begin(), TMRecHits.rbegin()->data().end()));
153 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t this is a Standalone muon";
154 muonHitRefs.push_back(std::make_pair(mur->
outerTrack()->recHitsBegin(), mur->
outerTrack()->recHitsEnd()));
158 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t what muon is this ?";
160 <<
"isMuon : " << mur->
isMuon() <<
", isPFMuon : " << mur->
isPFMuon()
164 muonHitRefs.push_back(std::make_pair(noTM.
data().end(), noTM.
data().end()));
175 for (
auto it = recSimColl.begin(), ed = recSimColl.end(); it != ed; ++it) {
177 std::vector<std::pair<TrackingParticleRef, double>> &tpAss = recToSim[rec];
178 for (
auto const &
a : it->second) {
179 tpAss.
push_back(std::make_pair(tPC[
a.idx],
a.quality));
183 for (
auto it = simRecColl.begin(), ed = simRecColl.end(); it != ed; ++it) {
185 std::vector<std::pair<edm::RefToBase<reco::Muon>,
double>> &recAss = simToRec[
sim];
186 for (
auto const &
a : it->second) {
187 recAss.
push_back(std::make_pair(muons[
a.idx],
a.quality));
199 for (
unsigned int j = 0; j < tPCH->size(); j++)
203 for (
size_t i = 0;
i < tCH->size(); ++
i)
bool isMuon() const override
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
TrackRef track() const override
reference to a Track
bool isNonnull() const
Checks for non-null.
double eta() const final
momentum pseudorapidity
bool isStandAloneMuon() const override
TrackerMuonHitExtractor const * m_hitExtractor
void associateMuons(reco::MuonToSimCollection &recoToSim, reco::SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &muons, reco::MuonTrackType type, const edm::RefVector< TrackingParticleCollection > &tpColl) const override
const_iterator end() const
double pt() const final
transverse momentum
int charge() const final
electric charge
MuonToTrackingParticleAssociatorByHitsImpl(TrackerMuonHitExtractor const &iHitExtractor, MuonAssociatorByHitsHelper::Resources const &iResources, MuonAssociatorByHitsHelper const *iHelper)
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
bool isTrackerMuon() const override
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
bool isGlobalMuon() const override
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
double p() const final
magnitude of momentum vector
const_iterator begin() const
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
base const & data() const
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
MuonAssociatorByHitsHelper const * m_helper
MuonAssociatorByHitsHelper::Resources m_resources
double phi() const final
momentum azimuthal angle
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector