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);
225 pCand.setSourceCandidatePtr(itPF->sourceCandidatePtr(0));
230 for (
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
231 if (foundPhoIndex.count(iPho) != 0)
235 pCand.setSourceCandidatePtr(phoCands[iPho]->sourceCandidatePtr(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) {
Analysis-level Photon class.
T const * product() const
edm::View< reco::Candidate > CandidateView
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
edm::EDGetTokenT< edm::ValueMap< float > > tokenWeights_
edm::EDGetTokenT< edm::ValueMap< bool > > tokenPhotonId_
edm::EDGetTokenT< CandidateView > tokenPFCandidates_
Abs< T >::type abs(const T &t)
math::XYZTLorentzVector LorentzVector
bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho)
std::vector< LorentzVector > LorentzVectorCollection
Analysis-level electron class.
edm::EDGetTokenT< CandidateView > tokenPuppiCandidates_
std::unique_ptr< PFOutputCollection > corrCandidates_
Particle reconstructed by the particle flow algorithm.
ParticleType translatePdgIdToType(int pdgid) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
edm::EDGetTokenT< CandidateView > tokenPhotonCandidates_