Crombie Tools
TmvaClassifier.h
Go to the documentation of this file.
1 /**
2  @file TmvaClassifier.h
3 
4  This is the header file that defines the TmvaClassifier class.
5 
6  @author Daniel Abercrombie <dabercro@mit.edu>
7 */
8 
9 #ifndef CROMBIETOOLS_ANALYSISTOOLS_TMVACLASSIFIER_H
10 #define CROMBIETOOLS_ANALYSISTOOLS_TMVACLASSIFIER_H
11 
12 #include <vector>
13 
14 #include "TString.h"
15 #include "TCut.h"
16 
17 /**
18  @ingroup analysisgroup
19  @class TmvaClassifier
20  @brief This class does the classification with BDTs.
21 */
22 
24 {
25  public:
27  virtual ~TmvaClassifier();
28 
29  void SetSignalCut( TCut cut ) { fSignalCut = cut; }
30  void SetBackgroundCut( TCut cut ) { fBackgroundCut = cut; }
31 
32  void SetWeight( TCut weight ) { fWeight = weight; }
33 
34  void AddSignalTree( TString file, TString tree ) { fSignalFileNames.push_back(file);
35  fSignalTreeNames.push_back(tree); }
36  void AddBackgroundTree( TString file, TString tree ) { fBackgroundFileNames.push_back(file);
37  fBackgroundTreeNames.push_back(tree); }
38 
39  void SetJobName( TString name ) { fJobName = name; }
40  void SetMethodName( TString name ) { fMethodName = name; }
41  void SetBDTDef( TString def ) { fBDTDef = def; }
42  void SetBDTName( TString name ) { fBDTName = name; }
43  void SetOutputName( TString name ) { fOutputName = name; }
44 
45  TString GetOutputName() { return fOutputName; }
46  TString GetMethodName() { return fMethodName; }
47  TString GetUniformVariable() { return fUniformVariable; }
48  TCut GetWeight() { return fWeight; }
49 
50  void SetConfigFile( TString name );
51 
52  void SetUniformVariable( TString var ) { fUniformVariable = var; }
53  void AddVariable( TString var, char type = 'F' ) { fVariables.push_back(var); fVarTypes.push_back(type); }
54  void AddSpectatorVariable( TString var ) { fSpectatorVariables.push_back(var); }
55 
56  void TmvaClassify();
57 
59  void SetApplicationTree( TString tree ) { fApplicationTree = tree; }
61 
62  TString GetConfigFile() { return fConfigFile; }
63 
65  TString GetApplicationTree() { return fApplicationTree; }
67 
68  TString GetWeightsFile() { return TString("weights/")+fJobName+TString("_")+fMethodName+".weights.xml"; }
69 
70  void SetReportFrequency( Int_t freq ) { fReportFrequency = freq; }
71 
72  void Apply();
73  void Apply( Int_t NumBins, Double_t *VarVals, Int_t NumMapPoints = 501 );
74  void Apply( Int_t NumBins, Double_t VarMin, Double_t VarMax, Int_t NumMapPoints = 501 );
75 
76  private:
77 
78  TCut fSignalCut;
80 
81  TCut fWeight;
82 
83  std::vector<TString> fSignalFileNames;
84  std::vector<TString> fSignalTreeNames;
85  std::vector<TString> fBackgroundFileNames;
86  std::vector<TString> fBackgroundTreeNames;
87 
88  TString fJobName;
89  TString fMethodName;
90  TString fBDTDef;
91  TString fBDTName;
92  TString fOutputName;
93 
94  TString fConfigFile;
95 
97  std::vector<TString> fVariables;
98  std::vector<char> fVarTypes;
99  std::vector<TString> fSpectatorVariables;
100 
104 
106 
107  ClassDef(TmvaClassifier,1)
108 };
109 
110 #endif