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)
19  }
20 
22  for (unsigned i = 0; i < modifiers_.size(); ++i)
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 = conf.getParameterSetVector("modifications");
38  for (unsigned i = 0; i < mods.size(); ++i) {
39  const edm::ParameterSet& iconf = mods[i];
40  const std::string& mname = iconf.getParameter<std::string>("modifierName");
41  modifiers_.emplace_back(ModifyObjectValueFactory::get()->create(mname, iconf, cc));
42  }
43  }
44 } // namespace pat
45 
46 #endif
pat::ObjectModifier::ObjectModifier
ObjectModifier(const edm::ParameterSet &conf, edm::ConsumesCollector &&cc)
Definition: ObjectModifier.h:36
mps_fire.i
i
Definition: mps_fire.py:428
pat::ObjectModifier::modify
void modify(T &obj) const
Definition: ObjectModifier.h:26
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
mps_splice.mods
mods
Definition: mps_splice.py:43
ModifyObjectValueBase.h
pat::ObjectModifier::~ObjectModifier
~ObjectModifier()
Definition: ObjectModifier.h:14
pat::ObjectModifier
Definition: ObjectModifier.h:9
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::ObjectModifier::ModifierPointer
std::unique_ptr< ModifyObjectValueBase > ModifierPointer
Definition: ObjectModifier.h:11
edm::ParameterSet
Definition: ParameterSet.h:47
pat::ObjectModifier::setEventContent
void setEventContent(const edm::EventSetup &setup)
Definition: ObjectModifier.h:21
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
get
#define get
cc
pat::ObjectModifier::setEvent
void setEvent(const edm::Event &event)
Definition: ObjectModifier.h:16
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition: ParameterSet.cc:2160
pat::ObjectModifier::modifiers_
std::vector< ModifierPointer > modifiers_
Definition: ObjectModifier.h:32
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45