Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 // set the style
59 cbar->SetTextColor("blue");
60
61 // there seems to be a bug in ROOT: font jumps back to default after pressing on >2 different buttons
62 // cbar->SetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
63
64 // draw
65 cbar->Show();
66
67 gROOT->SaveContext();
68
69}
70
72{
74
75 // delete CorrGuiMultiClass_Global__cbar;
76 // CorrGuiMultiClass_Global__cbar = 0;
77}
78
int Int_t
Definition RtypesCore.h:45
bool Bool_t
Definition RtypesCore.h:63
#define gROOT
Definition TROOT.h:404
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:26
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:45
virtual Bool_t cd()
Change current directory to "this" directory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
void DestroyCanvases()
Definition tmvaglob.cxx:166
TFile * OpenFile(const TString &fin)
Definition tmvaglob.cxx:192
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition tmvaglob.cxx:436
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