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_)
105 if (pPho !=
nullptr) {
107 if (fabs(ref->eta()) <
eta_) {
108 phoIndx.push_back(ref.key());
109 phoCands.push_back(&(*(pfCol->
ptrAt(ref.key()))));
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;
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++) {
std::vector< int32_t > pdgIds_
T getParameter(std::string const &) const
Analysis-level Photon class.
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
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)
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.
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)
std::vector< reco::PFCandidate > PFOutputCollection
void produce(edm::Event &, const edm::EventSetup &) override
virtual double eta() const =0
momentum pseudorapidity
T const * product() 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_
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)
edm::EDGetTokenT< CandidateView > tokenPhotonCandidates_