Logo ROOT   6.10/09
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  name.ReplaceAll("_Deco","");
476  name.ReplaceAll("_Gauss","");
477  name.ReplaceAll("_PCA","");
478  name.ReplaceAll("_Id","");
479  name.ReplaceAll("_vs_","");
480  char c = '_';
481  Int_t pos = name.Last(c);
482  name.Remove(0,pos+1);
483 
484  /*Int_t pos = name.First("__");
485  name.Remove(0,pos+2);
486  char c = '_';
487  pos = name.Last(c);
488  name.Remove(pos);
489  if(name.Contains("Gauss")){
490  pos = name.Last(c);
491  name.Remove(pos);
492  }
493  pos = name.Last(c);
494  if(pos!=-1)
495  name.Remove(0,pos+1);
496  */
497  Bool_t hasname = false;
498  std::vector<TString>::const_iterator iter = names.begin();
499  while(iter != names.end()){
500  if(name.CompareTo(*iter)==0)
501  hasname=true;
502  iter++;
503  }
504  if(!hasname)
505  names.push_back(name);
506  }
507  return names;
508 }
509 
510 
512 {
513  // find the key for a method
514  if (dir==0) dir = gDirectory;
515  TIter mnext(dir->GetListOfKeys());
516  TKey *mkey;
517  TKey *retkey=0;
518  Bool_t loop=kTRUE;
519  while (loop) {
520  mkey = (TKey*)mnext();
521  if (mkey==0) {
522  loop = kFALSE;
523  }
524  else {
525  TString clname = mkey->GetClassName();
526  TClass *cl = gROOT->GetClass(clname);
527  if (cl->InheritsFrom("TDirectory")) {
528  TString mname = mkey->GetName(); // method name
529  TString tname = "Method_"+name; // target name
530  if (mname==tname) { // target found!
531  loop = kFALSE;
532  retkey = mkey;
533  }
534  }
535  }
536  }
537  return retkey;
538 }
539 
541 {
542  // find the key for a method
543  if (dir==0) dir = gDirectory;
544  TIter mnext(dir->GetListOfKeys());
545  TKey *mkey;
546  Bool_t loop=kTRUE;
547  while (loop) {
548  mkey = (TKey*)mnext();
549  if (mkey==0) {
550  loop = kFALSE;
551  }
552  else {
553  TString clname = mkey->GetClassName();
554  TString keyname = mkey->GetName();
555  TClass *cl = gROOT->GetClass(clname);
556  if (keyname.Contains("Method") && cl->InheritsFrom("TDirectory")) {
557 
558  TDirectory* d_ = (TDirectory*)dir->Get( keyname );
559  if (!d_) {
560  cout << "HUUUGE TROUBLES IN TMVAGlob::ExistMethodName() --> contact authors" << endl;
561  return kFALSE;
562  }
563 
564  TIter mnext_(d_->GetListOfKeys());
565  TKey *mkey_;
566  while ((mkey_ = (TKey*)mnext_())) {
567  TString clname_ = mkey_->GetClassName();
568  TClass *cl_ = gROOT->GetClass(clname_);
569  if (cl_->InheritsFrom("TDirectory")) {
570  TString mname = mkey_->GetName(); // method name
571  if (mname==name) { // target found!
572  return kTRUE;
573  }
574  }
575  }
576  }
577  }
578  }
579  return kFALSE;
580 }
581 
583 {
584  // get a list of methods
585  // the list contains TKey objects
586  if (dir==0) dir = gDirectory;
587  TIter mnext(dir->GetListOfKeys());
588  TKey *mkey;
589  methods.Clear();
590  methods.SetOwner(kFALSE);
591  UInt_t ni=0;
592  while ((mkey = (TKey*)mnext())) {
593  // make sure, that we only look at TDirectory with name Method_<xxx>
594  TString name = mkey->GetClassName();
595  TClass *cl = gROOT->GetClass(name);
596  if (cl->InheritsFrom("TDirectory")) {
597  if (TString(mkey->GetName()).BeginsWith("Method_")) {
598  methods.Add(mkey);
599  ni++;
600  }
601  }
602  }
603  cout << "--- Found " << ni << " classifier types" << endl;
604  return ni;
605 }
606 
608 {
609  // get a list of all jobs in all method directories
610  // based on ideas by Peter and Joerg found in macro deviations.C
611  TIter next(file->GetListOfKeys());
612  TKey *key(0);
613  while ((key = (TKey*)next())) {
614 
615  if (TString(key->GetName()).BeginsWith("Method_")) {
616  if (gROOT->GetClass(key->GetClassName())->InheritsFrom("TDirectory")) {
617 
618  TDirectory* mDir = (TDirectory*)key->ReadObj();
619 
620  TIter keyIt(mDir->GetListOfKeys());
621  TKey *jobkey;
622  while ((jobkey = (TKey*)keyIt())) {
623  if (!gROOT->GetClass(jobkey->GetClassName())->InheritsFrom("TDirectory")) continue;
624 
625  TDirectory *jobDir = (TDirectory *)jobkey->ReadObj();
626  cout << "jobdir name " << jobDir->GetName() << endl;
627  jobdirs.Add(jobDir);
628  }
629  }
630  }
631  }
632  return jobdirs.GetSize();
633 }
634 
636 {
637  // get a list of titles (i.e TDirectory) given a method dir
638  UInt_t ni=0;
639  if (rfdir==0) return 0;
640  TList *keys = rfdir->GetListOfKeys();
641  if (keys==0) {
642  cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
643  return 0;
644  }
645  //
646  TIter rfnext(rfdir->GetListOfKeys());
647  TKey *rfkey;
648  titles.Clear();
649  titles.SetOwner(kFALSE);
650  while ((rfkey = (TKey*)rfnext())) {
651  // make sure, that we only look at histograms
652  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
653  if (cl->InheritsFrom("TDirectory")) {
654  titles.Add(rfkey);
655  ni++;
656  }
657  }
658  cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
659  return ni;
660 }
661 
663 {
664  // get the list of all titles for a given method
665  // if the input dir is 0, gDirectory is used
666  // returns a list of keys
667  UInt_t ni=0;
668  if (dir==0) dir = gDirectory;
669  TDirectory* rfdir = (TDirectory*)dir->Get( methodName );
670  if (rfdir==0) {
671  cout << "+++ Could not locate directory '" << methodName << endl;
672  return 0;
673  }
674 
675  return GetListOfTitles( rfdir, titles );
676 
677  TList *keys = rfdir->GetListOfKeys();
678  if (keys==0) {
679  cout << "+++ Directory '" << methodName << "' contains no keys" << endl;
680  return 0;
681  }
682  //
683  TIter rfnext(rfdir->GetListOfKeys());
684  TKey *rfkey;
685  titles.Clear();
686  titles.SetOwner(kFALSE);
687  while ((rfkey = (TKey*)rfnext())) {
688  // make sure, that we only look at histograms
689  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
690  if (cl->InheritsFrom("TDirectory")) {
691  titles.Add(rfkey);
692  ni++;
693  }
694  }
695  cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl;
696  return ni;
697 }
698 
700 {
701  // get the InputVariables directory
702  const TString directories[TMVAGlob::kNumOfMethods] = { "InputVariables_Id",
703  "InputVariables_Deco",
704  "InputVariables_PCA",
705  "InputVariables_Gauss_Deco" };
706  if (dir==0) dir = gDirectory;
707 
708  // get top dir containing all hists of the variables
709  dir = (TDirectory*)gDirectory->Get( directories[type] );
710  if (dir==0) {
711  cout << "+++ Could not locate input variable directory '" << directories[type] << endl;
712  return 0;
713  }
714  return dir;
715 }
716 
718 {
719  // get the CorrelationPlots directory
720  if (dir==0) dir = GetInputVariablesDir( type, 0 );
721  if (dir==0) return 0;
722  //
723  TDirectory* corrdir = (TDirectory*)dir->Get( "CorrelationPlots" );
724  if (corrdir==0) {
725  cout << "+++ Could not find CorrelationPlots directory 'CorrelationPlots'" << endl;
726  return 0;
727  }
728  return corrdir;
729 }
730 
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
Definition: TAttAxis.cxx:262
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:1272
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:5937
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:148
void SetPadLeftMargin(Float_t margin=0.1)
Definition: TStyle.h:334
Int_t UtoAbsPixel(Double_t u) const
Definition: TPad.h:359
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition: tmvaglob.cxx:429
virtual UInt_t GetHeight() const
Definition: TImage.h:229
void SetFrameBorderMode(Int_t mode=1)
Definition: TStyle.h:352
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:729
float Float_t
Definition: RtypesCore.h:53
virtual UInt_t GetWidth() const
Definition: TImage.h:228
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:640
R__EXTERN TStyle * gStyle
Definition: TStyle.h:402
void SetHistLineWidth(Width_t width=1)
Definition: TStyle.h:357
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:71
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Config & gConfig()
TH1 * h
Definition: legend2.C:5
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:7103
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:679
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:375
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
Definition: tmvaglob.cxx:77
Bool_t ExistMethodName(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:540
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)
Definition: tmvaglob.cxx:375
Basic string class.
Definition: TString.h:129
Int_t getTitleBox()
Definition: tmvaglob.h:46
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:202
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:717
#define NULL
Definition: RtypesCore.h:88
void SetPadBottomMargin(Float_t margin=0.1)
Definition: TStyle.h:332
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Definition: TStyle.cxx:1112
Iterator of linked list.
Definition: TList.h:183
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:318
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3909
void SetTitleBorderSize(Width_t size=2)
Definition: TStyle.h:381
void SetLegendBorderSize(Width_t size=4)
Definition: TStyle.h:325
Double_t GetXmin() const
Definition: TAxis.h:133
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:565
void SetFrameFillColor(Color_t color=1)
Definition: TStyle.h:346
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:338
void GetMethodTitle(TString &name, TKey *ikey)
Definition: tmvaglob.cxx:341
void SetTitleTextColor(Color_t color=1)
Definition: TStyle.h:378
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:24
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:1254
lv SetLineColor(kBlue)
Int_t VtoAbsPixel(Double_t v) const
Definition: TPad.h:360
A doubly linked list.
Definition: TList.h:43
TStyle objects may be created to define special styles.
Definition: TStyle.h:27
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:699
void SetPadBorderMode(Int_t mode=1)
Definition: TStyle.h:331
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:320
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:100
TRandom2 r(17)
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
void SetPadColor(Color_t color=19)
Definition: TStyle.h:329
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:199
TObject * Next()
Definition: TCollection.h:153
h1 SetFillColor(kGreen)
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
Definition: tmvaglob.cxx:607
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:1219
unsigned int UInt_t
Definition: RtypesCore.h:42
The most important graphics class in the ROOT system.
Definition: TPad.h:29
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
char * Form(const char *fmt,...)
Ssiz_t Length() const
Definition: TString.h:388
f1 SetLineWidth(4)
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
TAxis * GetYaxis()
Definition: TH1.h:301
static double p1(double t, double a, double b)
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:4602
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:4581
void SetTitleH(Float_t h=0)
Definition: TStyle.h:389
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
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 The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:272
const Bool_t kFALSE
Definition: RtypesCore.h:92
TString & Remove(Ssiz_t pos)
Definition: TString.h:621
The Canvas class.
Definition: TCanvas.h:31
virtual Int_t GetSumw2N() const
Definition: TH1.h:295
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=0)
Definition: tmvaglob.cxx:582
double f(double x)
Int_t getFrameFill()
Definition: tmvaglob.h:45
double Double_t
Definition: RtypesCore.h:55
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:875
Describe directory structure in memory.
Definition: TDirectory.h:34
int type
Definition: TGX11.cxx:120
Float_t GetPadTopMargin() const
Definition: TStyle.h:197
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:572
The TH1 histogram class.
Definition: TH1.h:56
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:353
void SetPadTopMargin(Float_t margin=0.1)
Definition: TStyle.h:333
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
Definition: TStyle.cxx:1332
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:77
void SetTitleFillColor(Color_t color=1)
Definition: TStyle.h:377
Definition: file.py:1
virtual TList * GetListOfKeys() const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition: TH1.cxx:8132
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:1267
void SetOptTitle(Int_t tit=1)
Definition: TStyle.h:309
#define gPad
Definition: TVirtualPad.h:284
Int_t getCanvas()
Definition: tmvaglob.h:44
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:110
void SetPadTickY(Int_t ticky)
Definition: TStyle.h:339
TKey * FindMethod(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:511
#define gDirectory
Definition: TDirectory.h:211
virtual Int_t GetNbinsX() const
Definition: TH1.h:277
virtual Int_t GetSize() const
Definition: TCollection.h:89
void SetPadRightMargin(Float_t margin=0.1)
Definition: TStyle.h:335
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
Int_t getSignalFill()
Definition: tmvaglob.h:50
const Bool_t kTRUE
Definition: RtypesCore.h:91
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:1460
TAxis * GetXaxis()
Definition: TH1.h:300
virtual void Close(Option_t *option="")
Close a file.
Definition: TFile.cxx:904
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:347
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
Definition: tmvaglob.cxx:635