1 #ifndef PhysicsTools_PatUtils_ShiftedParticleProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedParticleProducerT_h
43 if ( cfg.
exists(
"binning") ) {
44 typedef std::vector<edm::ParameterSet> vParameterSet;
45 vParameterSet cfgBinning = cfg.
getParameter<vParameterSet>(
"binning");
46 for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
47 cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
51 double uncertainty = cfg.
getParameter<
double>(
"uncertainty");
55 produces<ParticleCollection>();
59 for (
typename std::vector<binningEntryType*>::const_iterator it =
binning_.begin();
74 for (
typename ParticleCollection::const_iterator originalParticle = originalParticles->begin();
75 originalParticle != originalParticles->end(); ++originalParticle ) {
77 double uncertainty = 0.;
78 for (
typename std::vector<binningEntryType*>::iterator binningEntry =
binning_.begin();
79 binningEntry !=
binning_.end(); ++binningEntry ) {
80 if ( (!(*binningEntry)->binSelection_) || (*(*binningEntry)->binSelection_)(*originalParticle) ) {
81 uncertainty = (*binningEntry)->binUncertainty_;
89 shiftedParticleP4 *= (1. +
shift);
91 T shiftedParticle(*originalParticle);
92 shiftedParticle.setP4(shiftedParticleP4);
94 shiftedParticles->push_back(shiftedParticle);
97 evt.
put(shiftedParticles);
T getParameter(std::string const &) const
binningEntryType(const edm::ParameterSet &cfg)
edm::EDGetTokenT< ParticleCollection > srcToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
~ShiftedParticleProducerT()
static unsigned int const shift
std::vector< T > ParticleCollection