ROOT  6.06/09
Reference Guide
BDT.h
Go to the documentation of this file.
1 #ifndef BDT__HH
2 #define BDT__HH
3 #include <iostream>
4 #include <iomanip>
5 #include <fstream>
6 
7 #include "tmvaglob.h"
8 
9 #include "RQ_OBJECT.h"
10 
11 #include "TROOT.h"
12 #include "TStyle.h"
13 #include "TPad.h"
14 #include "TCanvas.h"
15 #include "TLine.h"
16 #include "TFile.h"
17 #include "TColor.h"
18 #include "TPaveText.h"
19 #include "TObjString.h"
20 #include "TControlBar.h"
21 
22 #include "TGWindow.h"
23 #include "TGButton.h"
24 #include "TGLabel.h"
25 #include "TGNumberEntry.h"
26 
27 #include "TMVA/DecisionTree.h"
28 #include "TMVA/Tools.h"
29 #include "TXMLEngine.h"
30 
31 // Uncomment this only if the link problem is solved. The include statement tends
32 // to use the ROOT classes rather than the local TMVA release
33 // #include "TMVA/DecisionTree.h"
34 // #include "TMVA/DecisionTreeNode.h"
35 namespace TMVA{
36 
37  // this macro displays a decision tree read in from the weight file
38 
39  // static const Int_t kSigColorF = TColor::GetColor( "#2244a5" ); // novel blue
40  // static const Int_t kBkgColorF = TColor::GetColor( "#dd0033" ); // novel red
41  // static const Int_t kIntColorF = TColor::GetColor( "#33aa77" ); // novel green
42 
43  static const Int_t kSigColorF = TColor::GetColor( "#0000FF" ); // Pure Signal
44  static const Int_t kBkgColorF = TColor::GetColor( "#FF0000" ); // Pure Backgr.
45  static const Int_t kIntColorF = TColor::GetColor( "#33aa77" ); // novel green
46 
47 
48  static const Int_t kSigColorT = 10;
49  static const Int_t kBkgColorT = 10;
50  static const Int_t kIntColorT = 10;
51 
52 
53 
54  class StatDialogBDT {
55 
56  RQ_OBJECT("StatDialogBDT")
57 
58  public:
59 
60  StatDialogBDT( const TGWindow* p, TString wfile = "weights/TMVAClassification_BDT.weights.txt",
61  TString methName = "BDT", Int_t itree = 0 );
62  virtual ~StatDialogBDT() {
64  fThis = 0;
65  fMain->CloseWindow();
66  fMain->Cleanup();
67  if(gROOT->GetListOfCanvases()->FindObject(fCanvas))
68  delete fCanvas;
69  }
70 
71  // draw method
72  void DrawTree( Int_t itree );
73 
74  void RaiseDialog() { if (fMain) { fMain->RaiseWindow(); fMain->Layout(); fMain->MapWindow(); } }
75 
76  private:
77 
82 
83 
85 
89 
90  void UpdateCanvases();
91 
92  // draw methods
93  TMVA::DecisionTree* ReadTree( TString * &vars, Int_t itree );
95  Double_t x, Double_t y, Double_t xscale, Double_t yscale, TString* vars );
96  void GetNtrees();
97 
100 
102 
103  public:
104 
105  // static function for external deletion
106  static void Delete() { if (fThis != 0) { delete fThis; fThis = 0; } }
107 
108  // slots
109  void SetItree(); //*SIGNAL*
110  void Redraw(); //*SIGNAL*
111  void Close(); //*SIGNAL*
112 
113  private:
114 
116 
117  };
118  // ========================================================================================
119 
120  static std::vector<TControlBar*> BDT_Global__cbar;
121 
122  // intermediate GUI
123  void BDT( const TString& fin = "TMVA.root" );
124  void BDT_DeleteTBar(int i);
125  void BDT( Int_t itree, TString wfile = "weights/TMVAnalysis_test_BDT.weights.txt", TString methName = "BDT", Bool_t useTMVAStyle = kTRUE ) ;
126 
127 }
128 #endif
void DrawTree(Int_t itree)
Definition: BDT.cxx:290
TGNumberEntry * fInput
Definition: BDT.h:84
static const Int_t kSigColorF
Definition: BDT.h:43
TGMainFrame * fMain
Definition: BDT.h:78
static const Int_t kSigColorT
Definition: BDT.h:48
Int_t fItree
Definition: BDT.h:79
void GetNtrees()
Definition: BDT.cxx:112
#define gROOT
Definition: TROOT.h:340
void Close()
Definition: BDT.cxx:44
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
static const Int_t kIntColorF
Definition: BDT.h:45
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
Int_t fColorOffset
Definition: BDT.h:101
Int_t fNtrees
Definition: BDT.h:80
TMVA::DecisionTree * ReadTree(TString *&vars, Int_t itree)
Definition: BDT.cxx:211
Double_t x[n]
Definition: legend1.C:17
static std::vector< TControlBar * > BDT_Global__cbar
Definition: BDT.h:120
void RaiseDialog()
Definition: BDT.h:74
static void Delete()
Definition: BDT.h:106
StatDialogBDT(const TGWindow *p, TString wfile="weights/TMVAClassification_BDT.weights.txt", TString methName="BDT", Int_t itree=0)
Definition: BDT.cxx:49
TGTextButton * fDrawButton
Definition: BDT.h:87
void BDT(const TString &fin="TMVA.root")
Definition: BDT.cxx:371
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1728
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb"...
Definition: TColor.cxx:1666
void Redraw()
Definition: BDT.cxx:39
TCanvas * fCanvas
Definition: BDT.h:81
#define RQ_OBJECT(sender_class)
Definition: RQ_OBJECT.h:101
The Canvas class.
Definition: TCanvas.h:48
TGHorizontalFrame * fButtons
Definition: BDT.h:86
static StatDialogBDT * fThis
Definition: BDT.h:115
virtual ~StatDialogBDT()
Definition: BDT.h:62
double Double_t
Definition: RtypesCore.h:55
virtual void RaiseWindow()
Definition: TGWindow.h:96
Double_t y[n]
Definition: legend1.C:17
TGTextButton * fCloseButton
Definition: BDT.h:88
TString fWfile
Definition: BDT.h:98
Abstract ClassifierFactory template that handles arbitrary types.
static const Int_t kBkgColorF
Definition: BDT.h:44
virtual void MapWindow()
Definition: TGFrame.h:267
void UpdateCanvases()
Definition: BDT.cxx:107
TString fMethName
Definition: BDT.h:99
static const Int_t kIntColorT
Definition: BDT.h:50
static const Int_t kBkgColorT
Definition: BDT.h:49
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
const Bool_t kTRUE
Definition: Rtypes.h:91
const Int_t n
Definition: legend1.C:16
void DrawNode(TMVA::DecisionTreeNode *n, Double_t x, Double_t y, Double_t xscale, Double_t yscale, TString *vars)
recursively puts an entries in the histogram for the node and its daughters
Definition: BDT.cxx:162
void SetItree()
Definition: BDT.cxx:34
void BDT_DeleteTBar(int i)
Definition: BDT.cxx:440