50 produces<PFOutputCollection>();
51 produces<edm::ValueMap<reco::CandidatePtr>>();
58 std::vector<const reco::Candidate *> phoCands;
59 std::vector<uint16_t> phoIndx;
74 for (
const auto &pho : *pfCol) {
80 if (fabs(pho.eta()) <
eta_) {
81 phoIndx.push_back(iC);
82 phoCands.push_back(&pho);
96 bool passObject =
false;
98 passObject = (*photonId)[phoCol->
ptrAt(iC)];
99 if (itPho->pt() <
pt_)
104 const pat::Photon *pPho = dynamic_cast<const pat::Photon *>(&(*itPho));
105 if (pPho !=
nullptr) {
107 if (fabs(ref->eta()) <
eta_) {
108 phoIndx.push_back(ref.key());
109 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
114 const pat::Electron *pElectron = dynamic_cast<const pat::Electron *>(&(*itPho));
115 if (pElectron !=
nullptr) {
117 if (fabs(ref->eta()) <
eta_) {
118 phoIndx.push_back(ref.key());
119 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
123 for (
const edm::Ref<std::vector<reco::PFCandidate>> &ref : (*reco2pf)[phoCol->
ptrAt(iC)]) {
124 if (fabs(ref->eta()) <
eta_) {
125 phoIndx.push_back(ref.key());
126 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
138 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
140 std::vector<float> lWeights;
143 std::set<int> foundPhoIndex;
146 const reco::PFCandidate *pPF = dynamic_cast<const reco::PFCandidate *>(&(*itPF));
151 pWeight = (*pupWeights)[pupCol->
ptrAt(iPF)];
154 for (std::vector<const reco::Candidate *>::iterator itPho = phoCands.begin(); itPho != phoCands.end(); itPho++) {
156 if ((!
matchPFCandidate(&(*itPF), *itPho)) || (foundPhoIndex.count(iPho) != 0))
160 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
162 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
163 phoCands[iPho]->py() * pWeight,
164 phoCands[iPho]->pz() * pWeight,
165 phoCands[iPho]->energy() * pWeight);
166 foundPhoIndex.insert(iPho);
170 for (std::vector<uint16_t>::const_iterator itPho = phoIndx.begin(); itPho != phoIndx.end(); itPho++) {
172 if (pupCol->
refAt(iPF).key() != *itPho)
176 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
178 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
179 phoCands[iPho]->py() * pWeight,
180 phoCands[iPho]->pz() * pWeight,
181 phoCands[iPho]->energy() * pWeight);
182 foundPhoIndex.insert(iPho);
186 pVec.SetPxPyPzE(itPF->px() * pWeight, itPF->py() * pWeight, itPF->pz() * pWeight, itPF->energy() * pWeight);
188 lWeights.push_back(pWeight);
190 puppiP4s.push_back(pVec);
196 for (
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
197 if (foundPhoIndex.count(iPho) != 0)
203 pVec.SetPxPyPzE(phoCands[iPho]->
px() *
weight_,
205 phoCands[iPho]->pz() *
weight_,
209 puppiP4s.push_back(pVec);
214 for (
unsigned int ic = 0, nc = pupCol->
size(); ic < nc; ++ic) {
229 for (
unsigned int i0 = 0; i0 <
pdgIds_.size(); i0++) {