CMS 3D CMS Logo

KinResolutionsLoader.cc
Go to the documentation of this file.
3 
4 #include <algorithm>
5 
7 
8 KinResolutionsLoader::KinResolutionsLoader(const edm::ParameterSet &iConfig)
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 }
26 
27 void
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 }
34 
35 void
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 }
T getParameter(std::string const &) const
void setComment(std::string const &value)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > eslabels_
Labels of the KinematicResolutionProvider in the EventSetup.
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
const T & get() const
Definition: EventSetup.h:59
std::vector< std::string > patlabels_
Labels of the resolutions in PAT.
std::vector< edm::ESHandle< KinematicResolutionProvider > > handles_
Handles to the EventSetup.