86 produces<PFOutputCollection>();
87 produces<edm::ValueMap<reco::CandidatePtr>>();
94 std::vector<const reco::Candidate *> phoCands;
95 std::vector<uint16_t> phoIndx;
110 for (
const auto &pho : *pfCol) {
116 if (fabs(pho.eta()) <
eta_) {
117 phoIndx.push_back(iC);
118 phoCands.push_back(&pho);
132 bool passObject =
false;
134 passObject = (*photonId)[phoCol->
ptrAt(iC)];
135 if (itPho->pt() <
pt_)
141 if (pPho !=
nullptr) {
143 if (fabs(ref->eta()) <
eta_) {
144 phoIndx.push_back(ref.key());
145 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
151 if (pElectron !=
nullptr) {
153 if (fabs(ref->eta()) <
eta_) {
154 phoIndx.push_back(ref.key());
155 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
159 for (
const edm::Ref<std::vector<reco::PFCandidate>> &ref : (*reco2pf)[phoCol->
ptrAt(iC)]) {
160 if (fabs(ref->eta()) <
eta_) {
161 phoIndx.push_back(ref.key());
162 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
174 std::vector<reco::CandidatePtr>
values(hPFProduct->size());
176 std::vector<float> lWeights;
179 std::set<int> foundPhoIndex;
187 pWeight = (*pupWeights)[pupCol->
ptrAt(iPF)];
190 for (std::vector<const reco::Candidate *>::iterator itPho = phoCands.begin(); itPho != phoCands.end(); itPho++) {
192 if ((!
matchPFCandidate(&(*itPF), *itPho)) || (foundPhoIndex.count(iPho) != 0))
196 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
198 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
199 phoCands[iPho]->py() * pWeight,
200 phoCands[iPho]->pz() * pWeight,
201 phoCands[iPho]->energy() * pWeight);
202 foundPhoIndex.insert(iPho);
206 for (std::vector<uint16_t>::const_iterator itPho = phoIndx.begin(); itPho != phoIndx.end(); itPho++) {
208 if (pupCol->
refAt(iPF).key() != *itPho)
212 pWeight = pWeight * (phoCands[iPho]->
pt() / itPF->pt());
214 pVec.SetPxPyPzE(phoCands[iPho]->px() * pWeight,
215 phoCands[iPho]->py() * pWeight,
216 phoCands[iPho]->pz() * pWeight,
217 phoCands[iPho]->energy() * pWeight);
218 foundPhoIndex.insert(iPho);
222 pVec.SetPxPyPzE(itPF->px() * pWeight, itPF->py() * pWeight, itPF->pz() * pWeight, itPF->energy() * pWeight);
224 lWeights.push_back(pWeight);
226 puppiP4s.push_back(pVec);
232 for (
unsigned int iPho = 0; iPho < phoCands.size(); iPho++) {
233 if (foundPhoIndex.count(iPho) != 0)
239 pVec.SetPxPyPzE(phoCands[iPho]->px() *
weight_,
240 phoCands[iPho]->py() *
weight_,
241 phoCands[iPho]->pz() *
weight_,
245 puppiP4s.push_back(pVec);
250 for (
unsigned int ic = 0, nc = pupCol->
size(); ic < nc; ++ic) {
265 for (
unsigned int i0 = 0; i0 <
pdgIds_.size(); i0++) {
std::vector< int32_t > pdgIds_
Analysis-level Photon class.
PuppiPhoton(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Ptr< value_type > ptrAt(size_type i) const
#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...
edm::View< reco::PFCandidate > PFView
edm::View< reco::Candidate > CandidateView
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
RefToBase< value_type > refAt(size_type i) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
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
T const * product() const
T getParameter(std::string const &) const
Analysis-level electron class.
ParticleType translatePdgIdToType(int pdgid) const
edm::EDGetTokenT< CandidateView > tokenPuppiCandidates_
std::unique_ptr< PFOutputCollection > corrCandidates_
std::vector< double > dRMatch_
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
math::XYZTLorentzVector LorentzVector
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...
std::vector< LorentzVector > LorentzVectorCollection
void setP4(const LorentzVector &p4) final
set 4-momentum
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
edm::EDGetTokenT< CandidateView > tokenPhotonCandidates_