#include <KinResolutionsLoader.h>
Public Member Functions | |
bool | enabled () const |
'true' if this there is at least one efficiency configured | |
KinResolutionsLoader (const edm::ParameterSet &iConfig) | |
Constructor from a PSet. | |
KinResolutionsLoader () | |
Empty constructor. | |
void | newEvent (const edm::Event &event, const edm::EventSetup &setup) const |
To be called for each new event, reads in the EventSetup object. | |
template<typename T > | |
void | setResolutions (pat::PATObject< T > &obj) const |
Sets the efficiencies for this object, using the reference to the original objects. | |
Static Public Member Functions | |
static void | fillDescription (edm::ParameterSetDescription &iDesc) |
Method for documentation and validation of PSet. | |
Private Attributes | |
std::vector< std::string > | eslabels_ |
Labels of the KinematicResolutionProvider in the EventSetup. | |
std::vector< edm::ESHandle < KinematicResolutionProvider > > | handles_ |
Handles to the EventSetup. | |
std::vector< std::string > | patlabels_ |
Labels of the resolutions in PAT. |
Definition at line 18 of file KinResolutionsLoader.h.
pat::helper::KinResolutionsLoader::KinResolutionsLoader | ( | ) | [inline] |
KinResolutionsLoader::KinResolutionsLoader | ( | const edm::ParameterSet & | iConfig | ) |
Constructor from a PSet.
Definition at line 8 of file KinResolutionsLoader.cc.
References eslabels_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), handles_, and patlabels_.
{ // Get the names (sorted) patlabels_ = iConfig.getParameterNamesForType<std::string>(); // get the InputTags for (std::vector<std::string>::const_iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) { eslabels_.push_back( iConfig.getParameter<std::string>(*it) ); } // prepare the Handles handles_.resize(patlabels_.size()); // 'default' maps to empty string for (std::vector<std::string>::iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) { if (*it == "default") *it = ""; } }
bool pat::helper::KinResolutionsLoader::enabled | ( | ) | const [inline] |
'true' if this there is at least one efficiency configured
Definition at line 27 of file KinResolutionsLoader.h.
References patlabels_.
Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), pat::PATElectronProducer::produce(), pat::PATJetProducer::produce(), pat::PATMETProducer::produce(), pat::PATCompositeCandidateProducer::produce(), pat::PATMuonProducer::produce(), pat::PATPhotonProducer::produce(), pat::PATTauProducer::produce(), pat::PATGenericParticleProducer::produce(), and pat::PATPFParticleProducer::produce().
{ return !patlabels_.empty(); }
void KinResolutionsLoader::fillDescription | ( | edm::ParameterSetDescription & | iDesc | ) | [static] |
Method for documentation and validation of PSet.
Definition at line 36 of file KinResolutionsLoader.cc.
References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), and edm::ParameterSetDescription::setAllowAnything().
Referenced by pat::PATPhotonProducer::fillDescriptions(), pat::PATElectronProducer::fillDescriptions(), pat::PATTauProducer::fillDescriptions(), pat::PATJetProducer::fillDescriptions(), pat::PATMETProducer::fillDescriptions(), and pat::PATMuonProducer::fillDescriptions().
{ iDesc.add<bool>("addResolutions",false)->setComment("Add resolutions into this PAT Object"); edm::ParameterSetDescription resolutionPSet; resolutionPSet.setAllowAnything(); iDesc.addOptional("resolutions", resolutionPSet)->setComment("Resolution values to get from EventSetup"); }
void KinResolutionsLoader::newEvent | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | const |
To be called for each new event, reads in the EventSetup object.
Definition at line 28 of file KinResolutionsLoader.cc.
References eslabels_, edm::EventSetup::get(), handles_, i, n, and patlabels_.
Referenced by pat::PATElectronProducer::produce(), pat::PATJetProducer::produce(), pat::PATMETProducer::produce(), pat::PATCompositeCandidateProducer::produce(), pat::PATPhotonProducer::produce(), pat::PATMuonProducer::produce(), pat::PATTauProducer::produce(), pat::PATPFParticleProducer::produce(), and pat::PATGenericParticleProducer::produce().
void pat::helper::KinResolutionsLoader::setResolutions | ( | pat::PATObject< T > & | obj | ) | const |
Sets the efficiencies for this object, using the reference to the original objects.
Definition at line 49 of file KinResolutionsLoader.h.
References handles_, i, n, patlabels_, and pat::PATObject< ObjectType >::setKinResolution().
Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), pat::PATJetProducer::produce(), pat::PATMETProducer::produce(), pat::PATCompositeCandidateProducer::produce(), pat::PATPhotonProducer::produce(), pat::PATTauProducer::produce(), pat::PATGenericParticleProducer::produce(), and pat::PATPFParticleProducer::produce().
{ for (size_t i = 0, n = patlabels_.size(); i < n; ++i) { obj.setKinResolution( handles_[i]->getResolution(obj), patlabels_[i]); } }
std::vector<std::string> pat::helper::KinResolutionsLoader::eslabels_ [private] |
Labels of the KinematicResolutionProvider in the EventSetup.
Definition at line 42 of file KinResolutionsLoader.h.
Referenced by KinResolutionsLoader(), and newEvent().
std::vector<edm::ESHandle<KinematicResolutionProvider> > pat::helper::KinResolutionsLoader::handles_ [mutable, private] |
Handles to the EventSetup.
Definition at line 44 of file KinResolutionsLoader.h.
Referenced by KinResolutionsLoader(), newEvent(), and setResolutions().
std::vector<std::string> pat::helper::KinResolutionsLoader::patlabels_ [private] |
Labels of the resolutions in PAT.
Definition at line 40 of file KinResolutionsLoader.h.
Referenced by enabled(), KinResolutionsLoader(), newEvent(), and setResolutions().