CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TreeTrainer.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_MVATrainer_TreeTrainer_h
2 #define PhysicsTools_MVATrainer_TreeTrainer_h
3 
4 #include <string>
5 #include <vector>
6 #include <map>
7 
8 #include <TTree.h>
9 
13 
15 
16 namespace PhysicsTools {
17 
18 class TreeTrainer {
19  public:
20  TreeTrainer();
21  TreeTrainer(TTree *tree, double weight = -1.0);
22  TreeTrainer(TTree *signal, TTree *background, double weight = -1.0);
23  ~TreeTrainer();
24 
25  Calibration::MVAComputer *train(const std::string &trainDescription,
26  double crossValidation = 0.0,
27  bool useXSLT = false);
28 
29  // more precise control
30 
31  void reset();
32 
33  void addTree(TTree *tree, int target = -1, double weight = -1.0);
34  void addReader(const TreeReader &reader);
35 
36  bool iteration(MVATrainer *trainer);
37  void train(MVATrainer *trainer);
38 
39  private:
40  std::vector<TreeReader> readers;
41 
42  std::vector<double*> weights;
43 };
44 
45 } // namespace PhysicsTools
46 
47 #endif // PhysicsTools_MVATrainer_TreeTrainer_h
Calibration::MVAComputer * train(const std::string &trainDescription, double crossValidation=0.0, bool useXSLT=false)
Definition: TreeTrainer.cc:39
bool iteration(MVATrainer *trainer)
Definition: TreeTrainer.cc:87
std::vector< TreeReader > readers
Definition: TreeTrainer.h:40
void addTree(TTree *tree, int target=-1, double weight=-1.0)
Definition: TreeTrainer.cc:58
std::vector< double * > weights
Definition: TreeTrainer.h:42
void addReader(const TreeReader &reader)
Definition: TreeTrainer.cc:82