Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
tmvaglob.cxx
Go to the documentation of this file.
1#include "TMVA/tmvaglob.h"
2#include "TMVA/Config.h"
3
4using std::cout;
5using 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() );
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'
177{
178 // destroy canvas'
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
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 // directory does not exists , try to make it
223 if (gSystem->AccessPathName(dir)) {
224 if (gSystem->mkdir(dir, kTRUE) != 0) {
225 Error("imgconv","Error creating plot directory: %s",dir.Data());
226 }
227 }
228
229 TString pngName = fname + ".png";
230 TString gifName = fname + ".gif";
231 TString epsName = fname + ".eps";
232 TString pdfName = fname + ".pdf";
233 c->cd();
234
235 // create eps (other option: c->Print( epsName ))
236 if (gConfig().fVariablePlotting.fUsePaperStyle) {
237 c->Print(epsName);
238 }
239 else {
240 if (gConfig().fVariablePlotting.fPlotFormat == Config::VariablePlotting::kGIF)
241 c->Print(gifName);
242 else if (gConfig().fVariablePlotting.fPlotFormat == Config::VariablePlotting::kPDF)
243 c->Print(pdfName);
244 else if (gConfig().fVariablePlotting.fPlotFormat == Config::VariablePlotting::kEPS)
245 c->Print(epsName);
246 else
247 c->Print(pngName);
248 }
249 }
250}
251
252TImage * TMVA::TMVAGlob::findImage(const char * imageName)
253{
254 // looks for the image in tutorialpath
255 //TString tutorialPath = "$ROOTSYS/tutorials/tmva"; // look for the image in here
256 TString tutorialPath = getenv ("ROOTSYS");
257 tutorialPath+="/tutorials/tmva";
258 TImage *img(0);
259 TString fullName = Form("%s/%s", tutorialPath.Data(), imageName);
260 Bool_t fileFound = ! gSystem->AccessPathName(fullName);
261
262 if(fileFound) {
263 img = TImage::Open(fullName);
264 } else {
265 cout << "+++ Could not open image: " << fullName << endl;
266 }
267 return img;
268}
269
271{
272
273 TImage *img = findImage("tmva_logo.gif");
274 if (!img) {
275 cout << "+++ Could not open image tmva_logo.gif" << endl;
276 return;
277 }
278
279 img->SetConstRatio(kFALSE);
280 UInt_t h_ = img->GetHeight();
281 UInt_t w_ = img->GetWidth();
282
283 Float_t r = w_/h_;
284 gPad->Update();
285 Float_t rpad = Double_t(gPad->VtoAbsPixel(0) - gPad->VtoAbsPixel(1))/(gPad->UtoAbsPixel(1) - gPad->UtoAbsPixel(0));
286 r *= rpad;
287
288 Float_t d = 0.055;
289 // absolute coordinates
290 Float_t x1R = 1 - gStyle->GetPadRightMargin();
291 Float_t y1B = 1 - gStyle->GetPadTopMargin()+.01; // we like the logo to sit a bit above the histo
292
293 Float_t x1L = x1R - d*r/skew;
294 Float_t y1T = y1B + d*v_scale*skew;
295 if (y1T>0.99) y1T = 0.99;
296
297 TPad *p1 = new TPad("imgpad", "imgpad", x1L, y1B, x1R, y1T );
298 p1->SetRightMargin(0);
299 p1->SetBottomMargin(0);
300 p1->SetLeftMargin(0);
301 p1->SetTopMargin(0);
302 p1->Draw();
303
304 Int_t xSizeInPixel = p1->UtoAbsPixel(1) - p1->UtoAbsPixel(0);
305 Int_t ySizeInPixel = p1->VtoAbsPixel(0) - p1->VtoAbsPixel(1);
306 if (xSizeInPixel<=25 || ySizeInPixel<=25) {
307 delete p1;
308 return; // ROOT doesn't draw smaller than this
309 }
310
311 p1->cd();
312 img->Draw();
313}
314
316{
317 if (h==0) return;
318 if (h->GetSumw2N() == 0) h->Sumw2();
319 if(h->GetSumOfWeights()!=0) {
320 Float_t dx = (h->GetXaxis()->GetXmax() - h->GetXaxis()->GetXmin())/h->GetNbinsX();
321 h->Scale( 1.0/h->GetSumOfWeights()/dx );
322 }
323}
325{
326 if (sig->GetSumw2N() == 0) sig->Sumw2();
327 if (bkg && bkg->GetSumw2N() == 0) bkg->Sumw2();
328
329 if(sig->GetSumOfWeights()!=0) {
330 Float_t dx = (sig->GetXaxis()->GetXmax() - sig->GetXaxis()->GetXmin())/sig->GetNbinsX();
331 sig->Scale( 1.0/sig->GetSumOfWeights()/dx );
332 }
333 if (bkg != 0 && bkg->GetSumOfWeights()!=0) {
334 Float_t dx = (bkg->GetXaxis()->GetXmax() - bkg->GetXaxis()->GetXmin())/bkg->GetNbinsX();
335 bkg->Scale( 1.0/bkg->GetSumOfWeights()/dx );
336 }
337}
338
339// the following are tools to help handling different methods and titles
340
341
343 if (mkey==0) return;
344 name = mkey->GetName();
345 name.ReplaceAll("Method_","");
346}
347
349 if (ikey==0) return;
350 name = ikey->GetName();
351}
352
354 if (mdir==0) return;
355 name = mdir->GetName();
356 name.ReplaceAll("Method_","");
357}
358
360 if (idir==0) return;
361 name = idir->GetName();
362}
363
364TKey *TMVA::TMVAGlob::NextKey( TIter & keyIter, TString className) {
365 TKey *key=(TKey *)keyIter.Next();
366 TKey *rkey=0;
367 Bool_t loop=(key!=0);
368 //
369 while (loop) {
370 TClass *cl = gROOT->GetClass(key->GetClassName());
371 if (cl->InheritsFrom(className.Data())) {
372 loop = kFALSE;
373 rkey = key;
374 } else {
375 key = (TKey *)keyIter.Next();
376 if (key==0) loop = kFALSE;
377 }
378 }
379 return rkey;
380}
381
383{
384 // get a list of keys with a given inheritance
385 // the list contains TKey objects
386 if (dir==0) dir = gDirectory;
387 TIter mnext(dir->GetListOfKeys());
388 TKey *mkey;
389 keys.Clear();
390 keys.SetOwner(kFALSE);
391 UInt_t ni=0;
392 while ((mkey = (TKey*)mnext())) {
393 // make sure, that we only look at TDirectory with name Method_<xxx>
394 TClass *cl = gROOT->GetClass(mkey->GetClassName());
395 if (cl->InheritsFrom(inherits)) {
396 keys.Add(mkey);
397 ni++;
398 }
399 }
400 return ni;
401}
402
404{
405 if (!dir) {
406 cout << "tmvaglob::GetNumberOfTargets is called with *dir==NULL :( " << endl;
407 return 0;
408 }
409 TIter next(dir->GetListOfKeys());
410 TKey* key = 0;
411 Int_t noTrgts = 0;
412
413 while ((key = (TKey*)next())) {
414 if (key->GetCycle() != 1) continue;
415 if (TString(key->GetName()).Contains("__Regression_target")) noTrgts++;
416 }
417 return noTrgts;
418}
419
421{
422 TIter next(dir->GetListOfKeys());
423 TKey* key = 0;
424 Int_t noVars = 0;
425
426 while ((key = (TKey*)next())) {
427 if (key->GetCycle() != 1) continue;
428
429 // count number of variables (signal is sufficient), exclude target(s)
430 if (TString(key->GetName()).Contains("__Signal") || (TString(key->GetName()).Contains("__Regression") && !(TString(key->GetName()).Contains("__Regression_target")))) noVars++;
431 }
432
433 return noVars;
434}
435
437{
438 TIter next(dir->GetListOfKeys());
439 TKey* key = 0;
440 std::vector<TString> names;
441
442 while ((key = (TKey*)next())) {
443 if (key->GetCycle() != 1) continue;
444 TClass *cl = gROOT->GetClass(key->GetClassName());
445 if (!cl->InheritsFrom("TH1")) continue;
446 TString name(key->GetName());
447 Int_t pos = name.Index("__");
448 if (pos != -1) {
449 name.Remove(pos);
450 }
451 Bool_t hasname = false;
452 std::vector<TString>::const_iterator iter = names.begin();
453 while(iter != names.end()){
454 if(name.CompareTo(*iter)==0)
455 hasname=true;
456 ++iter;
457 }
458 if(!hasname)
459 names.push_back(name);
460 }
461 return names;
462}
463
465 std::vector<TString> names(GetInputVariableNames(dir));
466 return names.end() - names.begin();
467}
468
469std::vector<TString> TMVA::TMVAGlob::GetClassNames(TDirectory *dir )
470{
471
472 TIter next(dir->GetListOfKeys());
473 TKey* key = 0;
474 //set<std::string> varnames;
475 std::vector<TString> names;
476
477 while ((key = (TKey*)next())) {
478 if (key->GetCycle() != 1) continue;
479 TClass *cl = gROOT->GetClass(key->GetClassName());
480 if (!cl->InheritsFrom("TH1")) continue;
481 TString name(key->GetName());
482 Int_t pos = name.Index("__");
483 if (pos == -1)
484 continue;
485 name.ReplaceAll("_Deco","");
486 name.ReplaceAll("_Gauss","");
487 name.ReplaceAll("_PCA","");
488 name.ReplaceAll("_Id","");
489 name.ReplaceAll("_vs_","");
490 name.Remove(0, pos + 2);
491
492 /*Int_t pos = name.First("__");
493 name.Remove(0,pos+2);
494 char c = '_';
495 pos = name.Last(c);
496 name.Remove(pos);
497 if(name.Contains("Gauss")){
498 pos = name.Last(c);
499 name.Remove(pos);
500 }
501 pos = name.Last(c);
502 if(pos!=-1)
503 name.Remove(0,pos+1);
504 */
505 Bool_t hasname = false;
506 std::vector<TString>::const_iterator iter = names.begin();
507 while(iter != names.end()){
508 if(name.CompareTo(*iter)==0)
509 hasname=true;
510 ++iter;
511 }
512 if(!hasname)
513 names.push_back(name);
514 }
515 return names;
516}
517
518
520{
521 // find the key for a method
522 if (dir==0) dir = gDirectory;
523 TIter mnext(dir->GetListOfKeys());
524 TKey *mkey;
525 TKey *retkey=0;
526 Bool_t loop=kTRUE;
527 while (loop) {
528 mkey = (TKey*)mnext();
529 if (mkey==0) {
530 loop = kFALSE;
531 }
532 else {
533 TString clname = mkey->GetClassName();
534 TClass *cl = gROOT->GetClass(clname);
535 if (cl->InheritsFrom("TDirectory")) {
536 TString mname = mkey->GetName(); // method name
537 TString tname = "Method_"+name; // target name
538 if (mname==tname) { // target found!
539 loop = kFALSE;
540 retkey = mkey;
541 }
542 }
543 }
544 }
545 return retkey;
546}
547
549{
550 // find the key for a method
551 if (dir==0) dir = gDirectory;
552 TIter mnext(dir->GetListOfKeys());
553 TKey *mkey;
554 Bool_t loop=kTRUE;
555 while (loop) {
556 mkey = (TKey*)mnext();
557 if (mkey==0) {
558 loop = kFALSE;
559 }
560 else {
561 TString clname = mkey->GetClassName();
562 TString keyname = mkey->GetName();
563 TClass *cl = gROOT->GetClass(clname);
564 if (keyname.Contains("Method") && cl->InheritsFrom("TDirectory")) {
565
566 TDirectory* d_ = (TDirectory*)dir->Get( keyname );
567 if (!d_) {
568 cout << "HUUUGE TROUBLES IN TMVAGlob::ExistMethodName() --> contact authors" << endl;
569 return kFALSE;
570 }
571
572 TIter mnext_(d_->GetListOfKeys());
573 TKey *mkey_;
574 while ((mkey_ = (TKey*)mnext_())) {
575 TString clname_ = mkey_->GetClassName();
576 TClass *cl_ = gROOT->GetClass(clname_);
577 if (cl_->InheritsFrom("TDirectory")) {
578 TString mname = mkey_->GetName(); // method name
579 if (mname==name) { // target found!
580 return kTRUE;
581 }
582 }
583 }
584 }
585 }
586 }
587 return kFALSE;
588}
589
591{
592 // get a list of methods
593 // the list contains TKey objects
594 if (dir==0) dir = gDirectory;
595 TIter mnext(dir->GetListOfKeys());
596 TKey *mkey;
597 methods.Clear();
598 methods.SetOwner(kFALSE);
599 UInt_t ni=0;
600 while ((mkey = (TKey*)mnext())) {
601 // make sure, that we only look at TDirectory with name Method_<xxx>
602 TString name = mkey->GetClassName();
603 TClass *cl = gROOT->GetClass(name);
604 if (cl->InheritsFrom("TDirectory")) {
605 if (TString(mkey->GetName()).BeginsWith("Method_")) {
606 methods.Add(mkey);
607 ni++;
608 }
609 }
610 }
611 cout << "--- Found " << ni << " classifier types" << endl;
612 return ni;
613}
614
616{
617 // get a list of all jobs in all method directories
618 // based on ideas by Peter and Joerg found in macro deviations.C
619 TIter next(file->GetListOfKeys());
620 TKey *key(0);
621 while ((key = (TKey*)next())) {
622
623 if (TString(key->GetName()).BeginsWith("Method_")) {
624 if (gROOT->GetClass(key->GetClassName())->InheritsFrom("TDirectory")) {
625
626 TDirectory* mDir = (TDirectory*)key->ReadObj();
627
628 TIter keyIt(mDir->GetListOfKeys());
629 TKey *jobkey;
630 while ((jobkey = (TKey*)keyIt())) {
631 if (!gROOT->GetClass(jobkey->GetClassName())->InheritsFrom("TDirectory")) continue;
632
633 TDirectory *jobDir = (TDirectory *)jobkey->ReadObj();
634 cout << "jobdir name " << jobDir->GetName() << endl;
635 jobdirs.Add(jobDir);
636 }
637 }
638 }
639 }
640 return jobdirs.GetSize();
641}
642
644{
645 // get a list of titles (i.e TDirectory) given a method dir
646 UInt_t ni=0;
647 if (rfdir==0) return 0;
648 TList *keys = rfdir->GetListOfKeys();
649 if (keys==0) {
650 cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
651 return 0;
652 }
653 //
654 TIter rfnext(rfdir->GetListOfKeys());
655 TKey *rfkey;
656 titles.Clear();
657 titles.SetOwner(kFALSE);
658 while ((rfkey = (TKey*)rfnext())) {
659 // make sure, that we only look at histograms
660 TClass *cl = gROOT->GetClass(rfkey->GetClassName());
661 if (cl->InheritsFrom("TDirectory")) {
662 titles.Add(rfkey);
663 ni++;
664 }
665 }
666 cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
667 return ni;
668}
669
671{
672 // get the list of all titles for a given method
673 // if the input dir is 0, gDirectory is used
674 // returns a list of keys
675 UInt_t ni=0;
676 if (dir==0) dir = gDirectory;
677 TDirectory* rfdir = (TDirectory*)dir->Get( methodName );
678 if (rfdir==0) {
679 cout << "+++ Could not locate directory '" << methodName << endl;
680 return 0;
681 }
682
683 return GetListOfTitles( rfdir, titles );
684
685 TList *keys = rfdir->GetListOfKeys();
686 if (keys==0) {
687 cout << "+++ Directory '" << methodName << "' contains no keys" << endl;
688 return 0;
689 }
690 //
691 TIter rfnext(rfdir->GetListOfKeys());
692 TKey *rfkey;
693 titles.Clear();
694 titles.SetOwner(kFALSE);
695 while ((rfkey = (TKey*)rfnext())) {
696 // make sure, that we only look at histograms
697 TClass *cl = gROOT->GetClass(rfkey->GetClassName());
698 if (cl->InheritsFrom("TDirectory")) {
699 titles.Add(rfkey);
700 ni++;
701 }
702 }
703 cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl;
704 return ni;
705}
706
708{
709 // get the InputVariables directory
710 const TString directories[TMVAGlob::kNumOfMethods] = { "InputVariables_Id",
711 "InputVariables_Deco",
712 "InputVariables_PCA",
713 "InputVariables_Gauss_Deco" };
714 if (dir==0) dir = gDirectory;
715
716 // get top dir containing all hists of the variables
717 dir = (TDirectory*)gDirectory->Get( directories[type] );
718 if (dir==0) {
719 cout << "+++ Could not locate input variable directory '" << directories[type] << endl;
720 return 0;
721 }
722 return dir;
723}
724
726{
727 // get the CorrelationPlots directory
728 if (dir==0) dir = GetInputVariablesDir( type, 0 );
729 if (dir==0) return 0;
730 //
731 TDirectory* corrdir = (TDirectory*)dir->Get( "CorrelationPlots" );
732 if (corrdir==0) {
733 cout << "+++ Could not find CorrelationPlots directory 'CorrelationPlots'" << endl;
734 return 0;
735 }
736 return corrdir;
737}
#define d(i)
Definition RSha256.hxx:102
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define gDirectory
Definition TDirectory.h:386
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:197
Option_t Option_t SetLineWidth
Option_t Option_t SetFillStyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t SetLineColor
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:405
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
R__EXTERN TStyle * gStyle
Definition TStyle.h:414
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
#define gPad
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition TAttAxis.cxx:298
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:203
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
Definition TAttAxis.cxx:309
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:39
virtual void SetConstRatio(Bool_t constRatio=kTRUE)
Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:40
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition TAttMarker.h:45
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition TAttPad.cxx:99
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition TAttPad.cxx:109
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition TAttPad.cxx:119
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition TAttPad.cxx:129
Double_t GetXmax() const
Definition TAxis.h:135
Double_t GetXmin() const
Definition TAxis.h:134
The Canvas class.
Definition TCanvas.h:23
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4874
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2968
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual TList * GetListOfKeys() const
Definition TDirectory.h:223
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:51
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:4053
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
Definition Haxis.cxx:267
TAxis * GetXaxis()
Definition TH1.h:322
virtual Int_t GetNbinsX() const
Definition TH1.h:295
TAxis * GetYaxis()
Definition TH1.h:323
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition TH1.cxx:6586
virtual Int_t GetSumw2N() const
Definition TH1.h:313
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition TH1.cxx:7827
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition TH1.cxx:8886
An abstract interface to image processing library.
Definition TImage.h:29
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition TImage.cxx:118
virtual UInt_t GetWidth() const
Definition TImage.h:228
virtual UInt_t GetHeight() const
Definition TImage.h:229
TObject * Next()
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
virtual const char * GetClassName() const
Definition TKey.h:75
Short_t GetCycle() const
Return cycle number associated to this key.
Definition TKey.cxx:577
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition TKey.cxx:750
Iterator of linked list.
Definition TList.h:191
A doubly linked list.
Definition TList.h:38
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:402
void Add(TObject *obj) override
Definition TList.h:81
class TMVA::Config::VariablePlotting fVariablePlotting
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
An array of TObjects.
Definition TObjArray.h:31
Int_t GetEntriesFast() const
Definition TObjArray.h:58
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:274
The most important graphics class in the ROOT system.
Definition TPad.h:28
Int_t UtoAbsPixel(Double_t u) const override
Definition TPad.h:366
Int_t VtoAbsPixel(Double_t v) const override
Definition TPad.h:367
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:597
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition TPad.cxx:1268
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:627
TString & Remove(Ssiz_t pos)
Definition TString.h:685
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:636
TStyle objects may be created to define special styles.
Definition TStyle.h:29
void SetPadBorderMode(Int_t mode=1)
Definition TStyle.h:341
void SetOptTitle(Int_t tit=1)
Definition TStyle.h:319
void SetPadTopMargin(Float_t margin=0.1)
Definition TStyle.h:343
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:1589
void SetPadBottomMargin(Float_t margin=0.1)
Definition TStyle.h:342
void SetFrameFillColor(Color_t color=1)
Definition TStyle.h:356
void SetPadRightMargin(Float_t margin=0.1)
Definition TStyle.h:345
void SetCanvasColor(Color_t color=19)
Definition TStyle.h:328
Float_t GetPadRightMargin() const
Definition TStyle.h:206
void SetTitleBorderSize(Width_t size=2)
Definition TStyle.h:392
void SetCanvasBorderMode(Int_t mode=1)
Definition TStyle.h:330
void SetFrameBorderMode(Int_t mode=1)
Definition TStyle.h:362
void SetPadTickY(Int_t ticky)
Definition TStyle.h:349
void SetPadTickX(Int_t tickx)
Definition TStyle.h:348
void SetTitleTextColor(Color_t color=1)
Definition TStyle.h:389
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
See TColor::SetPalette.
Definition TStyle.cxx:1781
void SetPadLeftMargin(Float_t margin=0.1)
Definition TStyle.h:344
void SetLegendBorderSize(Width_t size=4)
Definition TStyle.h:335
void SetTitleFillColor(Color_t color=1)
Definition TStyle.h:388
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Definition TStyle.cxx:1432
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
Definition TStyle.cxx:1653
void SetPadColor(Color_t color=19)
Definition TStyle.h:339
void SetTitleH(Float_t h=0)
Definition TStyle.h:400
void SetHistLineWidth(Width_t width=1)
Definition TStyle.h:367
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
Float_t GetPadTopMargin() const
Definition TStyle.h:204
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
Definition TSystem.cxx:909
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:1299
Int_t getFrameFill()
Definition tmvaglob.h:45
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
Definition tmvaglob.cxx:615
Int_t getTitleBorder()
Definition tmvaglob.h:47
Int_t getTitleBox()
Definition tmvaglob.h:46
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
Definition tmvaglob.cxx:643
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition tmvaglob.cxx:176
Int_t GetNumberOfInputVariablesMultiClass(TDirectory *dir)
Definition tmvaglob.cxx:464
Int_t getTitleText()
Definition tmvaglob.h:48
Int_t GetNumberOfInputVariables(TDirectory *dir)
Definition tmvaglob.cxx:420
TKey * NextKey(TIter &keyIter, TString className)
Definition tmvaglob.cxx:364
void GetMethodTitle(TString &name, TKey *ikey)
Definition tmvaglob.cxx:348
Int_t getCanvas()
Definition tmvaglob.h:44
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
Definition tmvaglob.cxx:270
void DestroyCanvases()
Definition tmvaglob.cxx:166
Int_t getSignalFill()
Definition tmvaglob.h:50
Int_t getBackgroundFill()
Definition tmvaglob.h:52
TDirectory * GetInputVariablesDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:707
void SetSignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *all=nullptr)
Definition tmvaglob.cxx:8
TFile * OpenFile(const TString &fin)
Definition tmvaglob.cxx:192
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
Definition tmvaglob.cxx:77
TKey * FindMethod(TString name, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:519
void NormalizeHists(TH1 *sig, TH1 *bkg=nullptr)
Definition tmvaglob.cxx:324
Int_t getBackgroundLine()
Definition tmvaglob.h:51
Bool_t ExistMethodName(TString name, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:548
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:590
void GetMethodName(TString &name, TKey *mkey)
Definition tmvaglob.cxx:342
Int_t GetNumberOfTargets(TDirectory *dir)
Definition tmvaglob.cxx:403
TImage * findImage(const char *imageName)
Definition tmvaglob.cxx:252
std::vector< TString > GetInputVariableNames(TDirectory *dir)
Definition tmvaglob.cxx:436
void SetMultiClassStyle(TObjArray *hists)
Definition tmvaglob.cxx:47
void NormalizeHist(TH1 *h)
Definition tmvaglob.cxx:315
TDirectory * GetCorrelationPlotsDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:725
Int_t getSignalLine()
Definition tmvaglob.h:49
void SetTMVAStyle()
Definition tmvaglob.cxx:96
std::vector< TString > GetClassNames(TDirectory *dir)
Definition tmvaglob.cxx:469
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:382
void imgconv(TCanvas *c, const TString &fname)
Definition tmvaglob.cxx:212
Config & gConfig()
Definition file.py:1