49 produces<PFOutputCollection>();
50 produces< edm::ValueMap<reco::CandidatePtr> >();
57 std::vector<const reco::Candidate*> phoCands;
58 std::vector<uint16_t> phoIndx;
72 for(
const auto & pho : *pfCol) {
74 if(pho.pt() <
pt_)
continue;
75 if(
std::abs(pho.pdgId())!=22)
continue;
76 if(fabs(pho.eta()) <
eta_ ) {
77 phoIndx.push_back(iC);
78 phoCands.push_back(&pho);
91 bool passObject =
false;
92 if(itPho->isPhoton() &&
usePhotonId_) passObject = (*photonId) [phoCol->
ptrAt(iC)];
93 if(itPho->pt() <
pt_)
continue;
99 if(fabs(ref->eta()) <
eta_ ) {
100 phoIndx.push_back(ref.key());
101 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
107 if(pElectron !=
nullptr) {
109 if(fabs(ref->eta()) <
eta_ ) {
110 phoIndx.push_back(ref.key());
111 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
115 for(
const edm::Ref<std::vector<reco::PFCandidate> > & ref : (*reco2pf)[phoCol->
ptrAt(iC)] ) {
116 if(fabs(ref->eta()) <
eta_ ) {
117 phoIndx.push_back(ref.key());
118 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
130 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
132 std::vector<float> lWeights;
135 std::set<int> foundPhoIndex;
145 for(std::vector<const reco::Candidate*>::iterator itPho = phoCands.begin(); itPho!=phoCands.end(); itPho++) {
147 if((!
matchPFCandidate(&(*itPF),*itPho))||(foundPhoIndex.count(iPho)!=0))
continue;
149 if(!
useValueMap_ && itPF->pt() != 0) pWeight = pWeight*(phoCands[iPho]->
pt()/itPF->pt());
150 if(!
useValueMap_ && itPF->pt() == 0) pVec.SetPxPyPzE(phoCands[iPho]->px()*pWeight,phoCands[iPho]->py()*pWeight,phoCands[iPho]->pz()*pWeight,phoCands[iPho]->energy()*pWeight);
151 foundPhoIndex.insert(iPho);
155 for(std::vector<uint16_t>::const_iterator itPho = phoIndx.begin(); itPho!=phoIndx.end(); itPho++) {
157 if(pupCol->
refAt(iPF).key() != *itPho)
continue;
159 if(!
useValueMap_ && itPF->pt() != 0) pWeight = pWeight*(phoCands[iPho]->
pt()/itPF->pt());
160 if(!
useValueMap_ && itPF->pt() == 0) pVec.SetPxPyPzE(phoCands[iPho]->px()*pWeight,phoCands[iPho]->py()*pWeight,phoCands[iPho]->pz()*pWeight,phoCands[iPho]->energy()*pWeight);
161 foundPhoIndex.insert(iPho);
164 if(itPF->pt() != 0) pVec.SetPxPyPzE(itPF->px()*pWeight,itPF->py()*pWeight,itPF->pz()*pWeight,itPF->energy()*pWeight);
166 lWeights.push_back(pWeight);
168 puppiP4s.push_back( pVec );
174 for(
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
175 if(foundPhoIndex.count(iPho)!=0)
continue;
183 puppiP4s.push_back( pVec );
188 for(
unsigned int ic=0, nc = pupCol->
size(); ic < nc; ++ic) {
200 if(iPF->
pdgId() != iPho->
pdgId())
return false;
202 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
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
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho)
void produce(edm::Event &, const edm::EventSetup &) override
virtual double eta() const =0
momentum pseudorapidity
T const * product() const
edm::EDGetTokenT< edm::ValueMap< float > > tokenWeights_
Analysis-level electron class.
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
void setP4(const LorentzVector &p4) final
set 4-momentum
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)