35 template <
typename TYPE>
83 desc.add<std::vector<edm::InputTag>>(
"PFCandidate", {
edm::InputTag(
"particleFlow")});
87 desc.add<
bool>(
"ProducePFCandidates",
true);
88 desc.add<
bool>(
"FillMuonRefs",
true);
93 desc.add<
bool>(
"forceElectronsInHGCAL",
false);
100 std::vector<edm::InputTag>
tags = iConfig.
getParameter<std::vector<edm::InputTag>>(
"PFCandidate");
101 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
129 <<
" cannot read several collections of PFCandidates and produce a new collection at the same time. " 140 produces<edm::ValueMap<reco::PFCandidatePtr>>(
muonTag_.
label());
146 auto pfCandidates_p = std::make_unique<reco::PFCandidateCollection>();
150 std::map<reco::GsfElectronRef, reco::PFCandidatePtr> electronCandidateMap;
153 std::map<reco::PhotonRef, reco::PFCandidatePtr> photonCandidateMap;
158 std::map<reco::MuonRef, reco::PFCandidatePtr> muonCandidateMap;
162 for (
unsigned icol = 0; icol < nColPF; ++icol) {
166 for (
unsigned i = 0;
i < ncand; ++
i) {
176 if (!(isphoton || iselectron || hasNonNullMuonRef)) {
177 pfCandidates_p->push_back(
cand);
181 if (hasNonNullMuonRef) {
183 cand.setMuonRef(muRef);
184 muonCandidateMap[muRef] = candPtr;
191 return (ele.gsfTrack() == gsfTrackRef);
195 std::ostringstream
err;
196 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
199 LogDebug(
"PFLinker") <<
"Forcing an electron pfCandidate at: " <<
cand.eta() <<
" in HGCAL" << std::endl;
200 pfCandidates_p->push_back(
cand);
205 cand.setGsfElectronRef(electronRef);
206 cand.setSuperClusterRef(electronRef->superCluster());
208 cand.setEcalEnergy(electronRef->superCluster()->rawEnergy(), electronRef->ecalEnergy());
211 electronCandidateMap[electronRef] = candPtr;
217 auto itcheck = find_if(
219 if (itcheck ==
photons->end()) {
220 std::ostringstream
err;
221 err <<
" Problem in PFLinker: no Photon " << std::endl;
226 cand.setPhotonRef(photonRef);
227 cand.setSuperClusterRef(photonRef->superCluster());
229 cand.setEcalEnergy(photonRef->superCluster()->rawEnergy(),
233 photonCandidateMap[photonRef] = candPtr;
236 pfCandidates_p->push_back(
cand);
261 auto pfMapMerged = std::make_unique<edm::ValueMap<reco::PFCandidatePtr>>();
264 *pfMapMerged += pfMapGsfElectrons;
265 *pfMapMerged += pfMapPhotons;
267 *pfMapMerged += pfMapMuons;
272 template <
typename TYPE>
279 auto pfMap_p = std::make_unique<edm::ValueMap<reco::PFCandidatePtr>>();
284 unsigned nObj = inputObjCollection->size();
285 std::vector<reco::PFCandidatePtr>
values(nObj);
287 for (
unsigned iobj = 0; iobj < nObj; ++iobj) {
289 MapTYPE_it itcheck = mapToTheCandidate.find(objRef);
293 if (itcheck != mapToTheCandidate.end())
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
edm::InputTag muonTag_
Input Muons.
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
void produce(edm::Event &, const edm::EventSetup &) override
bool producePFCandidates_
Flags - if true: References will be towards new collection ; if false to the original one...
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::PhotonCollection > inputTagPhotons_
Input Photons.
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
PFLinker(const edm::ParameterSet &)
edm::EDGetTokenT< reco::MuonToMuonMap > inputTagMuonMap_
std::string nameOutputElectronsPF_
name of output ValueMap electrons
std::string nameOutputPhotonsPF_
name of output ValueMap photons
#define DEFINE_FWK_MODULE(type)
std::string nameOutputPF_
name of output collection of PFCandidate
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
edm::ValueMap< reco::PFCandidatePtr > fillValueMap(edm::Event &event, std::string label, edm::Handle< TYPE > &inputObjCollection, const std::map< edm::Ref< TYPE >, reco::PFCandidatePtr > &mapToTheCandidate, const edm::OrphanHandle< reco::PFCandidateCollection > &newPFCandColl) const