84 produces<PFOutputCollection>();
85 produces<edm::ValueMap<reco::CandidatePtr>>();
92 std::vector<const reco::Candidate *> phoCands;
93 std::vector<uint16_t> phoIndx;
108 for (
const auto &pho : *pfCol) {
114 if (fabs(pho.eta()) <
eta_) {
115 phoIndx.push_back(iC);
116 phoCands.push_back(&pho);
130 bool passObject =
false;
132 passObject = (*photonId)[phoCol->
ptrAt(iC)];
133 if (itPho->pt() <
pt_)
139 if (pPho !=
nullptr) {
141 if (fabs(ref->eta()) <
eta_) {
142 phoIndx.push_back(ref.key());
143 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
149 if (pElectron !=
nullptr) {
151 if (fabs(ref->eta()) <
eta_) {
152 phoIndx.push_back(ref.key());
153 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
157 for (
const edm::Ref<std::vector<reco::PFCandidate>> &ref : (*reco2pf)[phoCol->
ptrAt(iC)]) {
158 if (fabs(ref->eta()) <
eta_) {
159 phoIndx.push_back(ref.key());
160 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
172 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
174 std::vector<float> lWeights;
177 std::set<int> foundPhoIndex;
185 pWeight = (*pupWeights)[pupCol->
ptrAt(iPF)];
188 for (std::vector<const reco::Candidate *>::iterator itPho = phoCands.begin(); itPho != phoCands.end(); itPho++) {
190 if ((!
matchPFCandidate(&(*itPF), *itPho)) || (foundPhoIndex.count(iPho) != 0))
194 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
196 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
197 phoCands[iPho]->py() * pWeight,
198 phoCands[iPho]->pz() * pWeight,
199 phoCands[iPho]->energy() * pWeight);
200 foundPhoIndex.insert(iPho);
204 for (std::vector<uint16_t>::const_iterator itPho = phoIndx.begin(); itPho != phoIndx.end(); itPho++) {
206 if (pupCol->
refAt(iPF).key() != *itPho)
210 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
212 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
213 phoCands[iPho]->py() * pWeight,
214 phoCands[iPho]->pz() * pWeight,
215 phoCands[iPho]->energy() * pWeight);
216 foundPhoIndex.insert(iPho);
220 pVec.SetPxPyPzE(itPF->px() * pWeight, itPF->py() * pWeight, itPF->pz() * pWeight, itPF->energy() * pWeight);
222 lWeights.push_back(pWeight);
224 puppiP4s.push_back(pVec);
230 for (
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
231 if (foundPhoIndex.count(iPho) != 0)
237 pVec.SetPxPyPzE(phoCands[iPho]->
px() *
weight_,
239 phoCands[iPho]->pz() *
weight_,
243 puppiP4s.push_back(pVec);
248 for (
unsigned int ic = 0, nc = pupCol->
size(); ic < nc; ++ic) {
263 for (
unsigned int i0 = 0; i0 <
pdgIds_.size(); i0++) {
std::vector< int32_t > pdgIds_
Analysis-level Photon class.
T getParameter(std::string const &) const
PuppiPhoton(const edm::ParameterSet &)
RefToBase< value_type > refAt(size_type i) const
Ptr< value_type > ptrAt(size_type i) const
#define DEFINE_FWK_MODULE(type)
T const * product() const
edm::View< reco::PFCandidate > PFView
edm::View< reco::Candidate > CandidateView
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::ValueMap< float > > tokenWeights_
edm::EDGetTokenT< edm::ValueMap< bool > > tokenPhotonId_
edm::EDGetTokenT< CandidateView > tokenPFCandidates_
Abs< T >::type abs(const T &t)
bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho)
virtual int pdgId() const =0
PDG identifier.
std::vector< reco::PFCandidate > PFOutputCollection
void produce(edm::Event &, const edm::EventSetup &) override
Analysis-level electron class.
edm::EDGetTokenT< CandidateView > tokenPuppiCandidates_
std::unique_ptr< PFOutputCollection > corrCandidates_
std::vector< double > dRMatch_
Particle reconstructed by the particle flow algorithm.
ParticleType translatePdgIdToType(int pdgid) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator begin() const
math::XYZTLorentzVector LorentzVector
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
std::vector< LorentzVector > LorentzVectorCollection
const_iterator end() const
void setP4(const LorentzVector &p4) final
set 4-momentum
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
edm::EDGetTokenT< CandidateView > tokenPhotonCandidates_