test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
13  ObjectModifier(const edm::ParameterSet& conf);
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 
27  for( unsigned i = 0; i < modifiers_.size(); ++i )
28  modifiers_[i]->setConsumes(sumes);
29  }
30 
31  void modify(T& obj) const {
32  for( unsigned i = 0; i < modifiers_.size(); ++i )
33  modifiers_[i]->modifyObject(obj);
34  }
35 
36  private:
37  std::vector<ModifierPointer> modifiers_;
38  };
39 
40  template<class T>
42  const std::vector<edm::ParameterSet>& mods =
43  conf.getParameterSetVector("modifications");
44  for(unsigned i = 0; i < mods.size(); ++i ) {
45  const edm::ParameterSet& iconf = mods[i];
46  const std::string& mname = iconf.getParameter<std::string>("modifierName");
48  ModifyObjectValueFactory::get()->create(mname,iconf);
49  if( nullptr != plugin ) {
50  modifiers_.push_back(ModifierPointer(plugin));
51  } else {
52  throw cms::Exception("BadPluginName")
53  << "The requested modifier: " << mname << " is not available!";
54  }
55  }
56  }
57 }
58 
59 #endif
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
VParameterSet const & getParameterSetVector(std::string const &name) const
auto_ptr< JetDefinition::Plugin > plugin
std::vector< ModifierPointer > modifiers_
ObjectModifier(const edm::ParameterSet &conf)
void setEvent(const edm::Event &event)
std::unique_ptr< ModifyObjectValueBase > ModifierPointer
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple mods
Definition: mps_splice.py:37
void setConsumes(edm::ConsumesCollector &sumes)
void setEventContent(const edm::EventSetup &setup)
void modify(T &obj) const
long double T
T get(const Candidate &c)
Definition: component.h:55