48 packed_{consumes<pat::PackedCandidateCollection>(
iConfig.getParameter<
edm::InputTag>(
"packedCandidates"))},
49 lost_tracks_{consumes<pat::PackedCandidateCollection>(
iConfig.getParameter<
edm::InputTag>(
"lostTracks"))},
51 pf2packed_{consumes<edm::Association<pat::PackedCandidateCollection> >(
53 lost2trk_{consumes<edm::Association<pat::PackedCandidateCollection> >(
55 gsf2trk_{consumes<edm::Association<reco::TrackCollection> >(
iConfig.getParameter<
edm::InputTag>(
"gsfToTrack"))},
56 gsftracks_{consumes<std::vector<reco::GsfTrack> >(
iConfig.getParameter<
edm::InputTag>(
"gsfTracks"))},
57 electrons_{consumes<std::vector<pat::Electron> >(
iConfig.getParameter<
edm::InputTag>(
"electrons"))} {
58 produces<edm::Association<pat::PackedCandidateCollection> >(
"gsf2packed");
59 produces<edm::Association<pat::PackedCandidateCollection> >(
"gsf2lost");
60 produces<edm::ValueMap<PackedCandidatePtr> >(
"ele2packed");
61 produces<edm::ValueMap<PackedCandidatePtr> >(
"ele2lost");
78 const size_t npf = pfcands->size();
79 const size_t npacked = packed->size();
80 const size_t nlost = lost_tracks->size();
81 const size_t ntracks =
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();
190 descriptions.
add(
"lowPtGsfLinksDefault", desc);
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
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::TrackCollection > tracks_
std::vector< PackedCandidatePtr > PackedCandidatePtrCollection
auto const & tracks
cannot be loose
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_
tuple key
prepare the HTCondor submission files and eventually submit them
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< edm::Association< reco::TrackCollection > > gsf2trk_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~LowPtGSFToPackedCandidateLinker() override
Particle reconstructed by the particle flow algorithm.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > lost2trk_
const edm::EDGetTokenT< std::vector< pat::Electron > > electrons_
static void fillDescriptions(edm::ConfigurationDescriptions &)
LowPtGSFToPackedCandidateLinker(const edm::ParameterSet &)
int charge() const final
electric charge