34 template <
typename TYPE>
83 std::vector<edm::InputTag>
tags = iConfig.
getParameter<std::vector<edm::InputTag>>(
"PFCandidate");
84 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
112 <<
" cannot read several collections of PFCandidates and produce a new collection at the same time. "
123 produces<edm::ValueMap<reco::PFCandidatePtr>>(
muonTag_.
label());
129 auto pfCandidates_p = std::make_unique<reco::PFCandidateCollection>();
133 std::map<reco::GsfElectronRef, reco::PFCandidatePtr> electronCandidateMap;
136 std::map<reco::PhotonRef, reco::PFCandidatePtr> photonCandidateMap;
141 std::map<reco::MuonRef, reco::PFCandidatePtr> muonCandidateMap;
145 for (
unsigned icol = 0; icol < nColPF; ++icol) {
149 for (
unsigned i = 0;
i < ncand; ++
i) {
159 if (!(isphoton || iselectron || hasNonNullMuonRef)) {
160 pfCandidates_p->push_back(
cand);
164 if (hasNonNullMuonRef) {
166 cand.setMuonRef(muRef);
167 muonCandidateMap[muRef] = candPtr;
174 return (ele.gsfTrack() == gsfTrackRef);
178 std::ostringstream
err;
179 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
182 LogDebug(
"PFLinker") <<
"Forcing an electron pfCandidate at: " <<
cand.eta() <<
" in HGCAL" << std::endl;
183 pfCandidates_p->push_back(
cand);
188 cand.setGsfElectronRef(electronRef);
189 cand.setSuperClusterRef(electronRef->superCluster());
191 cand.setEcalEnergy(electronRef->superCluster()->rawEnergy(), electronRef->ecalEnergy());
194 electronCandidateMap[electronRef] = candPtr;
200 auto itcheck = find_if(
202 if (itcheck ==
photons->end()) {
203 std::ostringstream
err;
204 err <<
" Problem in PFLinker: no Photon " << std::endl;
209 cand.setPhotonRef(photonRef);
210 cand.setSuperClusterRef(photonRef->superCluster());
212 cand.setEcalEnergy(photonRef->superCluster()->rawEnergy(),
216 photonCandidateMap[photonRef] = candPtr;
219 pfCandidates_p->push_back(
cand);
244 auto pfMapMerged = std::make_unique<edm::ValueMap<reco::PFCandidatePtr>>();
247 *pfMapMerged += pfMapGsfElectrons;
248 *pfMapMerged += pfMapPhotons;
250 *pfMapMerged += pfMapMuons;
255 template <
typename TYPE>
262 auto pfMap_p = std::make_unique<edm::ValueMap<reco::PFCandidatePtr>>();
267 unsigned nObj = inputObjCollection->size();
268 std::vector<reco::PFCandidatePtr>
values(nObj);
270 for (
unsigned iobj = 0; iobj < nObj; ++iobj) {
272 MapTYPE_it itcheck = mapToTheCandidate.find(objRef);
276 if (itcheck != mapToTheCandidate.end())