00001 #ifndef PhysicsTools_MVATrainer_MVATrainerContainer_h 00002 #define PhysicsTools_MVATrainer_MVATrainerContainer_h 00003 00004 #include <vector> 00005 #include <string> 00006 #include <memory> 00007 00008 #include <boost/shared_ptr.hpp> 00009 00010 #include "CondFormats/PhysicsToolsObjects/interface/MVAComputer.h" 00011 #include "PhysicsTools/MVATrainer/interface/MVATrainer.h" 00012 #include "PhysicsTools/MVATrainer/interface/MVATrainerLooper.h" 00013 00014 namespace PhysicsTools { 00015 00016 class MVATrainerContainer : public Calibration::MVAComputerContainer { 00017 public: 00018 typedef MVATrainerLooper::TrainObject Value_t; 00019 00020 virtual const Calibration::MVAComputer & 00021 find(const std::string &label) const 00022 { 00023 Map_t::const_iterator pos = trainCalibs.find(label); 00024 if (pos != trainCalibs.end()) 00025 return *pos->second.get(); 00026 00027 return Calibration::MVAComputerContainer::find(label); 00028 } 00029 00030 void addTrainer(const std::string &label, const Value_t &calibration) 00031 { trainCalibs[label] = calibration; } 00032 00033 private: 00034 typedef std::map<std::string, Value_t> Map_t; 00035 00036 Map_t trainCalibs; 00037 }; 00038 00039 } // namespace PhysicsTools 00040 00041 #endif // PhysicsTools_MVATrainer_MVATrainerContainer_h