CMS 3D CMS Logo

ObjectModifier.h
Go to the documentation of this file.
1 #ifndef __PhysicsTools_PatAlgos_ObjectModifier_h__
2 #define __PhysicsTools_PatAlgos_ObjectModifier_h__
3 
5 #include <memory>
6 
7 namespace pat {
8  template<class T>
9  class ObjectModifier {
10  public:
11  typedef std::unique_ptr<ModifyObjectValueBase> ModifierPointer;
12 
15 
16  void setEvent(const edm::Event& event) {
17  for( unsigned i = 0; i < modifiers_.size(); ++i )
18  modifiers_[i]->setEvent(event);
19  }
20 
22  for( unsigned i = 0; i < modifiers_.size(); ++i )
23  modifiers_[i]->setEventContent(setup);
24  }
25 
26  void modify(T& obj) const {
27  for( unsigned i = 0; i < modifiers_.size(); ++i )
28  modifiers_[i]->modifyObject(obj);
29  }
30 
31  private:
32  std::vector<ModifierPointer> modifiers_;
33  };
34 
35  template<class T>
37  const std::vector<edm::ParameterSet>& mods =
38  conf.getParameterSetVector("modifications");
39  for(unsigned i = 0; i < mods.size(); ++i ) {
40  const edm::ParameterSet& iconf = mods[i];
41  const std::string& mname = iconf.getParameter<std::string>("modifierName");
42  modifiers_.emplace_back(ModifyObjectValueFactory::get()->create(mname,iconf,cc));
43  }
44  }
45 }
46 
47 #endif
T getParameter(std::string const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
def create(alignables, pedeDump, additionalData, outputFile, config)
ObjectModifier(const edm::ParameterSet &conf, edm::ConsumesCollector &&cc)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
std::vector< ModifierPointer > modifiers_
Definition: HeavyIon.h:7
void setEvent(const edm::Event &event)
std::unique_ptr< ModifyObjectValueBase > ModifierPointer
void setEventContent(const edm::EventSetup &setup)
void modify(T &obj) const
long double T
T get(const Candidate &c)
Definition: component.h:55
Definition: event.py:1