ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
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 
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 =
38  TMVAGlob::OpenFile( fin );
39 
40  TDirectory* dir = (TDirectory*)gDirectory->Get( dirName );
41  if (!dir) {
42  cout << "Could not locate directory '" << dirName << "' in file: " << fin << endl;
43  return;
44  }
45  dir->cd();
46 
47  // how many variables are in the directory?
48  std::vector<TString> names(TMVAGlob::GetInputVariableNames(dir));
49  cout << "found number of variables='" << names.end() - names.begin() << endl;
50 
51  std::vector<TString>::const_iterator iter = names.begin();
52  for (; iter != names.end(); ++iter) {
53  cbar->AddButton( Form( " Variable: %s ", (*iter).Data()),
54  Form( "TMVA::correlationscattersMultiClass(\"%s\",\"%s\",\"%s\",\"%s\",%i)",
55  fin.Data(), (*iter).Data(), dirName.Data(), title.Data(), (Int_t)isRegression ),
56  buttonType );
57  }
58 
59  // *** problems with this button below ROOT 5.19 ***
60 #if ROOT_VERSION_CODE < ROOT_VERSION(5,19,0)
61  cbar->AddButton( "Close", "CorrGui_DeleteTBar()", "Close this control bar", "button" );
62 #endif
63  // **********************************************
64 
65  // set the style
66  cbar->SetTextColor("blue");
67 
68  // there seems to be a bug in ROOT: font jumps back to default after pressing on >2 different buttons
69  // cbar->SetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
70 
71  // draw
72  cbar->Show();
73 
74  gROOT->SaveContext();
75 
76 }
77 
79 {
81 
82  // delete CorrGuiMultiClass_Global__cbar;
83  // CorrGuiMultiClass_Global__cbar = 0;
84 }
85 
void Show()
Show control bar.
void AddButton(TControlBarButton *button)
Add button.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:37
void SetTextColor(const char *colorName)
Sets text color for control bar buttons, e.g.
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition: tmvaglob.cxx:429
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
TFile * OpenFile(const TString &fin)
Definition: tmvaglob.cxx:192
#define gROOT
Definition: TROOT.h:344
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const char * Data() const
Definition: TString.h:349
std::map< std::string, std::string >::const_iterator iter
Definition: TAlienJob.cxx:54
void CorrGuiMultiClass(TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variable", Bool_t isRegression=kFALSE)
TString dirName
Definition: demos.C:9
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
char * Form(const char *fmt,...)
const char * extension
Definition: civetweb.c:2467
void CorrGuiMultiClass_DeleteTBar()
Describe directory structure in memory.
Definition: TDirectory.h:44
void dir(char *path=0)
Definition: rootalias.C:30
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:433
#define gDirectory
Definition: TDirectory.h:221
void DestroyCanvases()
Definition: tmvaglob.cxx:166