Logo ROOT   6.08/07
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  //set<std::string> varnames;
434  std::vector<TString> names;
435 
436  while ((key = (TKey*)next())) {
437  if (key->GetCycle() != 1) continue;
438  TClass *cl = gROOT->GetClass(key->GetClassName());
439  if (!cl->InheritsFrom("TH1")) continue;
440  TString name(key->GetName());
441  Int_t pos = name.First("__");
442  name.Remove(pos);
443  Bool_t hasname = false;
444  std::vector<TString>::const_iterator iter = names.begin();
445  while(iter != names.end()){
446  if(name.CompareTo(*iter)==0)
447  hasname=true;
448  iter++;
449  }
450  if(!hasname)
451  names.push_back(name);
452  }
453  return names;
454 }
455 
457  std::vector<TString> names(GetInputVariableNames(dir));
458  return names.end() - names.begin();
459 }
460 
461 std::vector<TString> TMVA::TMVAGlob::GetClassNames(TDirectory *dir )
462 {
463 
464  TIter next(dir->GetListOfKeys());
465  TKey* key = 0;
466  //set<std::string> varnames;
467  std::vector<TString> names;
468 
469  while ((key = (TKey*)next())) {
470  if (key->GetCycle() != 1) continue;
471  TClass *cl = gROOT->GetClass(key->GetClassName());
472  if (!cl->InheritsFrom("TH1")) continue;
473  TString name(key->GetName());
474  name.ReplaceAll("_Deco","");
475  name.ReplaceAll("_Gauss","");
476  name.ReplaceAll("_PCA","");
477  name.ReplaceAll("_Id","");
478  name.ReplaceAll("_vs_","");
479  char c = '_';
480  Int_t pos = name.Last(c);
481  name.Remove(0,pos+1);
482 
483  /*Int_t pos = name.First("__");
484  name.Remove(0,pos+2);
485  char c = '_';
486  pos = name.Last(c);
487  name.Remove(pos);
488  if(name.Contains("Gauss")){
489  pos = name.Last(c);
490  name.Remove(pos);
491  }
492  pos = name.Last(c);
493  if(pos!=-1)
494  name.Remove(0,pos+1);
495  */
496  Bool_t hasname = false;
497  std::vector<TString>::const_iterator iter = names.begin();
498  while(iter != names.end()){
499  if(name.CompareTo(*iter)==0)
500  hasname=true;
501  iter++;
502  }
503  if(!hasname)
504  names.push_back(name);
505  }
506  return names;
507 }
508 
509 
511 {
512  // find the key for a method
513  if (dir==0) dir = gDirectory;
514  TIter mnext(dir->GetListOfKeys());
515  TKey *mkey;
516  TKey *retkey=0;
517  Bool_t loop=kTRUE;
518  while (loop) {
519  mkey = (TKey*)mnext();
520  if (mkey==0) {
521  loop = kFALSE;
522  }
523  else {
524  TString clname = mkey->GetClassName();
525  TClass *cl = gROOT->GetClass(clname);
526  if (cl->InheritsFrom("TDirectory")) {
527  TString mname = mkey->GetName(); // method name
528  TString tname = "Method_"+name; // target name
529  if (mname==tname) { // target found!
530  loop = kFALSE;
531  retkey = mkey;
532  }
533  }
534  }
535  }
536  return retkey;
537 }
538 
540 {
541  // find the key for a method
542  if (dir==0) dir = gDirectory;
543  TIter mnext(dir->GetListOfKeys());
544  TKey *mkey;
545  Bool_t loop=kTRUE;
546  while (loop) {
547  mkey = (TKey*)mnext();
548  if (mkey==0) {
549  loop = kFALSE;
550  }
551  else {
552  TString clname = mkey->GetClassName();
553  TString keyname = mkey->GetName();
554  TClass *cl = gROOT->GetClass(clname);
555  if (keyname.Contains("Method") && cl->InheritsFrom("TDirectory")) {
556 
557  TDirectory* d_ = (TDirectory*)dir->Get( keyname );
558  if (!d_) {
559  cout << "HUUUGE TROUBLES IN TMVAGlob::ExistMethodName() --> contact authors" << endl;
560  return kFALSE;
561  }
562 
563  TIter mnext_(d_->GetListOfKeys());
564  TKey *mkey_;
565  while ((mkey_ = (TKey*)mnext_())) {
566  TString clname_ = mkey_->GetClassName();
567  TClass *cl_ = gROOT->GetClass(clname_);
568  if (cl_->InheritsFrom("TDirectory")) {
569  TString mname = mkey_->GetName(); // method name
570  if (mname==name) { // target found!
571  return kTRUE;
572  }
573  }
574  }
575  }
576  }
577  }
578  return kFALSE;
579 }
580 
582 {
583  // get a list of methods
584  // the list contains TKey objects
585  if (dir==0) dir = gDirectory;
586  TIter mnext(dir->GetListOfKeys());
587  TKey *mkey;
588  methods.Clear();
589  methods.SetOwner(kFALSE);
590  UInt_t ni=0;
591  while ((mkey = (TKey*)mnext())) {
592  // make sure, that we only look at TDirectory with name Method_<xxx>
593  TString name = mkey->GetClassName();
594  TClass *cl = gROOT->GetClass(name);
595  if (cl->InheritsFrom("TDirectory")) {
596  if (TString(mkey->GetName()).BeginsWith("Method_")) {
597  methods.Add(mkey);
598  ni++;
599  }
600  }
601  }
602  cout << "--- Found " << ni << " classifier types" << endl;
603  return ni;
604 }
605 
607 {
608  // get a list of all jobs in all method directories
609  // based on ideas by Peter and Joerg found in macro deviations.C
610  TIter next(file->GetListOfKeys());
611  TKey *key(0);
612  while ((key = (TKey*)next())) {
613 
614  if (TString(key->GetName()).BeginsWith("Method_")) {
615  if (gROOT->GetClass(key->GetClassName())->InheritsFrom("TDirectory")) {
616 
617  TDirectory* mDir = (TDirectory*)key->ReadObj();
618 
619  TIter keyIt(mDir->GetListOfKeys());
620  TKey *jobkey;
621  while ((jobkey = (TKey*)keyIt())) {
622  if (!gROOT->GetClass(jobkey->GetClassName())->InheritsFrom("TDirectory")) continue;
623 
624  TDirectory *jobDir = (TDirectory *)jobkey->ReadObj();
625  cout << "jobdir name " << jobDir->GetName() << endl;
626  jobdirs.Add(jobDir);
627  }
628  }
629  }
630  }
631  return jobdirs.GetSize();
632 }
633 
635 {
636  // get a list of titles (i.e TDirectory) given a method dir
637  UInt_t ni=0;
638  if (rfdir==0) return 0;
639  TList *keys = rfdir->GetListOfKeys();
640  if (keys==0) {
641  cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
642  return 0;
643  }
644  //
645  TIter rfnext(rfdir->GetListOfKeys());
646  TKey *rfkey;
647  titles.Clear();
648  titles.SetOwner(kFALSE);
649  while ((rfkey = (TKey*)rfnext())) {
650  // make sure, that we only look at histograms
651  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
652  if (cl->InheritsFrom("TDirectory")) {
653  titles.Add(rfkey);
654  ni++;
655  }
656  }
657  cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
658  return ni;
659 }
660 
662 {
663  // get the list of all titles for a given method
664  // if the input dir is 0, gDirectory is used
665  // returns a list of keys
666  UInt_t ni=0;
667  if (dir==0) dir = gDirectory;
668  TDirectory* rfdir = (TDirectory*)dir->Get( methodName );
669  if (rfdir==0) {
670  cout << "+++ Could not locate directory '" << methodName << endl;
671  return 0;
672  }
673 
674  return GetListOfTitles( rfdir, titles );
675 
676  TList *keys = rfdir->GetListOfKeys();
677  if (keys==0) {
678  cout << "+++ Directory '" << methodName << "' contains no keys" << endl;
679  return 0;
680  }
681  //
682  TIter rfnext(rfdir->GetListOfKeys());
683  TKey *rfkey;
684  titles.Clear();
685  titles.SetOwner(kFALSE);
686  while ((rfkey = (TKey*)rfnext())) {
687  // make sure, that we only look at histograms
688  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
689  if (cl->InheritsFrom("TDirectory")) {
690  titles.Add(rfkey);
691  ni++;
692  }
693  }
694  cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl;
695  return ni;
696 }
697 
699 {
700  // get the InputVariables directory
701  const TString directories[TMVAGlob::kNumOfMethods] = { "InputVariables_Id",
702  "InputVariables_Deco",
703  "InputVariables_PCA",
704  "InputVariables_Gauss_Deco" };
705  if (dir==0) dir = gDirectory;
706 
707  // get top dir containing all hists of the variables
708  dir = (TDirectory*)gDirectory->Get( directories[type] );
709  if (dir==0) {
710  cout << "+++ Could not locate input variable directory '" << directories[type] << endl;
711  return 0;
712  }
713  return dir;
714 }
715 
717 {
718  // get the CorrelationPlots directory
719  if (dir==0) dir = GetInputVariablesDir( type, 0 );
720  if (dir==0) return 0;
721  //
722  TDirectory* corrdir = (TDirectory*)dir->Get( "CorrelationPlots" );
723  if (corrdir==0) {
724  cout << "+++ Could not find CorrelationPlots directory 'CorrelationPlots'" << endl;
725  return 0;
726  }
727  return corrdir;
728 }
729 
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Config & gConfig()
Definition: Config.cxx:43
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:51
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:1266
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition: TH1.cxx:5936
An array of TObjects.
Definition: TObjArray.h:39
void imgconv(TCanvas *c, const TString &fname)
Definition: tmvaglob.cxx:212
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:158
void SetPadLeftMargin(Float_t margin=0.1)
Definition: TStyle.h:350
Int_t UtoAbsPixel(Double_t u) const
Definition: TPad.h:354
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition: tmvaglob.cxx:429
virtual UInt_t GetHeight() const
Definition: TImage.h:237
void SetFrameBorderMode(Int_t mode=1)
Definition: TStyle.h:368
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
return c
virtual UInt_t GetWidth() const
Definition: TImage.h:236
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
void SetHistLineWidth(Width_t width=1)
Definition: TStyle.h:373
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:77
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.
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:461
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition: TH1.cxx:7100
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:50
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:659
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:364
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
Definition: tmvaglob.cxx:77
Bool_t ExistMethodName(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:539
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)
Definition: tmvaglob.cxx:375
Basic string class.
Definition: TString.h:137
Int_t getTitleBox()
Definition: tmvaglob.h:46
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:255
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:44
Int_t getSignalLine()
Definition: tmvaglob.h:49
An abstract interface to image processing library.
Definition: TImage.h:37
TKey * NextKey(TIter &keyIter, TString className)
Definition: tmvaglob.cxx:357
TDirectory * GetCorrelationPlotsDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
Definition: tmvaglob.cxx:716
void SetPadBottomMargin(Float_t margin=0.1)
Definition: TStyle.h:348
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Definition: TStyle.cxx:1107
Iterator of linked list.
Definition: TList.h:187
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:901
Int_t getTitleText()
Definition: tmvaglob.h:48
void SetCanvasColor(Color_t color=19)
Definition: TStyle.h:334
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:3907
void SetTitleBorderSize(Width_t size=2)
Definition: TStyle.h:397
void SetLegendBorderSize(Width_t size=4)
Definition: TStyle.h:341
Double_t GetXmin() const
Definition: TAxis.h:139
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:526
void SetFrameFillColor(Color_t color=1)
Definition: TStyle.h:362
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:354
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:394
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:30
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:1208
lv SetLineColor(kBlue)
Int_t VtoAbsPixel(Double_t v) const
Definition: TPad.h:355
A doubly linked list.
Definition: TList.h:47
TStyle objects may be created to define special styles.
Definition: TStyle.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
TDirectory * GetInputVariablesDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
Definition: tmvaglob.cxx:698
void SetPadBorderMode(Int_t mode=1)
Definition: TStyle.h:347
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:336
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:549
void SetPadColor(Color_t color=19)
Definition: TStyle.h:345
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:42
Int_t getTitleBorder()
Definition: tmvaglob.h:47
a SetFillStyle(0)
Float_t GetPadRightMargin() const
Definition: TStyle.h:215
TObject * Next()
Definition: TCollection.h:158
h1 SetFillColor(kGreen)
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
Definition: tmvaglob.cxx:606
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:1209
unsigned int UInt_t
Definition: RtypesCore.h:42
The most important graphics class in the ROOT system.
Definition: TPad.h:37
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
char * Form(const char *fmt,...)
Ssiz_t Length() const
Definition: TString.h:390
f1 SetLineWidth(4)
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:45
TAxis * GetYaxis()
Definition: TH1.h:325
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:456
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4610
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:4160
void SetTitleH(Float_t h=0)
Definition: TStyle.h:405
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:46
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
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
The Canvas class.
Definition: TCanvas.h:41
virtual Int_t GetSumw2N() const
Definition: TH1.h:319
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=0)
Definition: tmvaglob.cxx:581
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:865
Describe directory structure in memory.
Definition: TDirectory.h:44
int type
Definition: TGX11.cxx:120
Float_t GetPadTopMargin() const
Definition: TStyle.h:213
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
The TH1 histogram class.
Definition: TH1.h:80
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:349
void SetPadTopMargin(Float_t margin=0.1)
Definition: TStyle.h:349
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
Definition: TStyle.cxx:1322
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:81
void SetTitleFillColor(Color_t color=1)
Definition: TStyle.h:393
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:8130
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:1257
void SetOptTitle(Int_t tit=1)
Definition: TStyle.h:325
#define NULL
Definition: Rtypes.h:82
#define gPad
Definition: TVirtualPad.h:289
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:355
TKey * FindMethod(TString name, TDirectory *dir=0)
Definition: tmvaglob.cxx:510
#define gDirectory
Definition: TDirectory.h:221
virtual Int_t GetNbinsX() const
Definition: TH1.h:301
virtual Int_t GetSize() const
Definition: TCollection.h:95
void SetPadRightMargin(Float_t margin=0.1)
Definition: TStyle.h:351
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
Int_t getSignalFill()
Definition: tmvaglob.h:50
Double_t GetXmax() const
Definition: TAxis.h:140
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:1450
char name[80]
Definition: TGX11.cxx:109
TAxis * GetXaxis()
Definition: TH1.h:324
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:349
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
Definition: tmvaglob.cxx:634