78 const size_t npf = pfcands->size();
79 const size_t npacked = packed->size();
80 const size_t nlost = lost_tracks->size();
82 const size_t ngsf = gsftracks->size();
86 std::vector<size_t> trk2packed(ntracks, npacked);
87 std::vector<size_t> trk2lost(ntracks, nlost);
90 std::vector<int> gsf2pack(ngsf, -1);
91 std::vector<int> gsf2lost(ngsf, -1);
97 for (
unsigned int icand = 0; icand < npf; ++icand) {
100 auto packed_ref = (*pf2packed)[pf_ref];
103 trk2packed[trkid] = packed_ref.index();
108 for (
unsigned int itrk = 0; itrk <
ntracks; ++itrk) {
112 trk2lost[itrk] = lostTrack.
index();
117 for (
unsigned int igsf = 0; igsf < ngsf; ++igsf) {
123 "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
125 size_t trkid = trk_ref.
index();
126 if (trk2packed[trkid] != npacked) {
127 gsf2pack[igsf] = trk2packed[trkid];
129 if (trk2lost[trkid] != nlost) {
130 gsf2lost[igsf] = trk2lost[trkid];
135 for (
unsigned int iele = 0; iele < nele; ++iele) {
136 auto const& ele = (*electrons)[iele];
142 "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
144 size_t trkid = trk_ref.
index();
145 auto packedIdx = trk2packed[trkid];
146 if (packedIdx != npacked) {
149 auto lostIdx = trk2lost[trkid];
150 if (lostIdx != nlost) {
156 auto assoc_gsf2pack = std::make_unique<edm::Association<pat::PackedCandidateCollection> >(packed);
158 gsf2pack_filler.insert(gsftracks, gsf2pack.begin(), gsf2pack.end());
159 gsf2pack_filler.fill();
162 auto assoc_gsf2lost = std::make_unique<edm::Association<pat::PackedCandidateCollection> >(lost_tracks);
164 gsf2lost_filler.insert(gsftracks, gsf2lost.begin(), gsf2lost.end());
165 gsf2lost_filler.fill();
168 auto map_ele2packedptr = std::make_unique<edm::ValueMap<PackedCandidatePtr> >();
170 ele2packedptr_filler.insert(
electrons, ele2packedptr.begin(), ele2packedptr.end());
171 ele2packedptr_filler.fill();
174 auto map_ele2lostptr = std::make_unique<edm::ValueMap<PackedCandidatePtr> >();
176 ele2lostptr_filler.insert(
electrons, ele2lostptr.begin(), ele2lostptr.end());
177 ele2lostptr_filler.fill();
const edm::EDGetTokenT< pat::PackedCandidateCollection > packed_
const edm::EDGetTokenT< reco::PFCandidateCollection > pfcands_
const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2packed_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
edm::Ptr< pat::PackedCandidate > PackedCandidatePtr
const edm::EDGetTokenT< reco::TrackCollection > tracks_
std::vector< PackedCandidatePtr > PackedCandidatePtrCollection
int charge() const final
electric charge
ProductID id() const
Accessor for product ID.
reco::TrackRef trackRef() const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const edm::EDGetTokenT< pat::PackedCandidateCollection > lost_tracks_
const edm::EDGetTokenT< edm::Association< reco::TrackCollection > > gsf2trk_
Particle reconstructed by the particle flow algorithm.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > lost2trk_
const edm::EDGetTokenT< std::vector< pat::Electron > > electrons_