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, edm::ConsumesCollector iCollector) {
9  // Get the names (sorted)
11 
12  // get the InputTags
13  estokens_.reserve(patlabels_.size());
14  for (auto const &label : patlabels_) {
15  estokens_.emplace_back(iCollector.esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>(label))));
16  }
17  // prepare the resolutions
18  resolutions_.resize(patlabels_.size());
19 
20  // 'default' maps to empty string
21  for (std::vector<std::string>::iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) {
22  if (*it == "default")
23  *it = "";
24  }
25 }
26 
28  for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
29  resolutions_[i] = &iSetup.getData(estokens_[i]);
30  }
31 }
32 
34  iDesc.add<bool>("addResolutions", false)->setComment("Add resolutions into this PAT Object");
35  edm::ParameterSetDescription resolutionPSet;
36  resolutionPSet.setAllowAnything();
37  iDesc.addOptional("resolutions", resolutionPSet)->setComment("Resolution values to get from EventSetup");
38 }
void setComment(std::string const &value)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
std::vector< KinematicResolutionProvider const * > resolutions_
Handles to the EventSetup.
void setAllowAnything()
allow any parameter label/value pairs
char const * label
int iEvent
Definition: GenABIO.cc:224
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
bool getData(T &iHolder) const
Definition: EventSetup.h:122
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
std::vector< edm::ESGetToken< KinematicResolutionProvider, KinematicResolutionRcd > > estokens_
Labels of the KinematicResolutionProvider in the EventSetup.
std::vector< std::string > patlabels_
Labels of the resolutions in PAT.