Logo ROOT   master
Reference Guide
tmvaglob.cxx
Go to the documentation of this file.
1 #include "TMVA/tmvaglob.h"
2 #include "TMVA/Config.h"
3 
4 using std::cout;
5 using std::endl;
6 
7 // set the style
9 {
10  //signal
11  // const Int_t FillColor__S = 38 + 150; // change of Color Scheme in ROOT-5.16.
12  // convince yourself with gROOT->GetListOfColors()->Print()
13  Int_t FillColor__S = getSignalFill();
14  Int_t FillStyle__S = 1001;
15  Int_t LineColor__S = getSignalLine();
16  Int_t LineWidth__S = 2;
17 
18  // background
19  //Int_t icolor = gConfig().fVariablePlotting.fUsePaperStyle ? 2 + 100 : 2;
20  Int_t FillColor__B = getBackgroundFill();
21  Int_t FillStyle__B = 3554;
22  Int_t LineColor__B = getBackgroundLine();
23  Int_t LineWidth__B = 2;
24 
25  if (sig != NULL) {
26  sig->SetLineColor( LineColor__S );
27  sig->SetLineWidth( LineWidth__S );
28  sig->SetFillStyle( FillStyle__S );
29  sig->SetFillColor( FillColor__S );
30  }
31 
32  if (bkg != NULL) {
33  bkg->SetLineColor( LineColor__B );
34  bkg->SetLineWidth( LineWidth__B );
35  bkg->SetFillStyle( FillStyle__B );
36  bkg->SetFillColor( FillColor__B );
37  }
38 
39  if (all != NULL) {
40  all->SetLineColor( LineColor__S );
41  all->SetLineWidth( LineWidth__S );
42  all->SetFillStyle( FillStyle__S );
43  all->SetFillColor( FillColor__S );
44  }
45 }
46 
48 {
49  //signal
50  // const Int_t FillColor__S = 38 + 150; // change of Color Scheme in ROOT-5.16.
51  // convince yourself with gROOT->GetListOfColors()->Print()
52  //Int_t FillColor__S = getSignalFill();
53  //Int_t FillStyle__S = 1001;
54  //Int_t LineColor__S = getSignalLine();
55  //Int_t LineWidth__S = 2;
56 
57  // background
58  //Int_t icolor = gConfig().fVariablePlotting.fUsePaperStyle ? 2 + 100 : 2;
59  //Int_t FillColor__B = getBackgroundFill();
60  //Int_t FillStyle__B = 3554;
61  //Int_t LineColor__B = getBackgroundLine();
62  //Int_t LineWidth__B = 2;
63 
64  Int_t FillColors[10] = {38,2,3,6,7,8,9,11};
65  Int_t LineColors[10] = {4,2,3,6,7,8,9,11};
66  Int_t FillStyles[5] = {1001,3554,3003,3545,0};
67 
68  for(Int_t i=0; i<hists->GetEntriesFast(); ++i){
69  ((TH1*)(*hists)[i])->SetFillColor(FillColors[i%10]);
70  ((TH1*)(*hists)[i])->SetFillStyle(FillStyles[i%5]);
71  ((TH1*)(*hists)[i])->SetLineColor(LineColors[i%10]);
72  ((TH1*)(*hists)[i])->SetLineWidth(2);
73  }
74 }
75 
76 // set frame styles
78 {
79  frame->SetLabelOffset( 0.012, "X" );// label offset on x axis
80  frame->SetLabelOffset( 0.012, "Y" );// label offset on x axis
81  frame->GetXaxis()->SetTitleOffset( 1.25 );
82  frame->GetYaxis()->SetTitleOffset( 1.22 );
83  frame->GetXaxis()->SetTitleSize( 0.045*scale );
84  frame->GetYaxis()->SetTitleSize( 0.045*scale );
85  Float_t labelSize = 0.04*scale;
86  frame->GetXaxis()->SetLabelSize( labelSize );
87  frame->GetYaxis()->SetLabelSize( labelSize );
88 
89  // global style settings
90  gPad->SetTicks();
91  gPad->SetLeftMargin ( 0.108*scale );
92  gPad->SetRightMargin ( 0.050*scale );
93  gPad->SetBottomMargin( 0.120*scale );
94 }
95 
97 
98  TStyle *TMVAStyle = gROOT->GetStyle("TMVA");
99  if(TMVAStyle!=0) {
100  gROOT->SetStyle("TMVA");
101  return;
102  }
103 
104  TMVAStyle = new TStyle(*gROOT->GetStyle("Plain")); // our style is based on Plain
105  TMVAStyle->SetName("TMVA");
106  TMVAStyle->SetTitle("TMVA style based on \"Plain\" with modifications defined in tmvaglob.C");
107  gROOT->GetListOfStyles()->Add(TMVAStyle);
108  gROOT->SetStyle("TMVA");
109 
110  TMVAStyle->SetLineStyleString( 5, "[52 12]" );
111  TMVAStyle->SetLineStyleString( 6, "[22 12]" );
112  TMVAStyle->SetLineStyleString( 7, "[22 10 7 10]" );
113 
114  // the pretty color palette of old
115  TMVAStyle->SetPalette((gConfig().fVariablePlotting.fUsePaperStyle ? 18 : 1),0);
116 
117  // use plain black on white colors
118  TMVAStyle->SetFrameBorderMode(0);
119  TMVAStyle->SetCanvasBorderMode(0);
120  TMVAStyle->SetPadBorderMode(0);
121  TMVAStyle->SetPadColor(0);
122  TMVAStyle->SetFillStyle(0);
123 
124  TMVAStyle->SetLegendBorderSize(0);
125 
126  // title properties
127  // TMVAStyle->SetTitleW(.4);
128  // TMVAStyle->SetTitleH(.10);
129  // MVAStyle->SetTitleX(.5);
130  // TMVAStyle->SetTitleY(.9);
131  TMVAStyle->SetTitleFillColor( getTitleBox() );
132  TMVAStyle->SetTitleTextColor( getTitleText() );
133  TMVAStyle->SetTitleBorderSize( 1 );
134  TMVAStyle->SetLineColor( getTitleBorder() );
135  if (!gConfig().fVariablePlotting.fUsePaperStyle) {
136  TMVAStyle->SetFrameFillColor( getFrameFill() );
137  TMVAStyle->SetCanvasColor( getCanvas() );
138  }
139 
140  // set the paper & margin sizes
141  TMVAStyle->SetPaperSize(20,26);
142  TMVAStyle->SetPadTopMargin(0.10);
143  TMVAStyle->SetPadRightMargin(0.05);
144  TMVAStyle->SetPadBottomMargin(0.11);
145  TMVAStyle->SetPadLeftMargin(0.12);
146 
147  // use bold lines and markers
148  TMVAStyle->SetMarkerStyle(21);
149  TMVAStyle->SetMarkerSize(0.3);
150  TMVAStyle->SetHistLineWidth(2);
151  TMVAStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
152 
153  // do not display any of the standard histogram decorations
154  TMVAStyle->SetOptTitle(1);
155  TMVAStyle->SetTitleH(0.052);
156 
157  TMVAStyle->SetOptStat(0);
158  TMVAStyle->SetOptFit(0);
159 
160  // put tick marks on top and RHS of plots
161  TMVAStyle->SetPadTickX(1);
162  TMVAStyle->SetPadTickY(1);
163 
164 }
165 
167 {
168 
169  TList* loc = (TList*)gROOT->GetListOfCanvases();
170  TListIter itc(loc);
171  TObject *o(0);
172  while ((o = itc())) delete o;
173 }
174 
175 // set style and remove existing canvas'
176 void TMVA::TMVAGlob::Initialize( Bool_t useTMVAStyle )
177 {
178  // destroy canvas'
179  DestroyCanvases();
180 
181  // set style
182  if (!useTMVAStyle) {
183  gROOT->SetStyle("Plain");
184  gStyle->SetOptStat(0);
185  return;
186  }
187 
188  SetTMVAStyle();
189 }
190 
191 // checks if file with name "fin" is already open, and if not opens one
193 {
194  TFile* file = gDirectory->GetFile();
195  if (file==0 || fin != file->GetName()) {
196  if (file != 0) {
197  gROOT->cd();
198  file->Close();
199  }
200  cout << "--- Opening root file " << fin << " in read mode" << endl;
201  file = TFile::Open( fin, "READ" );
202  }
203  else {
204  file = gDirectory->GetFile();
205  }
206 
207  file->cd();
208  return file;
209 }
210 
211 // used to create output file for canvas
212 void TMVA::TMVAGlob::imgconv( TCanvas* c, const TString & fname )
213 {
214  // return;
215  if (NULL == c) {
216  cout << "*** Error in TMVAGlob::imgconv: canvas is NULL" << endl;
217  }
218  else {
219  // create directory if not existing
220  TString f = fname;
221  TString dir = f.Remove( f.Last( '/' ), f.Length() - f.Last( '/' ) );
222  gSystem->mkdir( dir );
223 
224  TString pngName = fname + ".png";
225  TString gifName = fname + ".gif";
226  TString epsName = fname + ".eps";
227  c->cd();
228 
229  // create eps (other option: c->Print( epsName ))
230  if (gConfig().fVariablePlotting.fUsePaperStyle) {
231  c->Print(epsName);
232  }
233  else {
234  cout << "--- --------------------------------------------------------------------" << endl;
235  cout << "--- If you want to save the image as eps, gif or png, please comment out " << endl;
236  cout << "--- the corresponding lines (line no. 239-241) in tmvaglob.C" << endl;
237  cout << "--- --------------------------------------------------------------------" << endl;
238  c->Print(epsName);
239  c->Print(pngName);
240  // c->Print(gifName);
241  }
242  }
243 }
244 
245 TImage * TMVA::TMVAGlob::findImage(const char * imageName)
246 {
247  // looks for the image in tutorialpath
248  //TString tutorialPath = "$ROOTSYS/tutorials/tmva"; // look for the image in here
249  TString tutorialPath = getenv ("ROOTSYS");
250  tutorialPath+="/tutorials/tmva";
251  TImage *img(0);
252  TString fullName = Form("%s/%s", tutorialPath.Data(), imageName);
253  Bool_t fileFound = ! gSystem->AccessPathName(fullName);
254 
255  if(fileFound) {
256  img = TImage::Open(fullName);
257  } else {
258  cout << "+++ Could not open image: " << fullName << endl;
259  }
260  return img;
261 }
262 
264 {
265 
266  TImage *img = findImage("tmva_logo.gif");
267  if (!img) {
268  cout << "+++ Could not open image tmva_logo.gif" << endl;
269  return;
270  }
271 
272  img->SetConstRatio(kFALSE);
273  UInt_t h_ = img->GetHeight();
274  UInt_t w_ = img->GetWidth();
275 
276  Float_t r = w_/h_;
277  gPad->Update();
278  Float_t rpad = Double_t(gPad->VtoAbsPixel(0) - gPad->VtoAbsPixel(1))/(gPad->UtoAbsPixel(1) - gPad->UtoAbsPixel(0));
279  r *= rpad;
280 
281  Float_t d = 0.055;
282  // absolute coordinates
283  Float_t x1R = 1 - gStyle->GetPadRightMargin();
284  Float_t y1B = 1 - gStyle->GetPadTopMargin()+.01; // we like the logo to sit a bit above the histo
285 
286  Float_t x1L = x1R - d*r/skew;
287  Float_t y1T = y1B + d*v_scale*skew;
288  if (y1T>0.99) y1T = 0.99;
289 
290  TPad *p1 = new TPad("imgpad", "imgpad", x1L, y1B, x1R, y1T );
291  p1->SetRightMargin(0);
292  p1->SetBottomMargin(0);
293  p1->SetLeftMargin(0);
294  p1->SetTopMargin(0);
295  p1->Draw();
296 
297  Int_t xSizeInPixel = p1->UtoAbsPixel(1) - p1->UtoAbsPixel(0);
298  Int_t ySizeInPixel = p1->VtoAbsPixel(0) - p1->VtoAbsPixel(1);
299  if (xSizeInPixel<=25 || ySizeInPixel<=25) {
300  delete p1;
301  return; // ROOT doesn't draw smaller than this
302  }
303 
304  p1->cd();
305  img->Draw();
306 }
307 
309 {
310  if (h==0) return;
311  if (h->GetSumw2N() == 0) h->Sumw2();
312  if(h->GetSumOfWeights()!=0) {
313  Float_t dx = (h->GetXaxis()->GetXmax() - h->GetXaxis()->GetXmin())/h->GetNbinsX();
314  h->Scale( 1.0/h->GetSumOfWeights()/dx );
315  }
316 }
318 {
319  if (sig->GetSumw2N() == 0) sig->Sumw2();
320  if (bkg && bkg->GetSumw2N() == 0) bkg->Sumw2();
321 
322  if(sig->GetSumOfWeights()!=0) {
323  Float_t dx = (sig->GetXaxis()->GetXmax() - sig->GetXaxis()->GetXmin())/sig->GetNbinsX();
324  sig->Scale( 1.0/sig->GetSumOfWeights()/dx );
325  }
326  if (bkg != 0 && bkg->GetSumOfWeights()!=0) {
327  Float_t dx = (bkg->GetXaxis()->GetXmax() - bkg->GetXaxis()->GetXmin())/bkg->GetNbinsX();
328  bkg->Scale( 1.0/bkg->GetSumOfWeights()/dx );
329  }
330 }
331 
332 // the following are tools to help handling different methods and titles
333 
334 
336  if (mkey==0) return;
337  name = mkey->GetName();
338  name.ReplaceAll("Method_","");
339 }
340 
342  if (ikey==0) return;
343  name = ikey->GetName();
344 }
345 
347  if (mdir==0) return;
348  name = mdir->GetName();
349  name.ReplaceAll("Method_","");
350 }
351 
353  if (idir==0) return;
354  name = idir->GetName();
355 }
356 
357 TKey *TMVA::TMVAGlob::NextKey( TIter & keyIter, TString className) {
358  TKey *key=(TKey *)keyIter.Next();
359  TKey *rkey=0;
360  Bool_t loop=(key!=0);
361  //
362  while (loop) {
363  TClass *cl = gROOT->GetClass(key->GetClassName());
364  if (cl->InheritsFrom(className.Data())) {
365  loop = kFALSE;
366  rkey = key;
367  } else {
368  key = (TKey *)keyIter.Next();
369  if (key==0) loop = kFALSE;
370  }
371  }
372  return rkey;
373 }
374 
376 {
377  // get a list of keys with a given inheritance
378  // the list contains TKey objects
379  if (dir==0) dir = gDirectory;
380  TIter mnext(dir->GetListOfKeys());
381  TKey *mkey;
382  keys.Clear();
383  keys.SetOwner(kFALSE);
384  UInt_t ni=0;
385  while ((mkey = (TKey*)mnext())) {
386  // make sure, that we only look at TDirectory with name Method_<xxx>
387  TClass *cl = gROOT->GetClass(mkey->GetClassName());
388  if (cl->InheritsFrom(inherits)) {
389  keys.Add(mkey);
390  ni++;
391  }
392  }
393  return ni;
394 }
395 
397 {
398  if (!dir) {
399  cout << "tmvaglob::GetNumberOfTargets is called with *dir==NULL :( " << endl;
400  return 0;
401  }
402  TIter next(dir->GetListOfKeys());
403  TKey* key = 0;
404  Int_t noTrgts = 0;
405 
406  while ((key = (TKey*)next())) {
407  if (key->GetCycle() != 1) continue;
408  if (TString(key->GetName()).Contains("__Regression_target")) noTrgts++;
409  }
410  return noTrgts;
411 }
412 
414 {
415  TIter next(dir->GetListOfKeys());
416  TKey* key = 0;
417  Int_t noVars = 0;
418 
419  while ((key = (TKey*)next())) {
420  if (key->GetCycle() != 1) continue;
421 
422  // count number of variables (signal is sufficient), exclude target(s)
423  if (TString(key->GetName()).Contains("__Signal") || (TString(key->GetName()).Contains("__Regression") && !(TString(key->GetName()).Contains("__Regression_target")))) noVars++;
424  }
425 
426  return noVars;
427 }
428 
430 {
431  TIter next(dir->GetListOfKeys());
432  TKey* key = 0;
433  std::vector<TString> names;
434 
435  while ((key = (TKey*)next())) {
436  if (key->GetCycle() != 1) continue;
437  TClass *cl = gROOT->GetClass(key->GetClassName());
438  if (!cl->InheritsFrom("TH1")) continue;
439  TString name(key->GetName());
440  Int_t pos = name.Index("__");
441  if (pos != -1) {
442  name.Remove(pos);
443  }
444  Bool_t hasname = false;
445  std::vector<TString>::const_iterator iter = names.begin();
446  while(iter != names.end()){
447  if(name.CompareTo(*iter)==0)
448  hasname=true;
449  ++iter;
450  }
451  if(!hasname)
452  names.push_back(name);
453  }
454  return names;
455 }
456 
458  std::vector<TString> names(GetInputVariableNames(dir));
459  return names.end() - names.begin();
460 }
461 
462 std::vector<TString> TMVA::TMVAGlob::GetClassNames(TDirectory *dir )
463 {
464 
465  TIter next(dir->GetListOfKeys());
466  TKey* key = 0;
467  //set<std::string> varnames;
468  std::vector<TString> names;
469 
470  while ((key = (TKey*)next())) {
471  if (key->GetCycle() != 1) continue;
472  TClass *cl = gROOT->GetClass(key->GetClassName());
473  if (!cl->InheritsFrom("TH1")) continue;
474  TString name(key->GetName());
475  Int_t pos = name.Index("__");
476  if (pos == -1)
477  continue;
478  name.ReplaceAll("_Deco","");
479  name.ReplaceAll("_Gauss","");
480  name.ReplaceAll("_PCA","");
481  name.ReplaceAll("_Id","");
482  name.ReplaceAll("_vs_","");
483  name.Remove(0, pos + 2);
484 
485  /*Int_t pos = name.First("__");
486  name.Remove(0,pos+2);
487  char c = '_';
488  pos = name.Last(c);
489  name.Remove(pos);
490  if(name.Contains("Gauss")){
491  pos = name.Last(c);
492  name.Remove(pos);
493  }
494  pos = name.Last(c);
495  if(pos!=-1)
496  name.Remove(0,pos+1);
497  */
498  Bool_t hasname = false;
499  std::vector<TString>::const_iterator iter = names.begin();
500  while(iter != names.end()){
501  if(name.CompareTo(*iter)==0)
502  hasname=true;
503  ++iter;
504  }
505  if(!hasname)
506  names.push_back(name);
507  }
508  return names;
509 }
510 
511 
513 {
514  // find the key for a method
515  if (dir==0) dir = gDirectory;
516  TIter mnext(dir->GetListOfKeys());
517  TKey *mkey;
518  TKey *retkey=0;
519  Bool_t loop=kTRUE;
520  while (loop) {
521  mkey = (TKey*)mnext();
522  if (mkey==0) {
523  loop = kFALSE;
524  }
525  else {
526  TString clname = mkey->GetClassName();
527  TClass *cl = gROOT->GetClass(clname);
528  if (cl->InheritsFrom("TDirectory")) {
529  TString mname = mkey->GetName(); // method name
530  TString tname = "Method_"+name; // target name
531  if (mname==tname) { // target found!
532  loop = kFALSE;
533  retkey = mkey;
534  }
535  }
536  }
537  }
538  return retkey;
539 }
540 
542 {
543  // find the key for a method
544  if (dir==0) dir = gDirectory;
545  TIter mnext(dir->GetListOfKeys());
546  TKey *mkey;
547  Bool_t loop=kTRUE;
548  while (loop) {
549  mkey = (TKey*)mnext();
550  if (mkey==0) {
551  loop = kFALSE;
552  }
553  else {
554  TString clname = mkey->GetClassName();
555  TString keyname = mkey->GetName();
556  TClass *cl = gROOT->GetClass(clname);
557  if (keyname.Contains("Method") && cl->InheritsFrom("TDirectory")) {
558 
559  TDirectory* d_ = (TDirectory*)dir->Get( keyname );
560  if (!d_) {
561  cout << "HUUUGE TROUBLES IN TMVAGlob::ExistMethodName() --> contact authors" << endl;
562  return kFALSE;
563  }
564 
565  TIter mnext_(d_->GetListOfKeys());
566  TKey *mkey_;
567  while ((mkey_ = (TKey*)mnext_())) {
568  TString clname_ = mkey_->GetClassName();
569  TClass *cl_ = gROOT->GetClass(clname_);
570  if (cl_->InheritsFrom("TDirectory")) {
571  TString mname = mkey_->GetName(); // method name
572  if (mname==name) { // target found!
573  return kTRUE;
574  }
575  }
576  }
577  }
578  }
579  }
580  return kFALSE;
581 }
582 
584 {
585  // get a list of methods
586  // the list contains TKey objects
587  if (dir==0) dir = gDirectory;
588  TIter mnext(dir->GetListOfKeys());
589  TKey *mkey;
590  methods.Clear();
591  methods.SetOwner(kFALSE);
592  UInt_t ni=0;
593  while ((mkey = (TKey*)mnext())) {
594  // make sure, that we only look at TDirectory with name Method_<xxx>
595  TString name = mkey->GetClassName();
596  TClass *cl = gROOT->GetClass(name);
597  if (cl->InheritsFrom("TDirectory")) {
598  if (TString(mkey->GetName()).BeginsWith("Method_")) {
599  methods.Add(mkey);
600  ni++;
601  }
602  }
603  }
604  cout << "--- Found " << ni << " classifier types" << endl;
605  return ni;
606 }
607 
609 {
610  // get a list of all jobs in all method directories
611  // based on ideas by Peter and Joerg found in macro deviations.C
612  TIter next(file->GetListOfKeys());
613  TKey *key(0);
614  while ((key = (TKey*)next())) {
615 
616  if (TString(key->GetName()).BeginsWith("Method_")) {
617  if (gROOT->GetClass(key->GetClassName())->InheritsFrom("TDirectory")) {
618 
619  TDirectory* mDir = (TDirectory*)key->ReadObj();
620 
621  TIter keyIt(mDir->GetListOfKeys());
622  TKey *jobkey;
623  while ((jobkey = (TKey*)keyIt())) {
624  if (!gROOT->GetClass(jobkey->GetClassName())->InheritsFrom("TDirectory")) continue;
625 
626  TDirectory *jobDir = (TDirectory *)jobkey->ReadObj();
627  cout << "jobdir name " << jobDir->GetName() << endl;
628  jobdirs.Add(jobDir);
629  }
630  }
631  }
632  }
633  return jobdirs.GetSize();
634 }
635 
637 {
638  // get a list of titles (i.e TDirectory) given a method dir
639  UInt_t ni=0;
640  if (rfdir==0) return 0;
641  TList *keys = rfdir->GetListOfKeys();
642  if (keys==0) {
643  cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
644  return 0;
645  }
646  //
647  TIter rfnext(rfdir->GetListOfKeys());
648  TKey *rfkey;
649  titles.Clear();
650  titles.SetOwner(kFALSE);
651  while ((rfkey = (TKey*)rfnext())) {
652  // make sure, that we only look at histograms
653  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
654  if (cl->InheritsFrom("TDirectory")) {
655  titles.Add(rfkey);
656  ni++;
657  }
658  }
659  cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
660  return ni;
661 }
662 
664 {
665  // get the list of all titles for a given method
666  // if the input dir is 0, gDirectory is used
667  // returns a list of keys
668  UInt_t ni=0;
669  if (dir==0) dir = gDirectory;
670  TDirectory* rfdir = (TDirectory*)dir->Get( methodName );
671  if (rfdir==0) {
672  cout << "+++ Could not locate directory '" << methodName << endl;
673  return 0;
674  }
675 
676  return GetListOfTitles( rfdir, titles );
677 
678  TList *keys = rfdir->GetListOfKeys();
679  if (keys==0) {
680  cout << "+++ Directory '" << methodName << "' contains no keys" << endl;
681  return 0;
682  }
683  //
684  TIter rfnext(rfdir->GetListOfKeys());
685  TKey *rfkey;
686  titles.Clear();
687  titles.SetOwner(kFALSE);
688  while ((rfkey = (TKey*)rfnext())) {
689  // make sure, that we only look at histograms
690  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
691  if (cl->InheritsFrom("TDirectory")) {
692  titles.Add(rfkey);
693  ni++;
694  }
695  }
696  cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl;
697  return ni;
698 }
699 
701 {
702  // get the InputVariables directory
703  const TString directories[TMVAGlob::kNumOfMethods] = { "InputVariables_Id",
704  "InputVariables_Deco",
705  "InputVariables_PCA",
706  "InputVariables_Gauss_Deco" };
707  if (dir==0) dir = gDirectory;
708 
709  // get top dir containing all hists of the variables
710  dir = (TDirectory*)gDirectory->Get( directories[type] );
711  if (dir==0) {
712  cout << "+++ Could not locate input variable directory '" << directories[type] << endl;
713  return 0;
714  }
715  return dir;
716 }
717 
719 {
720  // get the CorrelationPlots directory
721  if (dir==0) dir = GetInputVariablesDir( type, 0 );
722  if (dir==0) return 0;
723  //
724  TDirectory* corrdir = (TDirectory*)dir->Get( "CorrelationPlots" );
725  if (corrdir==0) {
726  cout << "+++ Could not find CorrelationPlots directory 'CorrelationPlots'" << endl;
727  return 0;
728  }
729  return corrdir;
730 }
731 
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:294
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1292
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition: TH1.cxx:6246
An array of TObjects.
Definition: TObjArray.h:37
void imgconv(TCanvas *c, const TString &fname)
Definition: tmvaglob.cxx:212
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:168
void SetPadLeftMargin(Float_t margin=0.1)
Definition: TStyle.h:343
Int_t UtoAbsPixel(Double_t u) const
Definition: TPad.h:363
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition: tmvaglob.cxx:429
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3944
virtual UInt_t GetHeight() const
Definition: TImage.h:229
void SetFrameBorderMode(Int_t mode=1)
Definition: TStyle.h:361
Int_t GetNumberOfInputVariables(TDirectory *dir)
Definition: tmvaglob.cxx:413
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Definition: TDirectory.cxx:806
float Float_t
Definition: RtypesCore.h:55
virtual UInt_t GetWidth() const
Definition: TImage.h:228
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
void SetHistLineWidth(Width_t width=1)
Definition: TStyle.h:366
TFile * OpenFile(const TString &fin)
Definition: tmvaglob.cxx:192
void NormalizeHists(TH1 *sig, TH1 *bkg=0)
Definition: tmvaglob.cxx:317
virtual const char * GetClassName() const
Definition: TKey.h:76
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Config & gConfig()
virtual void SetConstRatio(Bool_t constRatio=kTRUE)
Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
Definition: TAttImage.cxx:641
std::vector< TString > GetClassNames(TDirectory *dir)
Definition: tmvaglob.cxx:462
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition: TH1.cxx:7426
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:53
void NormalizeHist(TH1 *h)
Definition: tmvaglob.cxx:308
void SetSignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *all=0)
Definition: tmvaglob.cxx:8
#define gROOT
Definition: TROOT.h:405
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
Definition: tmvaglob.cxx:77
Bool_t ExistMethodName(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:541
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)
Definition: tmvaglob.cxx:375
Basic string class.
Definition: TString.h:131
Int_t getTitleBox()
Definition: tmvaglob.h:46
#define f(i)
Definition: RSha256.hxx:104
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
Int_t getSignalLine()
Definition: tmvaglob.h:49
An abstract interface to image processing library.
Definition: TImage.h:29
TKey * NextKey(TIter &keyIter, TString className)
Definition: tmvaglob.cxx:357
TDirectory * GetCorrelationPlotsDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
Definition: tmvaglob.cxx:718
void SetPadBottomMargin(Float_t margin=0.1)
Definition: TStyle.h:341
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Definition: TStyle.cxx:1432
Iterator of linked list.
Definition: TList.h:197
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition: TAttPad.cxx:130
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
Definition: TSystem.cxx:903
Int_t getTitleText()
Definition: tmvaglob.h:48
void SetCanvasColor(Color_t color=19)
Definition: TStyle.h:327
void SetTitleBorderSize(Width_t size=2)
Definition: TStyle.h:391
void SetLegendBorderSize(Width_t size=4)
Definition: TStyle.h:334
Double_t GetXmin() const
Definition: TAxis.h:133
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:593
void SetFrameFillColor(Color_t color=1)
Definition: TStyle.h:355
Int_t getBackgroundLine()
Definition: tmvaglob.h:51
Int_t GetNumberOfTargets(TDirectory *dir)
Definition: tmvaglob.cxx:396
Int_t getBackgroundFill()
Definition: tmvaglob.h:52
void SetPadTickX(Int_t tickx)
Definition: TStyle.h:347
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
void GetMethodTitle(TString &name, TKey *ikey)
Definition: tmvaglob.cxx:341
void SetTitleTextColor(Color_t color=1)
Definition: TStyle.h:388
void GetMethodName(TString &name, TKey *mkey)
Definition: tmvaglob.cxx:335
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:28
void SetTMVAStyle()
Definition: tmvaglob.cxx:96
void SetMultiClassStyle(TObjArray *hists)
Definition: tmvaglob.cxx:47
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1284
lv SetLineColor(kBlue)
Int_t VtoAbsPixel(Double_t v) const
Definition: TPad.h:364
A doubly linked list.
Definition: TList.h:44
TStyle objects may be created to define special styles.
Definition: TStyle.h:29
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
TDirectory * GetInputVariablesDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
Definition: tmvaglob.cxx:700
void SetPadBorderMode(Int_t mode=1)
Definition: TStyle.h:340
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:329
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:100
ROOT::R::TRInterface & r
Definition: Object.C:4
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176
R__EXTERN TSystem * gSystem
Definition: TSystem.h:558
void SetPadColor(Color_t color=19)
Definition: TStyle.h:338
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
Int_t getTitleBorder()
Definition: tmvaglob.h:47
a SetFillStyle(0)
Float_t GetPadRightMargin() const
Definition: TStyle.h:205
TObject * Next()
Definition: TCollection.h:249
h1 SetFillColor(kGreen)
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
Definition: tmvaglob.cxx:608
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
Definition: TStyle.cxx:1542
unsigned int UInt_t
Definition: RtypesCore.h:44
The most important graphics class in the ROOT system.
Definition: TPad.h:26
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
char * Form(const char *fmt,...)
f1 SetLineWidth(4)
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
TAxis * GetYaxis()
Definition: TH1.h:317
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
Definition: tmvaglob.cxx:263
Int_t GetNumberOfInputVariablesMultiClass(TDirectory *dir)
Definition: tmvaglob.cxx:457
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4770
void SetTitleH(Float_t h=0)
Definition: TStyle.h:399
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition: TAttAxis.cxx:204
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
Definition: TAttAxis.cxx:304
#define h(i)
Definition: RSha256.hxx:106
const Bool_t kFALSE
Definition: RtypesCore.h:90
The Canvas class.
Definition: TCanvas.h:23
virtual Int_t GetSumw2N() const
Definition: TH1.h:310
#define d(i)
Definition: RSha256.hxx:102
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=0)
Definition: tmvaglob.cxx:583
Int_t getFrameFill()
Definition: tmvaglob.h:45
double Double_t
Definition: RtypesCore.h:57
Describe directory structure in memory.
Definition: TDirectory.h:40
int type
Definition: TGX11.cxx:120
Float_t GetPadTopMargin() const
Definition: TStyle.h:203
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
The TH1 histogram class.
Definition: TH1.h:56
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:401
void SetPadTopMargin(Float_t margin=0.1)
Definition: TStyle.h:342
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
Definition: TStyle.cxx:1655
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition: TAttPad.cxx:120
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void Add(TObject *obj)
Definition: TList.h:87
void SetTitleFillColor(Color_t color=1)
Definition: TStyle.h:387
Definition: file.py:1
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition: TH1.cxx:8476
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition: TStyle.cxx:1590
void SetOptTitle(Int_t tit=1)
Definition: TStyle.h:318
#define gPad
Definition: TVirtualPad.h:287
Int_t getCanvas()
Definition: tmvaglob.h:44
#define c(i)
Definition: RSha256.hxx:101
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:119
void SetPadTickY(Int_t ticky)
Definition: TStyle.h:348
TKey * FindMethod(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:512
#define gDirectory
Definition: TDirectory.h:236
virtual Int_t GetNbinsX() const
Definition: TH1.h:292
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
void SetPadRightMargin(Float_t margin=0.1)
Definition: TStyle.h:344
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
Int_t getSignalFill()
Definition: tmvaglob.h:50
const Bool_t kTRUE
Definition: RtypesCore.h:89
Double_t GetXmax() const
Definition: TAxis.h:134
void DestroyCanvases()
Definition: tmvaglob.cxx:166
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Definition: TStyle.cxx:1783
char name[80]
Definition: TGX11.cxx:109
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TImage * findImage(const char *imageName)
Definition: tmvaglob.cxx:245
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition: TAttPad.cxx:110
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis&#39; labels.
Definition: Haxis.cxx:267
const char * Data() const
Definition: TString.h:364
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
Definition: tmvaglob.cxx:636