12 std::vector<edm::InputTag>
tags = iConfig.
getParameter<std::vector<edm::InputTag> >(
"PFCandidate");
13 for (
unsigned int i=0;
i<tags.size();++
i)
47 edm::LogError(
"PFLinker") <<
" cannot read several collections of PFCandidates and produce a new collection at the same time. " << std::endl;
50 if(producePFCandidates_) {
56 if(fillMuonRefs_) produces<edm::ValueMap<reco::PFCandidatePtr> > (
muonTag_.
label());
64 std::auto_ptr<reco::PFCandidateCollection>
70 std::map<reco::GsfElectronRef,reco::PFCandidatePtr> electronCandidateMap;
75 std::map<reco::PhotonRef,reco::PFCandidatePtr> photonCandidateMap;
81 std::map<reco::MuonRef,reco::PFCandidatePtr> muonCandidateMap;
86 for(
unsigned icol=0;icol<nColPF;++icol) {
88 unsigned ncand=pfCandidates->size();
90 for(
unsigned i=0;
i<ncand; ++
i) {
100 if ( !(isphoton || iselectron || hasNonNullMuonRef)){pfCandidates_p->push_back(cand);
continue;}
103 if (hasNonNullMuonRef) {
106 muonCandidateMap[muRef] = candPtr;
114 std::vector<reco::GsfElectron>::const_iterator itcheck=find_if(gsfElectrons->begin(),gsfElectrons->end(),myEqual);
115 if(itcheck==gsfElectrons->end()) {
116 std::ostringstream err;
117 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
125 cand.
setEcalEnergy(electronRef->superCluster()->rawEnergy(),electronRef->ecalEnergy());
128 electronCandidateMap[electronRef] = candPtr;
135 std::vector<reco::Photon>::const_iterator itcheck=find_if(photons->begin(),photons->end(),myEqual);
136 if(itcheck==photons->end()) {
137 std::ostringstream err;
138 err <<
" Problem in PFLinker: no Photon " << std::endl;
150 photonCandidateMap[photonRef] = candPtr;
153 pfCandidates_p->push_back(cand);
166 electronCandidateMap,
182 pfMapMuons = fillValueMap<reco::MuonCollection>(
iEvent,
189 std::auto_ptr<edm::ValueMap<reco::PFCandidatePtr> >
193 *pfMapMerged += pfMapGsfElectrons;
194 *pfMapMerged += pfMapPhotons;
202 template<
typename TYPE>
214 unsigned nObj=inputObjCollection->size();
215 std::vector<reco::PFCandidatePtr>
values(nObj);
217 for(
unsigned iobj=0; iobj < nObj; ++iobj) {
220 MapTYPE_it itcheck = mapToTheCandidate.find(objRef);
224 if(itcheck != mapToTheCandidate.end())
227 values[iobj] = candPtr;
230 filler.
insert(inputObjCollection,values.begin(),values.end());
233 event.put(pfMap_p,label);
T getParameter(std::string const &) const
edm::InputTag muonTag_
Input Muons.
void setDeltaP(double dp)
set uncertainty on momentum
bool isNonnull() const
Checks for non-null.
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
float mva_nothing_gamma() const
mva for gamma detection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void insert(const H &h, I begin, I end)
virtual 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...
edm::EDGetTokenT< reco::PhotonCollection > inputTagPhotons_
Input Photons.
PFLinker(const edm::ParameterSet &)
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
edm::EDGetTokenT< reco::MuonToMuonMap > inputTagMuonMap_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
reco::MuonRef muonRef() const
void setEcalEnergy(float eeRaw, float eeCorr)
set corrected Ecal energy
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
bool fillMuonRefs_
Set muon refs and produce the value map?
void setPhotonRef(const reco::PhotonRef &phRef)
set ref to the corresponding reco::Photon if any
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
Particle reconstructed by the particle flow algorithm.
void setMuonRef(const reco::MuonRef &ref)
set muon reference
reco::GsfTrackRef gsfTrackRef() const
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
virtual ParticleType particleId() const
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagGsfElectrons_
Input GsfElectrons.
std::vector< edm::EDGetTokenT< reco::PFCandidateCollection > > inputTagPFCandidates_
Input PFCandidates.
std::string nameOutputMergedPF_
name of output merged ValueMap
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any