CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/PhysicsTools/MVATrainer/interface/MVATrainerFileSaveImpl.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_MVATrainer_MVATrainerFileSaveImpl_h
00002 #define PhysicsTools_MVATrainer_MVATrainerFileSaveImpl_h
00003 
00004 #include <iostream>
00005 #include <memory>
00006 #include <vector>
00007 #include <string>
00008 
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/Framework/interface/Event.h"
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 
00014 #include "CondFormats/PhysicsToolsObjects/interface/MVAComputer.h"
00015 
00016 #include "PhysicsTools/MVATrainer/interface/MVATrainerFileSave.h"
00017 
00018 namespace PhysicsTools {
00019 
00020 template<typename Record_t>
00021 class MVATrainerFileSaveImpl : public MVATrainerFileSave {
00022     public:
00023         explicit MVATrainerFileSaveImpl(const edm::ParameterSet &params) :
00024                 MVATrainerFileSave(params) {}
00025 
00026     protected:
00027         virtual const Calibration::MVAComputerContainer *
00028         getToPut(const edm::EventSetup& es) const
00029         {
00030                 edm::ESHandle<Calibration::MVAComputerContainer> handle;
00031                 if (trained)
00032                         es.get<Record_t>().get("trained", handle);
00033                 else
00034                         es.get<Record_t>().get(handle);
00035                 return handle.product();
00036         }
00037 };
00038 
00039 } // namespace PhysicsTools
00040 
00041 #endif // PhysicsTools_MVATrainer_MVATrainerFileSaveImpl_h