CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_PatAlgos_KinResolutionsLoader_h
00002 #define PhysicsTools_PatAlgos_KinResolutionsLoader_h
00003 
00004 #include "DataFormats/PatCandidates/interface/PATObject.h"
00005 
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "FWCore/Framework/interface/ESHandle.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 
00011 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00012 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00013 
00014 #include "PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h"
00015 
00016 
00017 namespace pat { namespace helper {
00018 class KinResolutionsLoader {
00019     public:
00021         KinResolutionsLoader() {}
00022 
00024         KinResolutionsLoader(const edm::ParameterSet &iConfig) ;
00025 
00027         bool enabled() const { return !patlabels_.empty(); }
00028      
00030         void newEvent(const edm::Event &event, const edm::EventSetup &setup) const ;
00031 
00033         template<typename T>
00034         void setResolutions( pat::PATObject<T> &obj ) const ;
00035 
00037         static void fillDescription(edm::ParameterSetDescription & iDesc);
00038     private:
00040         std::vector<std::string>   patlabels_;
00042         std::vector<std::string>   eslabels_;
00044         mutable std::vector<edm::ESHandle<KinematicResolutionProvider> > handles_;
00045 }; // class
00046 
00047 template<typename T>
00048 void
00049 KinResolutionsLoader::setResolutions( pat::PATObject<T> &obj ) const
00050 {
00051     for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
00052         obj.setKinResolution( handles_[i]->getResolution(obj), patlabels_[i]);
00053     }
00054 }
00055 
00056 } }
00057 
00058 #endif