1 #ifndef PhysicsTools_PatUtils_ShiftedParticleProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedParticleProducerT_h
45 if ( cfg.
exists(
"binning") ) {
46 typedef std::vector<edm::ParameterSet> vParameterSet;
47 vParameterSet cfgBinning = cfg.
getParameter<vParameterSet>(
"binning");
48 for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
49 cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
53 double uncertainty = cfg.
getParameter<
double>(
"uncertainty");
57 produces<ParticleCollection>();
61 for (
typename std::vector<binningEntryType*>::const_iterator it =
binning_.begin();
76 for (
typename ParticleCollection::const_iterator originalParticle = originalParticles->begin();
77 originalParticle != originalParticles->end(); ++originalParticle ) {
79 double uncertainty = 0.;
80 for (
typename std::vector<binningEntryType*>::iterator binningEntry =
binning_.begin();
81 binningEntry !=
binning_.end(); ++binningEntry ) {
82 if ( (!(*binningEntry)->binSelection_) || (*(*binningEntry)->binSelection_)(*originalParticle) ) {
83 uncertainty = (*binningEntry)->binUncertainty_;
91 shiftedParticleP4 *= (1. +
shift);
93 T shiftedParticle(*originalParticle);
94 shiftedParticle.setP4(shiftedParticleP4);
96 shiftedParticles->push_back(shiftedParticle);
99 evt.
put(shiftedParticles);
T getParameter(std::string const &) const
binningEntryType(const edm::ParameterSet &cfg)
binningEntryType(double uncertainty)
void produce(edm::Event &evt, const edm::EventSetup &es)
std::vector< binningEntryType * > binning_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
ShiftedParticleProducerT(const edm::ParameterSet &cfg)
StringCutObjectSelector< T > * binSelection_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
~ShiftedParticleProducerT()
static unsigned int const shift
std::vector< T > ParticleCollection