37 : src_(iConfig.getParameter<edm::
InputTag>(
"src")),
38 pfCharged_(iConfig.getParameter<edm::
InputTag>(
"chargedFromPV")),
39 pfPU_(iConfig.getParameter<edm::
InputTag>(
"chargedFromPU")) {
40 produces<reco::PFCandidateCollection>();
77 if (cand.charge() != 0) {
80 <<
"Trying to reweight charged particle... saving it to output collection without any change";
82 (out->back()).setParticleType((out->back()).translatePdgIdToType(cand.pdgId()));
88 double eta = cand.eta();
89 double phi = cand.phi();
91 double sum = (chCand.pt() * chCand.pt()) / (
deltaR2(eta, phi, chCand.eta(), chCand.phi()));
95 sumNPU = 0.5 *
log(sumNPU);
98 double sum = (puCand.pt() * puCand.pt()) / (
deltaR2(eta, phi, puCand.eta(), puCand.phi()));
102 sumPU = 0.5 *
log(sumPU);
106 if (sumNPU + sumPU > 0)
107 neutral.
setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.
p4());
108 out->push_back(neutral);
~DeltaBetaWeights() override
edm::EDGetTokenT< edm::View< reco::Candidate > > pfPU_token
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static std::vector< std::string > checklist log
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCharged_token
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &, const edm::EventSetup &) override
const LorentzVector & p4() const final
four-momentum Lorentz vector
void setParticleType(ParticleType type)
set Particle Type
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
ParticleType translatePdgIdToType(int pdgid) const
edm::EDGetTokenT< edm::View< reco::Candidate > > src_token
Particle reconstructed by the particle flow algorithm.
Log< level::Warning, false > LogWarning
void setP4(const LorentzVector &p4) final
set 4-momentum
DeltaBetaWeights(const edm::ParameterSet &)