17 = iConfig.
getParameter<std::vector<edm::InputTag> >(
"PFCandidate");
29 = iConfig.
getParameter<std::string>(
"ValueMapElectrons");
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());
64 std::auto_ptr<reco::PFCandidateCollection>
71 std::map<reco::GsfElectronRef,reco::PFCandidatePtr> electronCandidateMap;
74 std::ostringstream err;
75 err <<
" Problem in PFLinker: no electron collection called " << inputTagGsfElectrons_ << std::endl;
81 status=fetchCollection<reco::PhotonCollection>(
photons,
85 std::ostringstream err;
86 err <<
" Problem in PFLinker: no photon collection called " << inputTagPhotons_ << std::endl;
91 std::map<reco::PhotonRef,reco::PFCandidatePtr> photonCandidateMap;
96 status=fetchCollection<reco::MuonToMuonMap>(muonMap,
99 std::map<reco::MuonRef,reco::PFCandidatePtr> muonCandidateMap;
104 std::ostringstream err;
105 err <<
" Problem in PFLinker: no muon collection called " << inputTagMuons_ << std::endl;
111 for(
unsigned icol=0;icol<nColPF;++icol) {
113 bool status=fetchCollection<reco::PFCandidateCollection>(
pfCandidates,
117 unsigned ncand=(
status)?pfCandidates->size():0;
119 for(
unsigned i=0;
i<ncand; ++
i) {
129 if ( !(isphoton || iselectron || hasNonNullMuonRef)){pfCandidates_p->push_back(cand);
continue;}
132 if (hasNonNullMuonRef) {
135 muonCandidateMap[muRef] = candPtr;
143 std::vector<reco::GsfElectron>::const_iterator itcheck=find_if(gsfElectrons->begin(),gsfElectrons->end(),myEqual);
144 if(itcheck==gsfElectrons->end()) {
145 std::ostringstream err;
146 err <<
" Problem in PFLinker: no GsfElectron " << std::endl;
153 electronCandidateMap[electronRef] = candPtr;
160 std::vector<reco::Photon>::const_iterator itcheck=find_if(photons->begin(),photons->end(),myEqual);
161 if(itcheck==photons->end()) {
162 std::ostringstream err;
163 err <<
" Problem in PFLinker: no Photon " << std::endl;
170 photonCandidateMap[photonRef] = candPtr;
173 pfCandidates_p->push_back(cand);
186 electronCandidateMap,
200 iEvent.getByLabel(inputTagMuons_.label(),
muons);
202 pfMapMuons = fillValueMap<reco::MuonCollection>(
iEvent,
203 inputTagMuons_.label(),
209 std::auto_ptr<edm::ValueMap<reco::PFCandidatePtr> >
213 *pfMapMerged += pfMapGsfElectrons;
214 *pfMapMerged += pfMapPhotons;
229 std::ostringstream err;
230 err<<
" cannot get " <<tag<<std::endl;
238 template<
typename TYPE>
250 unsigned nObj=inputObjCollection->size();
251 std::vector<reco::PFCandidatePtr>
values(nObj);
253 for(
unsigned iobj=0; iobj < nObj; ++iobj) {
256 MapTYPE_it itcheck = mapToTheCandidate.find(objRef);
260 if(itcheck != mapToTheCandidate.end())
263 values[iobj] = candPtr;
266 filler.
insert(inputObjCollection,values.begin(),values.end());
269 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
virtual void produce(edm::Event &, const edm::EventSetup &)
void insert(const H &h, I begin, I end)
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.
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
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