CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pat::helper::KinResolutionsLoader Class Reference

#include <KinResolutionsLoader.h>

Public Member Functions

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

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &iDesc)
 Method for documentation and validation of PSet. More...
 

Private Attributes

std::vector< std::string > eslabels_
 Labels of the KinematicResolutionProvider in the EventSetup. More...
 
std::vector< edm::ESHandle
< KinematicResolutionProvider > > 
handles_
 Handles to the EventSetup. More...
 
std::vector< std::string > patlabels_
 Labels of the resolutions in PAT. More...
 

Detailed Description

Definition at line 18 of file KinResolutionsLoader.h.

Constructor & Destructor Documentation

pat::helper::KinResolutionsLoader::KinResolutionsLoader ( )
inline

Empty constructor.

Definition at line 21 of file KinResolutionsLoader.h.

21 {}
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_, patlabels_, and AlCaHLTBitMon_QueryRunRegistry::string.

9 {
10  // Get the names (sorted)
12 
13  // get the InputTags
14  for (std::vector<std::string>::const_iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) {
15  eslabels_.push_back( iConfig.getParameter<std::string>(*it) );
16  }
17 
18  // prepare the Handles
19  handles_.resize(patlabels_.size());
20 
21  // 'default' maps to empty string
22  for (std::vector<std::string>::iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) {
23  if (*it == "default") *it = "";
24  }
25 }
T getParameter(std::string const &) const
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
std::vector< std::string > eslabels_
Labels of the KinematicResolutionProvider in the EventSetup.
std::vector< std::string > patlabels_
Labels of the resolutions in PAT.
std::vector< edm::ESHandle< KinematicResolutionProvider > > handles_
Handles to the EventSetup.

Member Function Documentation

bool pat::helper::KinResolutionsLoader::enabled ( ) const
inline
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(), edm::ParameterSetDescription::setAllowAnything(), and edm::ParameterDescriptionNode::setComment().

Referenced by pat::PATMETProducer::fillDescriptions(), pat::PATMuonProducer::fillDescriptions(), pat::PATTauProducer::fillDescriptions(), pat::PATJetProducer::fillDescriptions(), pat::PATPhotonProducer::fillDescriptions(), and pat::PATElectronProducer::fillDescriptions().

36  {
37  iDesc.add<bool>("addResolutions",false)->setComment("Add resolutions into this PAT Object");
38  edm::ParameterSetDescription resolutionPSet;
39  resolutionPSet.setAllowAnything();
40  iDesc.addOptional("resolutions", resolutionPSet)->setComment("Resolution values to get from EventSetup");
41 }
void setComment(std::string const &value)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void KinResolutionsLoader::newEvent ( const edm::Event event,
const edm::EventSetup setup 
)

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, gen::n, and patlabels_.

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

28  {
29  for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
30  iSetup.get<KinematicResolutionRcd>().get(eslabels_[i], handles_[i]);
31  handles_[i]->setup(iSetup);
32  }
33 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > eslabels_
Labels of the KinematicResolutionProvider in the EventSetup.
std::vector< std::string > patlabels_
Labels of the resolutions in PAT.
std::vector< edm::ESHandle< KinematicResolutionProvider > > handles_
Handles to the EventSetup.
template<typename T >
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, gen::n, patlabels_, and pat::PATObject< ObjectType >::setKinResolution().

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

50 {
51  for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
52  obj.setKinResolution( handles_[i]->getResolution(obj), patlabels_[i]);
53  }
54 }
int i
Definition: DBlmapReader.cc:9
void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="")
Add a kinematic resolution to this object (possibly with a label)
Definition: PATObject.h:941
std::vector< std::string > patlabels_
Labels of the resolutions in PAT.
std::vector< edm::ESHandle< KinematicResolutionProvider > > handles_
Handles to the EventSetup.

Member Data Documentation

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_
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().