50 produces<PFOutputCollection>();
51 produces< edm::ValueMap<reco::CandidatePtr> >();
65 std::vector<const reco::Candidate*> phoCands;
66 std::vector<uint16_t> phoIndx;
81 bool passObject =
false;
82 if(itPho->isPhoton() &&
usePhotonId_) passObject = (*photonId) [phoCol->
ptrAt(iC)];
83 if(itPho->pt() <
pt_)
continue;
89 if(fabs(ref->eta()) <
eta_ ) {
90 phoIndx.push_back(ref.key());
91 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
99 if(fabs(ref->eta()) <
eta_ ) {
100 phoIndx.push_back(ref.key());
101 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
105 for(
const edm::Ref<std::vector<reco::PFCandidate> > & ref : (*reco2pf)[phoCol->
ptrAt(iC)] ) {
106 if(fabs(ref->eta()) <
eta_ ) {
107 phoIndx.push_back(ref.key());
108 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
119 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
121 std::vector<float> lWeights;
124 std::set<int> foundPhoIndex;
134 for(std::vector<const reco::Candidate*>::iterator itPho = phoCands.begin(); itPho!=phoCands.end(); itPho++) {
136 if((!
matchPFCandidate(&(*itPF),*itPho))||(foundPhoIndex.count(iPho)!=0))
continue;
138 if(!
useValueMap_ && itPF->pt() != 0) pWeight = pWeight*(phoCands[iPho]->
pt()/itPF->pt());
139 if(!
useValueMap_ && itPF->pt() == 0) pVec.SetPxPyPzE(phoCands[iPho]->px()*pWeight,phoCands[iPho]->py()*pWeight,phoCands[iPho]->pz()*pWeight,phoCands[iPho]->energy()*pWeight);
140 foundPhoIndex.insert(iPho);
144 for(std::vector<uint16_t>::const_iterator itPho = phoIndx.begin(); itPho!=phoIndx.end(); itPho++) {
146 if(pupCol->
refAt(iPF).key() != *itPho)
continue;
148 if(!
useValueMap_ && itPF->pt() != 0) pWeight = pWeight*(phoCands[iPho]->
pt()/itPF->pt());
149 if(!
useValueMap_ && itPF->pt() == 0) pVec.SetPxPyPzE(phoCands[iPho]->px()*pWeight,phoCands[iPho]->py()*pWeight,phoCands[iPho]->pz()*pWeight,phoCands[iPho]->energy()*pWeight);
150 foundPhoIndex.insert(iPho);
153 if(itPF->pt() != 0) pVec.SetPxPyPzE(itPF->px()*pWeight,itPF->py()*pWeight,itPF->pz()*pWeight,itPF->energy()*pWeight);
155 lWeights.push_back(pWeight);
157 puppiP4s.push_back( pVec );
163 for(
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
164 if(foundPhoIndex.count(iPho)!=0)
continue;
169 pVec.SetPxPyPzE(phoCands[iPho]->px()*
weight_,phoCands[iPho]->py()*
weight_,phoCands[iPho]->pz()*
weight_,phoCands[iPho]->energy()*
weight_);
172 puppiP4s.push_back( pVec );
177 for(
unsigned int ic=0, nc = pupCol->
size(); ic < nc; ++ic) {
190 for(
unsigned int i0 = 0; i0 <
pdgIds_.size(); i0++) {
std::vector< int32_t > pdgIds_
T getParameter(std::string const &) const
Analysis-level Photon class.
edm::EDGetTokenT< CandidateView > tokenPhotonCandidates_
PuppiPhoton(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Ptr< value_type > ptrAt(size_type i) const
std::vector< reco::PFCandidate > PFOutputCollection
#define DEFINE_FWK_MODULE(type)
void insert(const H &h, I begin, I end)
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
edm::EDGetTokenT< CandidateView > tokenPuppiCandidates_
std::unique_ptr< PFOutputCollection > corrCandidates_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
RefToBase< value_type > refAt(size_type i) const
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
virtual void produce(edm::Event &, const edm::EventSetup &)
bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho)
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual double eta() const =0
momentum pseudorapidity
T const * product() const
edm::EDGetTokenT< edm::ValueMap< float > > tokenWeights_
Analysis-level electron class.
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
ParticleType translatePdgIdToType(int pdgid) const
std::vector< double > dRMatch_
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::ValueMap< bool > > tokenPhotonId_
const_iterator end() const
math::XYZTLorentzVector LorentzVector
edm::EDGetTokenT< CandidateView > tokenPFCandidates_
virtual double phi() const =0
momentum azimuthal angle
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
std::vector< LorentzVector > LorentzVectorCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)