CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/PhysicsTools/PatAlgos/src/KinResolutionsLoader.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h"
00002 #include "PhysicsTools/PatAlgos/interface/KinematicResolutionRcd.h"
00003 
00004 #include <algorithm>
00005 
00006 using pat::helper::KinResolutionsLoader;
00007 
00008 KinResolutionsLoader::KinResolutionsLoader(const edm::ParameterSet &iConfig) 
00009 {
00010     // Get the names (sorted)
00011     patlabels_ = iConfig.getParameterNamesForType<std::string>();
00012     
00013     // get the InputTags
00014     for (std::vector<std::string>::const_iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) {
00015         eslabels_.push_back( iConfig.getParameter<std::string>(*it) );
00016     }
00017 
00018     // prepare the Handles
00019     handles_.resize(patlabels_.size());
00020 
00021     // 'default' maps to empty string
00022     for (std::vector<std::string>::iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) {
00023         if (*it == "default") *it = "";
00024     }
00025 }
00026 
00027 void
00028 KinResolutionsLoader::newEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) const {
00029     for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
00030         iSetup.get<KinematicResolutionRcd>().get(eslabels_[i], handles_[i]);
00031         handles_[i]->setup(iSetup);
00032     }    
00033 }
00034 
00035 void 
00036 KinResolutionsLoader::fillDescription(edm::ParameterSetDescription & iDesc) {
00037     iDesc.add<bool>("addResolutions",false)->setComment("Add resolutions into this PAT Object");
00038     edm::ParameterSetDescription resolutionPSet;
00039     resolutionPSet.setAllowAnything();
00040     iDesc.addOptional("resolutions", resolutionPSet)->setComment("Resolution values to get from EventSetup");
00041 }