CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/PhysicsTools/MVATrainer/interface/TreeTrainer.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_MVATrainer_TreeTrainer_h
00002 #define PhysicsTools_MVATrainer_TreeTrainer_h
00003 
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 
00008 #include <TTree.h>
00009 
00010 #include "PhysicsTools/MVAComputer/interface/Calibration.h"
00011 #include "PhysicsTools/MVAComputer/interface/MVAComputer.h"
00012 #include "PhysicsTools/MVAComputer/interface/TreeReader.h"
00013 
00014 #include "PhysicsTools/MVATrainer/interface/MVATrainer.h"
00015 
00016 namespace PhysicsTools {
00017 
00018 class TreeTrainer {
00019     public:
00020         TreeTrainer();
00021         TreeTrainer(TTree *tree, double weight = -1.0);
00022         TreeTrainer(TTree *signal, TTree *background, double weight = -1.0);
00023         ~TreeTrainer();
00024 
00025         Calibration::MVAComputer *train(const std::string &trainDescription,
00026                                         double crossValidation = 0.0,
00027                                         bool useXSLT = false);
00028 
00029         // more precise control
00030 
00031         void reset();
00032 
00033         void addTree(TTree *tree, int target = -1, double weight = -1.0);
00034         void addReader(const TreeReader &reader);
00035 
00036         bool iteration(MVATrainer *trainer);
00037         void train(MVATrainer *trainer);
00038 
00039     private:
00040         std::vector<TreeReader> readers;
00041 
00042         std::vector<double*>    weights;
00043 };
00044 
00045 } // namespace PhysicsTools
00046 
00047 #endif // PhysicsTools_MVATrainer_TreeTrainer_h