Logo ROOT   6.18/05
Reference Guide
CorrGuiMultiClass.cxx
Go to the documentation of this file.
2///////////
3//New Gui for easier plotting of scatter corelations
4// L. Ancu 04/04/07
5////////////
6#include <iostream>
7
8#include "TControlBar.h"
9
10
11//static TControlBar* CorrGuiMultiClass_Global__cbar = 0;
12
13void TMVA::CorrGuiMultiClass(TString dataset, TString fin , TString dirName , TString title ,
14 Bool_t isRegression )
15{
16 // Use this script in order to run the various individual macros
17 // that plot the output of TMVA (e.g. running TMVAnalysis.C),
18 // stored in the file "TMVA.root"
19 // for further documentation, look in the individual macros
20
21 cout << "--- Open CorrGui for input file: " << fin << " and type: " << dirName << endl;
22
23 // destroy all open cavases
25
26 TString extension = dirName;
27 extension.ReplaceAll( "InputVariables", "" );
28
29 // create the control bar
30 TControlBar* cbar = new TControlBar( "vertical", title, 50, 50 );
31 // CorrGuiMultiClass_Global__cbar = cbar;
32
33 const char* buttonType = "button";
34
35 // configure buttons
36 // checks if file with name "fin" is already open, and if not opens one
37 TFile* file = TMVAGlob::OpenFile( fin );
38
39 TDirectory* dir = (TDirectory*)file->GetDirectory(dataset.Data())->Get( dirName );
40 if (!dir) {
41 cout << "Could not locate directory '" << dirName << "' in file: " << fin << endl;
42 return;
43 }
44 dir->cd();
45
46 // how many variables are in the directory?
47 std::vector<TString> names(TMVAGlob::GetInputVariableNames(dir));
48 cout << "found number of variables='" << names.end() - names.begin() << endl;
49
50 std::vector<TString>::const_iterator iter = names.begin();
51 for (; iter != names.end(); ++iter) {
52 cbar->AddButton( Form( " Variable: %s ", (*iter).Data()),
53 Form( "TMVA::correlationscattersMultiClass(\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%i)",
54 dataset.Data(), fin.Data(), (*iter).Data(), dirName.Data(), title.Data(), (Int_t)isRegression ),
55 buttonType );
56 }
57
58 // *** problems with this button below ROOT 5.19 ***
59#if ROOT_VERSION_CODE < ROOT_VERSION(5,19,0)
60 cbar->AddButton( "Close", "CorrGui_DeleteTBar()", "Close this control bar", "button" );
61#endif
62 // **********************************************
63
64 // set the style
65 cbar->SetTextColor("blue");
66
67 // there seems to be a bug in ROOT: font jumps back to default after pressing on >2 different buttons
68 // cbar->SetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
69
70 // draw
71 cbar->Show();
72
73 gROOT->SaveContext();
74
75}
76
78{
80
81 // delete CorrGuiMultiClass_Global__cbar;
82 // CorrGuiMultiClass_Global__cbar = 0;
83}
84
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
#define gROOT
Definition: TROOT.h:414
char * Form(const char *fmt,...)
const char * extension
Definition: civetweb.c:7793
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:22
void Show()
Show control bar.
void AddButton(TControlBarButton *button)
Add button.
void SetTextColor(const char *colorName)
Sets text color for control bar buttons, e.g.
Describe directory structure in memory.
Definition: TDirectory.h:34
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:497
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:48
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
void DestroyCanvases()
Definition: tmvaglob.cxx:166
TFile * OpenFile(const TString &fin)
Definition: tmvaglob.cxx:192
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition: tmvaglob.cxx:429
void CorrGuiMultiClass_DeleteTBar()
void CorrGuiMultiClass(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variable", Bool_t isRegression=kFALSE)
Definition: file.py:1