CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::helper::EfficiencyLoader Class Reference

#include <EfficiencyLoader.h>

Public Member Functions

 EfficiencyLoader ()
 Empty constructor. More...
 
 EfficiencyLoader (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 Constructor from a PSet. More...
 
bool enabled () const
 'true' if this there is at least one efficiency configured More...
 
void newEvent (const edm::Event &event)
 To be called for each new event, reads in the ValueMaps for efficiencies. More...
 
template<typename T , typename R >
void setEfficiencies (pat::PATObject< T > &obj, const R &originalRef) const
 Sets the efficiencies for this object, using the reference to the original objects. More...
 

Private Attributes

std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_
 
std::vector< std::string > names_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< pat::LookupTableRecord > > > tokens_
 

Detailed Description

Definition at line 16 of file EfficiencyLoader.h.

Constructor & Destructor Documentation

◆ EfficiencyLoader() [1/2]

pat::helper::EfficiencyLoader::EfficiencyLoader ( )
inline

Empty constructor.

Definition at line 19 of file EfficiencyLoader.h.

19 {}

◆ EfficiencyLoader() [2/2]

EfficiencyLoader::EfficiencyLoader ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Constructor from a PSet.

Definition at line 7 of file EfficiencyLoader.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), handles_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, names_, jetUpdater_cfi::sort, and tokens_.

7  {
8  // Get the names (sorted)
10  std::sort(names_.begin(), names_.end());
11 
12  // get the InputTags
13  for (std::vector<std::string>::const_iterator it = names_.begin(), ed = names_.end(); it != ed; ++it) {
15  }
16 
17  // prepare the Handles
18  handles_.resize(names_.size());
19 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > names_
std::vector< edm::EDGetTokenT< edm::ValueMap< pat::LookupTableRecord > > > tokens_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:180
std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_

Member Function Documentation

◆ enabled()

bool pat::helper::EfficiencyLoader::enabled ( ) const
inline

◆ newEvent()

void EfficiencyLoader::newEvent ( const edm::Event event)

To be called for each new event, reads in the ValueMaps for efficiencies.

Definition at line 21 of file EfficiencyLoader.cc.

References handles_, mps_fire::i, iEvent, dqmiodumpmetadata::n, names_, and tokens_.

Referenced by pat::PATCompositeCandidateProducer::produce(), pat::PATMETProducer::produce(), pat::PATGenericParticleProducer::produce(), pat::PATPFParticleProducer::produce(), pat::PATPhotonProducer::produce(), pat::PATJetProducer::produce(), pat::PATTauProducer::produce(), pat::PATElectronProducer::produce(), and pat::PATMuonProducer::produce().

21  {
22  for (size_t i = 0, n = names_.size(); i < n; ++i) {
23  iEvent.getByToken(tokens_[i], handles_[i]);
24  }
25 }
std::vector< std::string > names_
std::vector< edm::EDGetTokenT< edm::ValueMap< pat::LookupTableRecord > > > tokens_
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_

◆ setEfficiencies()

template<typename T , typename R >
void pat::helper::EfficiencyLoader::setEfficiencies ( pat::PATObject< T > &  obj,
const R &  originalRef 
) const

Sets the efficiencies for this object, using the reference to the original objects.

Definition at line 41 of file EfficiencyLoader.h.

References handles_, mps_fire::i, dqmiodumpmetadata::n, names_, and getGTfromDQMFile::obj.

Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), pat::PATCompositeCandidateProducer::produce(), pat::PATGenericParticleProducer::produce(), pat::PATMETProducer::produce(), pat::PATPFParticleProducer::produce(), pat::PATPhotonProducer::produce(), pat::PATTauProducer::produce(), and pat::PATJetProducer::produce().

41  {
42  for (size_t i = 0, n = names_.size(); i < n; ++i) {
43  obj.setEfficiency(names_[i], (*handles_[i])[originalRef]);
44  }
45  }
std::vector< std::string > names_
std::vector< edm::Handle< edm::ValueMap< pat::LookupTableRecord > > > handles_

Member Data Documentation

◆ handles_

std::vector<edm::Handle<edm::ValueMap<pat::LookupTableRecord> > > pat::helper::EfficiencyLoader::handles_
private

Definition at line 37 of file EfficiencyLoader.h.

Referenced by EfficiencyLoader(), newEvent(), and setEfficiencies().

◆ names_

std::vector<std::string> pat::helper::EfficiencyLoader::names_
private

Definition at line 35 of file EfficiencyLoader.h.

Referenced by EfficiencyLoader(), enabled(), newEvent(), and setEfficiencies().

◆ tokens_

std::vector<edm::EDGetTokenT<edm::ValueMap<pat::LookupTableRecord> > > pat::helper::EfficiencyLoader::tokens_
private

Definition at line 36 of file EfficiencyLoader.h.

Referenced by EfficiencyLoader(), and newEvent().