CMS 3D CMS Logo

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
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pat::helper::EfficiencyLoader::EfficiencyLoader
EfficiencyLoader()
Empty constructor.
Definition: EfficiencyLoader.h:19
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
pat::helper::EfficiencyLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: EfficiencyLoader.h:25
pat::helper::EfficiencyLoader::newEvent
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
Definition: EfficiencyLoader.cc:21
pat::PATObject
Templated PAT object container.
Definition: PATObject.h:45
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
pat::helper::EfficiencyLoader::handles_
std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_
Definition: EfficiencyLoader.h:37
helper
Definition: helper.py:1
pat
Definition: HeavyIon.h:7
InputTag.h
ValueMap.h
pat::helper::EfficiencyLoader::names_
std::vector< std::string > names_
Definition: EfficiencyLoader.h:35
pat::helper::EfficiencyLoader::setEfficiencies
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: EfficiencyLoader.h:41
ConsumesCollector.h
ParameterSet.h
event
Definition: event.py:1
pat::helper::EfficiencyLoader::tokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< pat::LookupTableRecord > > > tokens_
Definition: EfficiencyLoader.h:36
edm::Event
Definition: Event.h:73
dttmaxenums::R
Definition: DTTMax.h:29
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
PATObject.h
LookupTableRecord.h