43 packed_{consumes<pat::PackedCandidateCollection>(iConfig.getParameter<
edm::InputTag>(
"packedCandidates"))},
44 lost_tracks_{consumes<pat::PackedCandidateCollection>(iConfig.getParameter<
edm::InputTag>(
"lostTracks"))},
45 tracks_{consumes<reco::TrackCollection>(iConfig.getParameter<
edm::InputTag>(
"tracks"))},
46 pf2packed_{consumes<edm::Association<pat::PackedCandidateCollection> >(
48 lost2trk_{consumes<edm::Association<pat::PackedCandidateCollection> >(
50 gsf2trk_{consumes<edm::Association<reco::TrackCollection> >(iConfig.getParameter<
edm::InputTag>(
"gsfToTrack"))},
51 gsftracks_{consumes<std::vector<reco::GsfTrack> >(iConfig.getParameter<
edm::InputTag>(
"gsfTracks"))} {
52 produces<edm::Association<pat::PackedCandidateCollection> >(
"packedCandidates");
53 produces<edm::Association<pat::PackedCandidateCollection> >(
"lostTracks");
84 const size_t npf = pfcands->size();
85 const size_t npacked = packed->size();
86 const size_t nlost = lost_tracks->size();
88 const size_t ngsf = gsftracks->size();
91 std::vector<size_t> trk2packed(
ntracks, npacked);
92 std::vector<size_t> trk2lost(
ntracks, nlost);
95 std::vector<int> gsf2pack(ngsf, -1);
96 std::vector<int> gsf2lost(ngsf, -1);
100 for (
unsigned int icand = 0; icand < npf; ++icand) {
103 auto packed_ref = (*pf2packed)[pf_ref];
104 if (
cand.charge() && packed_ref.isNonnull() &&
cand.trackRef().isNonnull() &&
cand.trackRef().id() ==
tracks.id()) {
105 size_t trkid =
cand.trackRef().index();
106 size_t packid = packed_ref.index();
107 trk2packed[trkid] = packid;
112 for (
unsigned int itrk = 0; itrk <
ntracks; ++itrk) {
116 size_t ilost = lostTrack.
index();
117 trk2lost[itrk] = ilost;
122 for (
unsigned int igsf = 0; igsf < ngsf; ++igsf) {
128 "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
130 size_t trkid = trk.
index();
132 if (trk2packed[trkid] != npacked) {
133 gsf2pack[igsf] = trk2packed[trkid];
135 if (trk2lost[trkid] != nlost) {
136 gsf2lost[igsf] = trk2lost[trkid];
141 auto assoc_gsf2pack = std::make_unique<edm::Association<pat::PackedCandidateCollection> >(packed);
143 gsf2pack_filler.insert(gsftracks, gsf2pack.begin(), gsf2pack.end());
144 gsf2pack_filler.fill();
147 auto assoc_gsf2lost = std::make_unique<edm::Association<pat::PackedCandidateCollection> >(lost_tracks);
149 gsf2lost_filler.insert(gsftracks, gsf2lost.begin(), gsf2lost.end());
150 gsf2lost_filler.fill();
162 descriptions.
add(
"lowPtGsfLinksDefault",
desc);