59 if (
cfg.exists(
"energyDependency")) {
64 std::unique_ptr<StringCutObjectSelector<reco::Candidate>>
binSelection_;
83 if (
cfg.exists(
"binning")) {
84 typedef std::vector<edm::ParameterSet> vParameterSet;
85 vParameterSet cfgBinning =
cfg.getParameter<vParameterSet>(
"binning");
86 for (vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin(); cfgBinningEntry != cfgBinning.end();
95 produces<reco::CandidateCollection>();
99 for (std::vector<binningEntryType*>::const_iterator it =
binning_.begin(); it !=
binning_.end(); ++it) {
112 auto shiftedParticles = std::make_unique<reco::CandidateCollection>();
114 for (
unsigned i = 0;
i < originalParticles->
size(); ++
i) {
120 weight = (*weights)[particlePtr];
125 double uncertainty =
getUncShift(weightedParticle);
131 shiftedParticleP4 *= (1. +
shift);
133 std::unique_ptr<reco::Candidate> shiftedParticle = std::make_unique<reco::LeafCandidate>(originalParticle);
134 shiftedParticle->setP4(shiftedParticleP4);
136 shiftedParticles->push_back(shiftedParticle.release());
145 for (std::vector<binningEntryType*>::iterator binningEntry =
binning_.begin(); binningEntry !=
binning_.end();
147 if ((!(*binningEntry)->binSelection_) || (*(*binningEntry)->binSelection_)(originalParticle)) {
148 if ((*binningEntry)->energyDep_)
149 valx = originalParticle.
energy();
151 valx = originalParticle.
pt();
153 valy = originalParticle.
eta();
154 return (*binningEntry)->binUncFormula_->Eval(valx, valy);
~ShiftedParticleProducer() override
edm::View< reco::Candidate > CandidateView
virtual double energy() const =0
energy
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::string binUncertainty_
Ptr< value_type > ptrAt(size_type i) const
ProductID id() const
Accessor for product ID.
constexpr bool isNotFinite(T x)
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< CandidateView > srcToken_
constexpr bool isUninitialized() const noexcept
bool getByToken(EDGetToken token, Handle< PROD > &result) const
binningEntryType(std::string uncertainty, std::string moduleLabel)
void produce(edm::Event &evt, const edm::EventSetup &es) override
ShiftedParticleProducer(const edm::ParameterSet &cfg)
double getUncShift(const reco::Candidate &originalParticle)
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
binningEntryType(const edm::ParameterSet &cfg, std::string moduleLabel)
const_reference at(size_type pos) const
std::unique_ptr< TF2 > binUncFormula_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::unique_ptr< StringCutObjectSelector< reco::Candidate > > binSelection_
static unsigned int const shift
virtual CandidatePtr sourceCandidatePtr(size_type i) const
virtual size_t numberOfSourceCandidatePtrs() const =0
void setP4(const LorentzVector &p4) final
set 4-momentum
std::vector< binningEntryType * > binning_
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector