43 packed_{consumes<pat::PackedCandidateCollection>(iConfig.getParameter<
edm::InputTag>(
"packedCandidates"))},
46 pf2packed_{consumes<edm::Association<pat::PackedCandidateCollection> >(iConfig.getParameter<
edm::InputTag>(
"packedCandidates"))},
47 lost2trk_{consumes<edm::Association<pat::PackedCandidateCollection> >(iConfig.getParameter<
edm::InputTag>(
"lostTracks"))},
48 preid_{consumes<std::vector<reco::PreId> >(iConfig.getParameter<
edm::InputTag>(
"gsfPreID"))},
50 produces< edm::Association<pat::PackedCandidateCollection> > (
"packedCandidates");
51 produces< edm::Association<pat::PackedCandidateCollection> > (
"lostTracks");
82 const size_t npf = pfcands->size();
83 const size_t npacked = packed->size();
84 const size_t nlost = lost_tracks->size();
85 const size_t ntracks = tracks->size();
86 const size_t ngsf = gsftracks->size();
89 std::vector<size_t> trk2packed(ntracks, npacked);
90 std::vector<size_t> trk2lost(ntracks, nlost);
93 std::vector<int> gsf2pack(ngsf, -1);
94 std::vector<int> gsf2lost(ngsf, -1);
98 for(
unsigned int icand=0; icand < npf; ++icand) {
101 auto packed_ref = (*pf2packed)[pf_ref];
105 size_t packid = packed_ref.index();
106 trk2packed[trkid] = packid;
111 for(
unsigned int itrk=0; itrk < ntracks; ++itrk) {
115 size_t ilost = lostTrack.
index();
116 trk2lost[itrk] = ilost;
121 for(
unsigned int igsf=0; igsf < ngsf; ++igsf) {
126 size_t trkid = trk.
index();
128 if(trk2packed[trkid] != npacked) {
129 gsf2pack[igsf] = trk2packed[trkid];
131 if(trk2lost[trkid] != nlost) {
132 gsf2lost[igsf] = trk2lost[trkid];
137 auto assoc_gsf2pack = std::make_unique< edm::Association<pat::PackedCandidateCollection> >(packed);
139 gsf2pack_filler.insert(gsftracks, gsf2pack.begin(), gsf2pack.end());
140 gsf2pack_filler.fill();
141 iEvent.
put(
std::move(assoc_gsf2pack),
"packedCandidates");
143 auto assoc_gsf2lost = std::make_unique< edm::Association<pat::PackedCandidateCollection> >(lost_tracks);
145 gsf2lost_filler.insert(gsftracks, gsf2lost.begin(), gsf2lost.end());
146 gsf2lost_filler.fill();
158 descriptions.
add(
"lowPtGsfLinksDefault", desc);
T getParameter(std::string const &) const
const edm::EDGetTokenT< pat::PackedCandidateCollection > packed_
const edm::EDGetTokenT< reco::PFCandidateCollection > pfcands_
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.
const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::TrackCollection > tracks_
int charge() const final
electric charge
ProductID id() const
Accessor for product ID.
reco::TrackRef trackRef() const
const edm::EDGetTokenT< pat::PackedCandidateCollection > lost_tracks_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
~LowPtGSFToPackedCandidateLinker() override
Particle reconstructed by the particle flow algorithm.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > lost2trk_
const edm::EDGetTokenT< std::vector< reco::PreId > > preid_
static void fillDescriptions(edm::ConfigurationDescriptions &)
LowPtGSFToPackedCandidateLinker(const edm::ParameterSet &)