14 void TMVA::CorrGui(TString dataset, TString fin, TString dirName , TString title ,
22 cout <<
"--- Open CorrGui for input file: " << fin <<
" and type: " << dirName << endl;
26 TMVAGlob::Initialize( );
28 TString extension = dirName;
29 extension.ReplaceAll(
"InputVariables",
"" );
32 TControlBar* cbar =
new TControlBar(
"vertical", title, 50, 50 );
35 const char* buttonType =
"button";
39 TFile* file = TMVAGlob::OpenFile( fin );
42 TDirectory* dir = (TDirectory*)file->GetDirectory(dataset)->Get(dirName );
44 cout <<
"Could not locate directory '" << dirName <<
"' in file: " << fin << endl;
45 cout <<
" Try again .. " <<endl;
48 dir = (TDirectory*)gDirectory->Get( dirName );
50 cout <<
"Nope ..Could not locate directory '" << dirName <<
"' in file: " << fin << endl;
57 Int_t noVar = TMVAGlob::GetNumberOfInputVariables(dir);
58 cout <<
"found number of variables='" << noVar<< endl;
59 std::vector<TString> Var(noVar);
61 TIter next(dir->GetListOfKeys());
65 while ( (key = (TKey*)next()) ) {
68 TClass *cl = gROOT->GetClass(key->GetClassName());
69 if (cl->InheritsFrom(
"TH1")) {
70 TH1 *sig = (TH1*)key->ReadObj();
71 TString hname = sig->GetName();
73 if (hname.Contains(
"__Signal") || (hname.Contains(
"__Regression") && !hname.Contains(
"__Regression_target"))) {
74 hname.ReplaceAll(extension,
"");
75 hname.ReplaceAll(
"__Signal",
"");
76 hname.ReplaceAll(
"__Regression",
"");
82 cout <<
"found histos for "<< it <<
" variables='" << endl;
84 for (Int_t ic=0;ic<it;ic++) {
85 cbar->AddButton( (Var[ic].Contains(
"_target") ?
86 Form(
" Target: %s ", Var[ic].ReplaceAll(
"_target",
"").Data()) :
87 Form(
" Variable: %s ", Var[ic].Data())),
88 Form(
"TMVA::correlationscatters(\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%i)",dataset.Data(),fin.Data(), Var[ic].Data(), dirName.Data(), title.Data(), (Int_t)isRegression ),
93 cbar->SetTextColor(
"blue");
101 gROOT->SaveContext();
105 void TMVA::CorrGui_DeleteTBar()
107 TMVAGlob::DestroyCanvases();