1 #ifndef PhysicsTools_PatUtils_ShiftedParticleProducerT_h 2 #define PhysicsTools_PatUtils_ShiftedParticleProducerT_h 41 if (cfg.
exists(
"binning")) {
42 typedef std::vector<edm::ParameterSet> vParameterSet;
43 vParameterSet cfgBinning = cfg.
getParameter<vParameterSet>(
"binning");
44 for (vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin(); cfgBinningEntry != cfgBinning.end();
49 double uncertainty = cfg.
getParameter<
double>(
"uncertainty");
53 produces<ParticleCollection>();
56 for (
typename std::vector<binningEntryType*>::const_iterator it =
binning_.begin(); it !=
binning_.end(); ++it) {
66 auto shiftedParticles = std::make_unique<ParticleCollection>();
68 for (
typename ParticleCollection::const_iterator originalParticle = originalParticles->begin();
69 originalParticle != originalParticles->end();
71 double uncertainty = 0.;
72 for (
typename std::vector<binningEntryType*>::iterator binningEntry =
binning_.begin();
75 if ((!(*binningEntry)->binSelection_) || (*(*binningEntry)->binSelection_)(*originalParticle)) {
76 uncertainty = (*binningEntry)->binUncertainty_;
86 shiftedParticleP4 *= (1. +
shift);
88 T shiftedParticle(*originalParticle);
89 shiftedParticle.setP4(shiftedParticleP4);
91 shiftedParticles->push_back(shiftedParticle);
T getParameter(std::string const &) const
binningEntryType(const edm::ParameterSet &cfg)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< ParticleCollection > srcToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr bool isNotFinite(T x)
binningEntryType(double uncertainty)
std::vector< binningEntryType * > binning_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
ShiftedParticleProducerT(const edm::ParameterSet &cfg)
StringCutObjectSelector< T > * binSelection_
void produce(edm::Event &evt, const edm::EventSetup &es) override
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static unsigned int const shift
std::vector< T > ParticleCollection
~ShiftedParticleProducerT() override