17 = iConfig.
getParameter<std::vector<edm::InputTag> >(
"PFCandidate");
45 edm::LogError(
"PFLinker") <<
" cannot read several collections of PFCandidates and produce a new collection at the same time. " << std::endl;
48 if(producePFCandidates_) {
54 if(fillMuonRefs_) produces<edm::ValueMap<reco::PFCandidatePtr> > (inputTagMuons_.
label());
62 std::auto_ptr<reco::PFCandidateCollection>
69 std::map<reco::GsfElectronRef,reco::PFCandidatePtr> electronCandidateMap;
72 std::ostringstream err;
73 err <<
" Problem in PFLinker: no electron collection called " << inputTagGsfElectrons_ << std::endl;
79 status=fetchCollection<reco::PhotonCollection>(
photons,
83 std::ostringstream err;
84 err <<
" Problem in PFLinker: no photon collection called " << inputTagPhotons_ << std::endl;
89 std::map<reco::PhotonRef,reco::PFCandidatePtr> photonCandidateMap;
94 status=fetchCollection<reco::MuonToMuonMap>(muonMap,
97 std::map<reco::MuonRef,reco::PFCandidatePtr> muonCandidateMap;
102 std::ostringstream err;
103 err <<
" Problem in PFLinker: no muon collection called " << inputTagMuons_ << std::endl;
109 for(
unsigned icol=0;icol<nColPF;++icol) {
111 bool status=fetchCollection<reco::PFCandidateCollection>(
pfCandidates,
115 unsigned ncand=(
status)?pfCandidates->size():0;
117 for(
unsigned i=0;
i<ncand; ++
i) {
127 if ( !(isphoton || iselectron || hasNonNullMuonRef)){pfCandidates_p->push_back(cand);
continue;}
130 if (hasNonNullMuonRef) {
133 muonCandidateMap[muRef] = candPtr;
141 std::vector<reco::GsfElectron>::const_iterator itcheck=find_if(gsfElectrons->begin(),gsfElectrons->end(),myEqual);
142 if(itcheck==gsfElectrons->end()) {
143 std::ostringstream err;
144 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
151 electronCandidateMap[electronRef] = candPtr;
158 std::vector<reco::Photon>::const_iterator itcheck=find_if(photons->begin(),photons->end(),myEqual);
159 if(itcheck==photons->end()) {
160 std::ostringstream err;
161 err <<
" Problem in PFLinker: no Photon " << std::endl;
168 photonCandidateMap[photonRef] = candPtr;
171 pfCandidates_p->push_back(cand);
184 electronCandidateMap,
198 iEvent.getByLabel(inputTagMuons_.label(),
muons);
200 pfMapMuons = fillValueMap<reco::MuonCollection>(
iEvent,
201 inputTagMuons_.label(),
207 std::auto_ptr<edm::ValueMap<reco::PFCandidatePtr> >
211 *pfMapMerged += pfMapGsfElectrons;
212 *pfMapMerged += pfMapPhotons;
227 std::ostringstream err;
228 err<<
" cannot get " <<tag<<std::endl;
236 template<
typename TYPE>
248 unsigned nObj=inputObjCollection->size();
249 std::vector<reco::PFCandidatePtr>
values(nObj);
251 for(
unsigned iobj=0; iobj < nObj; ++iobj) {
254 MapTYPE_it itcheck = mapToTheCandidate.find(objRef);
258 if(itcheck != mapToTheCandidate.end())
261 values[iobj] = candPtr;
264 filler.
insert(inputObjCollection,values.begin(),values.end());
267 event.put(pfMap_p,label);
T getParameter(std::string const &) const
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
float mva_nothing_gamma() const
mva for gamma detection
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...
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
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
edm::InputTag inputTagMuons_
Input Muons.
bool isNonnull() const
Checks for non-null.
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
bool fetchCollection(edm::Handle< T > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::MuonRef muonRef() const
edm::InputTag inputTagPhotons_
Input Photons.
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
bool fillMuonRefs_
Set muon refs and produce the value map?
edm::InputTag inputTagGsfElectrons_
Input GsfElectrons.
void setPhotonRef(const reco::PhotonRef &phRef)
set ref to the corresponding reco::Photon if any
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)
std::vector< edm::InputTag > inputTagPFCandidates_
Input PFCandidates.
virtual ParticleType particleId() const
std::string nameOutputMergedPF_
name of output merged ValueMap
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any