CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EfficiencyLoader.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatAlgos_EfficiencyLoader_h
2 #define PhysicsTools_PatAlgos_EfficiencyLoader_h
3 
8 
13 
14 namespace pat {
15  namespace helper {
17  public:
20 
23 
25  bool enabled() const { return !names_.empty(); }
26 
28  void newEvent(const edm::Event &event);
29 
31  template <typename T, typename R>
32  void setEfficiencies(pat::PATObject<T> &obj, const R &originalRef) const;
33 
34  private:
35  std::vector<std::string> names_;
36  std::vector<edm::EDGetTokenT<edm::ValueMap<pat::LookupTableRecord> > > tokens_;
37  std::vector<edm::Handle<edm::ValueMap<pat::LookupTableRecord> > > handles_;
38  }; // class
39 
40  template <typename T, typename R>
41  void EfficiencyLoader::setEfficiencies(pat::PATObject<T> &obj, const R &originalRef) const {
42  for (size_t i = 0, n = names_.size(); i < n; ++i) {
43  obj.setEfficiency(names_[i], (*handles_[i])[originalRef]);
44  }
45  }
46 
47  } // namespace helper
48 } // namespace pat
49 
50 #endif
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
std::vector< std::string > names_
EfficiencyLoader()
Empty constructor.
std::vector< edm::EDGetTokenT< edm::ValueMap< pat::LookupTableRecord > > > tokens_
void setEfficiency(const std::string &name, const pat::LookupTableRecord &value)
Definition: PATObject.h:727
std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Templated PAT object container.
Definition: PATObject.h:43