134 auto pfCandidates_p = std::make_unique<reco::PFCandidateCollection>();
138 std::map<reco::GsfElectronRef, reco::PFCandidatePtr> electronCandidateMap;
141 std::map<reco::PhotonRef, reco::PFCandidatePtr> photonCandidateMap;
146 std::map<reco::MuonRef, reco::PFCandidatePtr> muonCandidateMap;
150 for (
unsigned icol = 0; icol < nColPF; ++icol) {
154 for (
unsigned i = 0;
i < ncand; ++
i) {
164 if (!(isphoton || iselectron || hasNonNullMuonRef)) {
165 pfCandidates_p->push_back(
cand);
169 if (hasNonNullMuonRef) {
171 cand.setMuonRef(muRef);
172 muonCandidateMap[muRef] = candPtr;
178 auto itcheck = find_if(gsfElectrons->begin(), gsfElectrons->end(), [&gsfTrackRef](
const auto& ele) {
179 return (ele.gsfTrack() == gsfTrackRef);
181 if (itcheck == gsfElectrons->end()) {
183 std::ostringstream
err;
184 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
187 LogDebug(
"PFLinker") <<
"Forcing an electron pfCandidate at: " <<
cand.eta() <<
" in HGCAL" << std::endl;
188 pfCandidates_p->push_back(
cand);
193 cand.setGsfElectronRef(electronRef);
194 cand.setSuperClusterRef(electronRef->superCluster());
196 cand.setEcalEnergy(electronRef->superCluster()->rawEnergy(), electronRef->ecalEnergy());
199 electronCandidateMap[electronRef] = candPtr;
205 auto itcheck = find_if(
207 if (itcheck ==
photons->end()) {
208 std::ostringstream
err;
209 err <<
" Problem in PFLinker: no Photon " << std::endl;
214 cand.setPhotonRef(photonRef);
215 cand.setSuperClusterRef(photonRef->superCluster());
217 cand.setEcalEnergy(photonRef->superCluster()->rawEnergy(),
221 photonCandidateMap[photonRef] = candPtr;
224 pfCandidates_p->push_back(
cand);
249 auto pfMapMerged = std::make_unique<edm::ValueMap<reco::PFCandidatePtr>>();
252 *pfMapMerged += pfMapGsfElectrons;
253 *pfMapMerged += pfMapPhotons;
255 *pfMapMerged += pfMapMuons;
edm::InputTag muonTag_
Input Muons.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
bool producePFCandidates_
Flags - if true: References will be towards new collection ; if false to the original one...
edm::EDGetTokenT< reco::PhotonCollection > inputTagPhotons_
Input Photons.
edm::EDGetTokenT< reco::MuonToMuonMap > inputTagMuonMap_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
std::string nameOutputElectronsPF_
name of output ValueMap electrons
std::string nameOutputPhotonsPF_
name of output ValueMap photons
std::string nameOutputPF_
name of output collection of PFCandidate
bool fillMuonRefs_
Set muon refs and produce the value map?
Particle reconstructed by the particle flow algorithm.
bool forceElectronsInHGCAL_
Put Electrons within HGCAL coming from SimPFProducer.
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagGsfElectrons_
Input GsfElectrons.
std::vector< edm::EDGetTokenT< reco::PFCandidateCollection > > inputTagPFCandidates_
Input PFCandidates.
std::string nameOutputMergedPF_
name of output merged ValueMap