Logo ROOT   6.14/05
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 
40  inline Int_t getSigColorF () {return TColor::GetColor( "#0000FF" );} // Pure Signal
41  inline Int_t getBkgColorF () {return TColor::GetColor( "#FF0000" );} // Pure Backgr.
42  inline Int_t getIntColorF () {return TColor::GetColor( "#33aa77" );} // novel green
43 
44 
45  inline Int_t getSigColorT () {return 10;}
46  inline Int_t getBkgColorT () {return 10;}
47  inline Int_t getIntColorT () {return 10;}
48 
49 
50 
51  class StatDialogBDT {
52 
53  RQ_OBJECT("StatDialogBDT")
54 
55  public:
56 
57  StatDialogBDT(TString dataset, const TGWindow* p, TString wfile,
58  TString methName = "BDT", Int_t itree = 0 );
59  virtual ~StatDialogBDT() {
61  fThis = 0;
62  fMain->CloseWindow();
63  fMain->Cleanup();
64  if(gROOT->GetListOfCanvases()->FindObject(fCanvas))
65  delete fCanvas;
66  }
67 
68  // draw method
69  void DrawTree(Int_t itree );
70 
71  void RaiseDialog() { if (fMain) { fMain->RaiseWindow(); fMain->Layout(); fMain->MapWindow(); } }
72 
73  private:
74 
79 
80 
82 
86 
87  void UpdateCanvases();
88 
89  // draw methods
90  TMVA::DecisionTree* ReadTree( TString * &vars, Int_t itree );
92  Double_t x, Double_t y, Double_t xscale, Double_t yscale, TString* vars );
93  void GetNtrees();
94 
99 
100  public:
101 
102  // static function for external deletion
103  static void Delete() { if (fThis != 0) { delete fThis; fThis = 0; } }
104 
105  // slots
106  void SetItree(); //*SIGNAL*
107  void Redraw(); //*SIGNAL*
108  void Close(); //*SIGNAL*
109 
110  private:
111 
113 
114  };
115  // ========================================================================================
116 
117  extern std::vector<TControlBar*> BDT_Global__cbar;
118 
119  // intermediate GUI
120  void BDT(TString dataset, const TString& fin = "TMVA.root" );
121  void BDT_DeleteTBar(int i);
122  void BDT(TString dataset, Int_t itree, TString wfile , TString methName = "BDT", Bool_t useTMVAStyle = kTRUE ) ;
123 
124 }
125 #endif
void DrawTree(Int_t itree)
Definition: BDT.cxx:297
TGNumberEntry * fInput
Definition: BDT.h:81
Int_t getSigColorT()
Definition: BDT.h:45
TGMainFrame * fMain
Definition: BDT.h:75
void BDT(TString dataset, const TString &fin="TMVA.root")
Int_t getBkgColorT()
Definition: BDT.h:46
Int_t fItree
Definition: BDT.h:76
void GetNtrees()
Definition: BDT.cxx:113
#define gROOT
Definition: TROOT.h:410
void Close()
Definition: BDT.cxx:44
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
Int_t fColorOffset
Definition: BDT.h:98
Int_t fNtrees
Definition: BDT.h:77
TMVA::DecisionTree * ReadTree(TString *&vars, Int_t itree)
Definition: BDT.cxx:212
Int_t getIntColorT()
Definition: BDT.h:47
Double_t x[n]
Definition: legend1.C:17
StatDialogBDT(TString dataset, const TGWindow *p, TString wfile, TString methName="BDT", Int_t itree=0)
Definition: BDT.cxx:49
void RaiseDialog()
Definition: BDT.h:71
static void Delete()
Definition: BDT.h:103
TString fDataset
Definition: BDT.h:97
TGTextButton * fDrawButton
Definition: BDT.h:84
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1728
Implementation of a Decision Tree.
Definition: DecisionTree.h:64
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:1758
void Redraw()
Definition: BDT.cxx:39
TCanvas * fCanvas
Definition: BDT.h:78
#define RQ_OBJECT(sender_class)
Definition: RQ_OBJECT.h:87
The Canvas class.
Definition: TCanvas.h:31
TGHorizontalFrame * fButtons
Definition: BDT.h:83
static StatDialogBDT * fThis
Definition: BDT.h:112
virtual ~StatDialogBDT()
Definition: BDT.h:59
double Double_t
Definition: RtypesCore.h:55
virtual void RaiseWindow()
Definition: TGWindow.h:94
Double_t y[n]
Definition: legend1.C:17
TGTextButton * fCloseButton
Definition: BDT.h:85
Int_t getIntColorF()
Definition: BDT.h:42
TString fWfile
Definition: BDT.h:95
Abstract ClassifierFactory template that handles arbitrary types.
Int_t getBkgColorF()
Definition: BDT.h:41
virtual void MapWindow()
Definition: TGFrame.h:251
void UpdateCanvases()
Definition: BDT.cxx:108
TString fMethName
Definition: BDT.h:96
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
const Bool_t kTRUE
Definition: RtypesCore.h:87
const Int_t n
Definition: legend1.C:16
Int_t getSigColorF()
Definition: BDT.h:40
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:163
void SetItree()
Definition: BDT.cxx:34
void BDT_DeleteTBar(int i)