42 : m_hitExtractor(&iHitExtractor),
43 m_tracker(
iEvent, iTracker),
44 m_csc(
iEvent, iSetup, iCSC),
48 m_resources(iTopo, &m_tracker, &m_csc, &m_dt, &m_rpc, &m_gem, iDiagnostics),
69 std::vector<edm::OwnVector<TrackingRecHit>> TMRecHits;
77 muonHitRefs.push_back(std::make_pair(mur->
track()->recHitsBegin(), mur->
track()->recHitsEnd()));
79 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
87 muonHitRefs.push_back(std::make_pair(mur->
outerTrack()->recHitsBegin(), mur->
outerTrack()->recHitsEnd()));
89 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
97 muonHitRefs.push_back(std::make_pair(mur->
globalTrack()->recHitsBegin(), mur->
globalTrack()->recHitsEnd()));
99 muonHitRefs.push_back(std::make_pair(allTMRecHits.
data().end(), allTMRecHits.
data().end()));
105 std::vector<std::pair<size_t, size_t>> muonHitIndices;
108 std::pair<size_t, size_t>
indices(allTMRecHits.
size(), allTMRecHits.
size());
111 for (std::vector<const TrackingRecHit *>::const_iterator ith =
hits.begin(), edh =
hits.end(); ith != edh;
117 muonHitIndices.push_back(
indices);
120 typedef std::pair<size_t, size_t> index_pair;
122 for (
std::vector<std::pair<size_t, size_t>>::const_iterator idxs = muonHitIndices.begin(),
123 idxend = muonHitIndices.end();
126 muonHitRefs.push_back(std::make_pair(hitRefBegin + idxs->first, hitRefBegin + idxs->second));
133 <<
"There are " <<
muons.size() <<
" selected reco::Muons.";
140 <<
" #" << isel <<
", reco::Muon key = " << mur.
key() <<
", q*p = " << mur->
charge() * mur->
p()
141 <<
", pT = " << mur->
pt() <<
", eta = " << mur->
eta() <<
", phi = " << mur->
phi();
146 <<
"\t this is a Global Muon with valid muon hits";
147 muonHitRefs.push_back(std::make_pair(mur->
globalTrack()->recHitsBegin(), mur->
globalTrack()->recHitsEnd()));
152 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t this is a Tracker Muon";
156 for (std::vector<const TrackingRecHit *>::const_iterator ith =
hits.begin(), edh =
hits.end(); ith != edh;
161 TMRecHits.push_back(TMvec);
163 muonHitRefs.push_back(std::make_pair(TMRecHits.rbegin()->data().begin(), TMRecHits.rbegin()->data().end()));
168 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t this is a Standalone muon";
169 muonHitRefs.push_back(std::make_pair(mur->
outerTrack()->recHitsBegin(), mur->
outerTrack()->recHitsEnd()));
173 edm::LogVerbatim(
"MuonToTrackingParticleAssociatorByHitsImpl") <<
"\t what muon is this ?";
175 <<
"isMuon : " << mur->
isMuon() <<
", isPFMuon : " << mur->
isPFMuon()
179 muonHitRefs.push_back(std::make_pair(noTM.
data().end(), noTM.
data().end()));
190 for (
auto it = recSimColl.begin(), ed = recSimColl.end(); it != ed; ++it) {
192 std::vector<std::pair<TrackingParticleRef, double>> &tpAss = recToSim[rec];
193 for (
auto const &
a : it->second) {
194 tpAss.push_back(std::make_pair(tPC[
a.idx],
a.quality));
198 for (
auto it = simRecColl.begin(), ed = simRecColl.end(); it != ed; ++it) {
200 std::vector<std::pair<edm::RefToBase<reco::Muon>,
double>> &recAss = simToRec[
sim];
201 for (
auto const &
a : it->second) {
214 for (
unsigned int j = 0;
j < tPCH->size();
j++)
218 for (
size_t i = 0;
i < tCH->size(); ++
i)
Log< level::Info, true > LogVerbatim
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
bool isMuon() const override
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
double pt() const final
transverse momentum
void associateMuons(reco::MuonToSimCollection &recoToSim, reco::SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &muons, reco::MuonTrackType type, const edm::RefVector< TrackingParticleCollection > &tpColl) const override
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
TrackerMuonHitExtractor const * m_hitExtractor
bool isNonnull() const
Checks for non-null.
base const & data() const
MuonToTrackingParticleAssociatorByHitsImpl(TrackerMuonHitExtractor const &iHitExtractor, TrackerHitAssociator::Config const &iTracker, CSCHitAssociator::Config const &iCSC, DTHitAssociator::Config const &iDT, RPCHitAssociator::Config const &iRPC, GEMHitAssociator::Config const &iGEM, edm::Event const &iEvent, edm::EventSetup const &iSetup, const TrackerTopology *iTopo, std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)>, MuonAssociatorByHitsHelper const *iHelper)
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
TrackRef track() const override
reference to a Track
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
double p() const final
magnitude of momentum vector
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
MuonAssociatorByHitsHelper::TrackHitsCollection TrackHitsCollection
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
std::vector< TrackingParticle > TrackingParticleCollection
MuonAssociatorByHitsHelper::Resources m_resources
double phi() const final
momentum azimuthal angle
bool isGlobalMuon() const override
int charge() const final
electric charge
bool isStandAloneMuon() const override
double eta() const final
momentum pseudorapidity