Enumerations | Functions | Variables
TMVAGlob Namespace Reference

Enumerations

enum  TypeOfPlot {
  kId = 0, kNorm, kDecorrelated, kPCA,
  kGaussDecorr, kNumOfMethods
}
 

Functions

void SetSignalAndBackgroundStyle (TH1 *sig, TH1 *bkg, TH1 *all=0)
 
void SetFrameStyle (TH1 *frame, Float_t scale=1.0)
 
void SetTMVAStyle ()
 
void DestroyCanvases ()
 
void Initialize (Bool_t useTMVAStyle=kTRUE)
 
TFile * OpenFile (const TString &fin)
 
void imgconv (TCanvas *c, const TString &fname)
 
TImage * findImage (const char *imageName)
 
void plot_logo (Float_t v_scale=1.0, Float_t skew=1.0)
 
void NormalizeHist (TH1 *h)
 
void NormalizeHists (TH1 *sig, TH1 *bkg=0)
 
void GetMethodName (TString &name, TKey *mkey)
 
void GetMethodTitle (TString &name, TKey *ikey)
 
void GetMethodName (TString &name, TDirectory *mdir)
 
void GetMethodTitle (TString &name, TDirectory *idir)
 
TKey * NextKey (TIter &keyIter, TString className)
 
UInt_t GetListOfKeys (TList &keys, TString inherits, TDirectory *dir=0)
 
Int_t GetNumberOfTargets (TDirectory *dir)
 
Int_t GetNumberOfInputVariables (TDirectory *dir)
 
TKey * FindMethod (TString name, TDirectory *dir=0)
 
Bool_t ExistMethodName (TString name, TDirectory *dir=0)
 
UInt_t GetListOfMethods (TList &methods, TDirectory *dir=0)
 
UInt_t GetListOfJobs (TFile *file, TList &jobdirs)
 
UInt_t GetListOfTitles (TDirectory *rfdir, TList &titles)
 
UInt_t GetListOfTitles (TString &methodName, TList &titles, TDirectory *dir=0)
 
TDirectory * GetInputVariablesDir (TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
 
TDirectory * GetCorrelationPlotsDir (TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
 

Variables

static Bool_t UsePaperStyle = 0
 
static Int_t c_Canvas = TColor::GetColor( "#e9e6da" )
 
static Int_t c_FrameFill = TColor::GetColor( "#fffffd" )
 
static Int_t c_TitleBox = TColor::GetColor( "#dae1e6" )
 
static Int_t c_SignalLine = TColor::GetColor( "#0000ee" )
 
static Int_t c_SignalFill = TColor::GetColor( "#7d99d1" )
 
static Int_t c_BackgroundLine = TColor::GetColor( "#ff0000" )
 
static Int_t c_BackgroundFill = TColor::GetColor( "#ff0000" )
 
static Int_t c_NovelBlue = TColor::GetColor( "#2244a5" )
 

Enumeration Type Documentation

Enumerator
kId 
kNorm 
kDecorrelated 
kPCA 
kGaussDecorr 
kNumOfMethods 

Definition at line 31 of file tmvaglob.C.

Function Documentation

void TMVAGlob::DestroyCanvases ( )

Definition at line 174 of file tmvaglob.C.

References PandAna.Demos.demo0::loc, and msf_helper::o.

Referenced by TMVA::TMVAGlob::Initialize().

175  {
176 
177  TList* loc = (TList*)gROOT->GetListOfCanvases();
178  TListIter itc(loc);
179  TObject *o(0);
180  while ((o = itc())) delete o;
181  }
Bool_t TMVAGlob::ExistMethodName ( TString  name,
TDirectory *  dir = 0 
)

Definition at line 471 of file tmvaglob.C.

References om::cout, dir, and allTimeWatchdog::endl.

472  {
473  // find the key for a method
474  if (dir==0) dir = gDirectory;
475  TIter mnext(dir->GetListOfKeys());
476  TKey *mkey;
477  Bool_t loop=kTRUE;
478  while (loop) {
479  mkey = (TKey*)mnext();
480  if (mkey==0) {
481  loop = kFALSE;
482  }
483  else {
484  TString clname = mkey->GetClassName();
485  TString keyname = mkey->GetName();
486  TClass *cl = gROOT->GetClass(clname);
487  if (keyname.Contains("Method") && cl->InheritsFrom("TDirectory")) {
488 
489  TDirectory* d_ = (TDirectory*)dir->Get( keyname );
490  if (!d_) {
491  cout << "HUUUGE TROUBLES IN TMVAGlob::ExistMethodName() --> contact authors" << endl;
492  return kFALSE;
493  }
494 
495  TIter mnext_(d_->GetListOfKeys());
496  TKey *mkey_;
497  while ((mkey_ = (TKey*)mnext_())) {
498  TString clname_ = mkey_->GetClassName();
499  TClass *cl_ = gROOT->GetClass(clname_);
500  if (cl_->InheritsFrom("TDirectory")) {
501  TString mname = mkey_->GetName(); // method name
502  if (mname==name) { // target found!
503  return kTRUE;
504  }
505  }
506  }
507  }
508  }
509  }
510  return kFALSE;
511  }
const XML_Char * name
Definition: expat.h:151
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
TImage* TMVAGlob::findImage ( const char *  imageName)

Definition at line 253 of file tmvaglob.C.

References HTMLTools::img(), and path.

Referenced by TMVA::TMVAGlob::plot_logo().

254  {
255  // looks for the image in macropath
256  TString macroPath(gROOT->GetMacroPath()); // look for the image in here
257  Ssiz_t curIndex(0);
258  TImage *img(0);
259  while(1) {
260  Ssiz_t pathStart = curIndex;
261  curIndex = macroPath.Index(":",curIndex);
262  Ssiz_t pathEnd = (curIndex==-1)?macroPath.Length():curIndex;
263  TString path(macroPath(pathStart,pathEnd-pathStart));
264 
265  gSystem->ExpandPathName(path);
266  const char* fullName = Form("%s/%s", path.Data(), imageName);
267 
268  Bool_t fileFound = ! gSystem->AccessPathName(fullName);
269 
270  if(fileFound) {
271  img = TImage::Open(fullName);
272  break;
273  }
274  if(curIndex==-1) break;
275  curIndex++;
276  }
277  return img;
278  }
const std::string path
Definition: plot_BEN.C:43
def img(path, mouseover="")
Definition: HTMLTools.py:36
TKey* TMVAGlob::FindMethod ( TString  name,
TDirectory *  dir = 0 
)

Definition at line 442 of file tmvaglob.C.

References dir, and getGoodRuns4SAM::tname.

443  {
444  // find the key for a method
445  if (dir==0) dir = gDirectory;
446  TIter mnext(dir->GetListOfKeys());
447  TKey *mkey;
448  TKey *retkey=0;
449  Bool_t loop=kTRUE;
450  while (loop) {
451  mkey = (TKey*)mnext();
452  if (mkey==0) {
453  loop = kFALSE;
454  }
455  else {
456  TString clname = mkey->GetClassName();
457  TClass *cl = gROOT->GetClass(clname);
458  if (cl->InheritsFrom("TDirectory")) {
459  TString mname = mkey->GetName(); // method name
460  TString tname = "Method_"+name; // target name
461  if (mname==tname) { // target found!
462  loop = kFALSE;
463  retkey = mkey;
464  }
465  }
466  }
467  }
468  return retkey;
469  }
const XML_Char * name
Definition: expat.h:151
TDirectory * dir
Definition: macro.C:5
TDirectory* TMVAGlob::GetCorrelationPlotsDir ( TMVAGlob::TypeOfPlot  type,
TDirectory *  dir = 0 
)

Definition at line 648 of file tmvaglob.C.

References om::cout, dir, allTimeWatchdog::endl, and GetInputVariablesDir().

649  {
650  // get the CorrelationPlots directory
651  if (dir==0) dir = GetInputVariablesDir( type, 0 );
652  if (dir==0) return 0;
653  //
654  TDirectory* corrdir = (TDirectory*)dir->Get( "CorrelationPlots" );
655  if (corrdir==0) {
656  cout << "+++ Could not find CorrelationPlots directory 'CorrelationPlots'" << endl;
657  return 0;
658  }
659  return corrdir;
660  }
::xsd::cxx::tree::type type
Definition: Database.h:110
TDirectory * GetInputVariablesDir(TMVAGlob::TypeOfPlot type, TDirectory *dir=0)
Definition: tmvaglob.C:630
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
TDirectory* TMVAGlob::GetInputVariablesDir ( TMVAGlob::TypeOfPlot  type,
TDirectory *  dir = 0 
)

Definition at line 630 of file tmvaglob.C.

References om::cout, dir, allTimeWatchdog::endl, and kNumOfMethods.

Referenced by GetCorrelationPlotsDir().

631  {
632  // get the InputVariables directory
633  const TString directories[TMVAGlob::kNumOfMethods] = { "InputVariables_Id",
634  "InputVariables_Deco",
635  "InputVariables_PCA",
636  "InputVariables_Gauss_Deco" };
637  if (dir==0) dir = gDirectory;
638 
639  // get top dir containing all hists of the variables
640  dir = (TDirectory*)gDirectory->Get( directories[type] );
641  if (dir==0) {
642  cout << "+++ Could not locate input variable directory '" << directories[type] << endl;
643  return 0;
644  }
645  return dir;
646  }
::xsd::cxx::tree::type type
Definition: Database.h:110
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
UInt_t TMVAGlob::GetListOfJobs ( TFile *  file,
TList &  jobdirs 
)

Definition at line 538 of file tmvaglob.C.

References om::cout, allTimeWatchdog::endl, findDuplicateFiles::key, and next().

539  {
540  // get a list of all jobs in all method directories
541  // based on ideas by Peter and Joerg found in macro deviations.C
542  TIter next(file->GetListOfKeys());
543  TKey *key(0);
544  while ((key = (TKey*)next())) {
545 
546  if (TString(key->GetName()).BeginsWith("Method_")) {
547  if (gROOT->GetClass(key->GetClassName())->InheritsFrom("TDirectory")) {
548 
549  TDirectory* mDir = (TDirectory*)key->ReadObj();
550 
551  TIter keyIt(mDir->GetListOfKeys());
552  TKey *jobkey;
553  while ((jobkey = (TKey*)keyIt())) {
554  if (!gROOT->GetClass(jobkey->GetClassName())->InheritsFrom("TDirectory")) continue;
555 
556  TDirectory *jobDir = (TDirectory *)jobkey->ReadObj();
557  cout << "jobdir name " << jobDir->GetName() << endl;
558  jobdirs.Add(jobDir);
559  }
560  }
561  }
562  }
563  return jobdirs.GetSize();
564  }
OStream cout
Definition: OStream.cxx:6
TFile * file
Definition: cellShifts.C:17
void next()
Definition: show_event.C:84
UInt_t TMVAGlob::GetListOfKeys ( TList &  keys,
TString  inherits,
TDirectory *  dir = 0 
)

Definition at line 392 of file tmvaglob.C.

References dir.

393  {
394  // get a list of keys with a given inheritance
395  // the list contains TKey objects
396  if (dir==0) dir = gDirectory;
397  TIter mnext(dir->GetListOfKeys());
398  TKey *mkey;
399  keys.Clear();
400  keys.SetOwner(kFALSE);
401  UInt_t ni=0;
402  while ((mkey = (TKey*)mnext())) {
403  // make sure, that we only look at TDirectory with name Method_<xxx>
404  TClass *cl = gROOT->GetClass(mkey->GetClassName());
405  if (cl->InheritsFrom(inherits)) {
406  keys.Add(mkey);
407  ni++;
408  }
409  }
410  return ni;
411  }
keys
Reco plots.
Definition: caf_analysis.py:46
TDirectory * dir
Definition: macro.C:5
UInt_t TMVAGlob::GetListOfMethods ( TList &  methods,
TDirectory *  dir = 0 
)

Definition at line 513 of file tmvaglob.C.

References om::cout, dir, and allTimeWatchdog::endl.

514  {
515  // get a list of methods
516  // the list contains TKey objects
517  if (dir==0) dir = gDirectory;
518  TIter mnext(dir->GetListOfKeys());
519  TKey *mkey;
520  methods.Clear();
521  methods.SetOwner(kFALSE);
522  UInt_t ni=0;
523  while ((mkey = (TKey*)mnext())) {
524  // make sure, that we only look at TDirectory with name Method_<xxx>
525  TString name = mkey->GetClassName();
526  TClass *cl = gROOT->GetClass(name);
527  if (cl->InheritsFrom("TDirectory")) {
528  if (TString(mkey->GetName()).BeginsWith("Method_")) {
529  methods.Add(mkey);
530  ni++;
531  }
532  }
533  }
534  cout << "--- Found " << ni << " classifier types" << endl;
535  return ni;
536  }
const XML_Char * name
Definition: expat.h:151
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
UInt_t TMVAGlob::GetListOfTitles ( TDirectory *  rfdir,
TList &  titles 
)

Definition at line 566 of file tmvaglob.C.

References om::cout, allTimeWatchdog::endl, and caf_analysis::keys.

Referenced by TMVA::TMVAGlob::GetListOfTitles().

567  {
568  // get a list of titles (i.e TDirectory) given a method dir
569  UInt_t ni=0;
570  if (rfdir==0) return 0;
571  TList *keys = rfdir->GetListOfKeys();
572  if (keys==0) {
573  cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
574  return 0;
575  }
576  //
577  TIter rfnext(rfdir->GetListOfKeys());
578  TKey *rfkey;
579  titles.Clear();
580  titles.SetOwner(kFALSE);
581  while ((rfkey = (TKey*)rfnext())) {
582  // make sure, that we only look at histograms
583  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
584  if (cl->InheritsFrom("TDirectory")) {
585  titles.Add(rfkey);
586  ni++;
587  }
588  }
589  cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
590  return ni;
591  }
keys
Reco plots.
Definition: caf_analysis.py:46
OStream cout
Definition: OStream.cxx:6
UInt_t TMVAGlob::GetListOfTitles ( TString &  methodName,
TList &  titles,
TDirectory *  dir = 0 
)

Definition at line 593 of file tmvaglob.C.

References om::cout, dir, allTimeWatchdog::endl, GetListOfTitles(), and caf_analysis::keys.

594  {
595  // get the list of all titles for a given method
596  // if the input dir is 0, gDirectory is used
597  // returns a list of keys
598  UInt_t ni=0;
599  if (dir==0) dir = gDirectory;
600  TDirectory* rfdir = (TDirectory*)dir->Get( methodName );
601  if (rfdir==0) {
602  cout << "+++ Could not locate directory '" << methodName << endl;
603  return 0;
604  }
605 
606  return GetListOfTitles( rfdir, titles );
607 
608  TList *keys = rfdir->GetListOfKeys();
609  if (keys==0) {
610  cout << "+++ Directory '" << methodName << "' contains no keys" << endl;
611  return 0;
612  }
613  //
614  TIter rfnext(rfdir->GetListOfKeys());
615  TKey *rfkey;
616  titles.Clear();
617  titles.SetOwner(kFALSE);
618  while ((rfkey = (TKey*)rfnext())) {
619  // make sure, that we only look at histograms
620  TClass *cl = gROOT->GetClass(rfkey->GetClassName());
621  if (cl->InheritsFrom("TDirectory")) {
622  titles.Add(rfkey);
623  ni++;
624  }
625  }
626  cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl;
627  return ni;
628  }
keys
Reco plots.
Definition: caf_analysis.py:46
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
UInt_t GetListOfTitles(TString &methodName, TList &titles, TDirectory *dir=0)
Definition: tmvaglob.C:593
void TMVAGlob::GetMethodName ( TString &  name,
TKey *  mkey 
)

Definition at line 352 of file tmvaglob.C.

352  {
353  if (mkey==0) return;
354  name = mkey->GetName();
355  name.ReplaceAll("Method_","");
356  }
const XML_Char * name
Definition: expat.h:151
void TMVAGlob::GetMethodName ( TString &  name,
TDirectory *  mdir 
)

Definition at line 363 of file tmvaglob.C.

363  {
364  if (mdir==0) return;
365  name = mdir->GetName();
366  name.ReplaceAll("Method_","");
367  }
const XML_Char * name
Definition: expat.h:151
void TMVAGlob::GetMethodTitle ( TString &  name,
TKey *  ikey 
)

Definition at line 358 of file tmvaglob.C.

358  {
359  if (ikey==0) return;
360  name = ikey->GetName();
361  }
const XML_Char * name
Definition: expat.h:151
void TMVAGlob::GetMethodTitle ( TString &  name,
TDirectory *  idir 
)

Definition at line 369 of file tmvaglob.C.

369  {
370  if (idir==0) return;
371  name = idir->GetName();
372  }
const XML_Char * name
Definition: expat.h:151
Int_t TMVAGlob::GetNumberOfInputVariables ( TDirectory *  dir)

Definition at line 426 of file tmvaglob.C.

References findDuplicateFiles::key, and next().

427  {
428  TIter next(dir->GetListOfKeys());
429  TKey* key = 0;
430  Int_t noVars = 0;
431 
432  while ((key = (TKey*)next())) {
433  if (key->GetCycle() != 1) continue;
434 
435  // count number of variables (signal is sufficient), exclude target(s)
436  if (TString(key->GetName()).Contains("__Signal") || (TString(key->GetName()).Contains("__Regression") && !(TString(key->GetName()).Contains("__Regression_target")))) noVars++;
437  }
438 
439  return noVars;
440  }
TDirectory * dir
Definition: macro.C:5
void next()
Definition: show_event.C:84
Int_t TMVAGlob::GetNumberOfTargets ( TDirectory *  dir)

Definition at line 413 of file tmvaglob.C.

References findDuplicateFiles::key, and next().

414  {
415  TIter next(dir->GetListOfKeys());
416  TKey* key = 0;
417  Int_t noTrgts = 0;
418 
419  while ((key = (TKey*)next())) {
420  if (key->GetCycle() != 1) continue;
421  if (TString(key->GetName()).Contains("__Regression_target")) noTrgts++;
422  }
423  return noTrgts;
424  }
TDirectory * dir
Definition: macro.C:5
void next()
Definition: show_event.C:84
void TMVAGlob::imgconv ( TCanvas *  c,
const TString &  fname 
)

Definition at line 220 of file tmvaglob.C.

References om::cout, dir, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, and plot_validation_datamc::fname.

221  {
222  // return;
223  if (NULL == c) {
224  cout << "*** Error in TMVAGlob::imgconv: canvas is NULL" << endl;
225  }
226  else {
227  // create directory if not existing
228  TString f = fname;
229  TString dir = f.Remove( f.Last( '/' ), f.Length() - f.Last( '/' ) );
230  gSystem->mkdir( dir );
231 
232  TString pngName = fname + ".png";
233  TString gifName = fname + ".gif";
234  TString epsName = fname + ".eps";
235  c->cd();
236 
237  // create eps (other option: c->Print( epsName ))
238  if (UsePaperStyle) {
239  c->Print(epsName);
240  }
241  else {
242  cout << "--- --------------------------------------------------------------------" << endl;
243  cout << "--- If you want to save the image as eps, gif or png, please comment out " << endl;
244  cout << "--- the corresponding lines (line no. 239-241) in tmvaglob.C" << endl;
245  cout << "--- --------------------------------------------------------------------" << endl;
246  c->Print(epsName);
247  c->Print(pngName);
248  // c->Print(gifName);
249  }
250  }
251  }
OStream cout
Definition: OStream.cxx:6
TDirectory * dir
Definition: macro.C:5
static Bool_t UsePaperStyle
Definition: tmvaglob.C:28
void TMVAGlob::Initialize ( Bool_t  useTMVAStyle = kTRUE)
TKey* TMVAGlob::NextKey ( TIter &  keyIter,
TString  className 
)

Definition at line 374 of file tmvaglob.C.

References findDuplicateFiles::key.

374  {
375  TKey *key=(TKey *)keyIter.Next();
376  TKey *rkey=0;
377  Bool_t loop=(key!=0);
378  //
379  while (loop) {
380  TClass *cl = gROOT->GetClass(key->GetClassName());
381  if (cl->InheritsFrom(className.Data())) {
382  loop = kFALSE;
383  rkey = key;
384  } else {
385  key = (TKey *)keyIter.Next();
386  if (key==0) loop = kFALSE;
387  }
388  }
389  return rkey;
390  }
void TMVAGlob::NormalizeHist ( TH1 *  h)

Definition at line 325 of file tmvaglob.C.

References dx.

326  {
327  if (h==0) return;
328  if (h->GetSumw2N() == 0) h->Sumw2();
329  if(h->GetSumOfWeights()!=0) {
330  Float_t dx = (h->GetXaxis()->GetXmax() - h->GetXaxis()->GetXmin())/h->GetNbinsX();
331  h->Scale( 1.0/h->GetSumOfWeights()/dx );
332  }
333  }
double dx[NP][NC]
void TMVAGlob::NormalizeHists ( TH1 *  sig,
TH1 *  bkg = 0 
)

Definition at line 334 of file tmvaglob.C.

References PandAna.Demos.pi0_spectra::bkg, and dx.

335  {
336  if (sig->GetSumw2N() == 0) sig->Sumw2();
337  if (bkg && bkg->GetSumw2N() == 0) bkg->Sumw2();
338 
339  if(sig->GetSumOfWeights()!=0) {
340  Float_t dx = (sig->GetXaxis()->GetXmax() - sig->GetXaxis()->GetXmin())/sig->GetNbinsX();
341  sig->Scale( 1.0/sig->GetSumOfWeights()/dx );
342  }
343  if (bkg != 0 && bkg->GetSumOfWeights()!=0) {
344  Float_t dx = (bkg->GetXaxis()->GetXmax() - bkg->GetXaxis()->GetXmin())/bkg->GetNbinsX();
345  bkg->Scale( 1.0/bkg->GetSumOfWeights()/dx );
346  }
347  }
double dx[NP][NC]
TFile* TMVAGlob::OpenFile ( const TString &  fin)

Definition at line 200 of file tmvaglob.C.

References om::cout, allTimeWatchdog::endl, and file.

201  {
202  TFile* file = gDirectory->GetFile();
203  if (file==0 || fin != file->GetName()) {
204  if (file != 0) {
205  gROOT->cd();
206  file->Close();
207  }
208  cout << "--- Opening root file " << fin << " in read mode" << endl;
209  file = TFile::Open( fin, "READ" );
210  }
211  else {
212  file = gDirectory->GetFile();
213  }
214 
215  file->cd();
216  return file;
217  }
TString fin
Definition: Style.C:24
OStream cout
Definition: OStream.cxx:6
TFile * file
Definition: cellShifts.C:17
void TMVAGlob::plot_logo ( Float_t  v_scale = 1.0,
Float_t  skew = 1.0 
)

Definition at line 280 of file tmvaglob.C.

References om::cout, d, allTimeWatchdog::endl, findImage(), HTMLTools::img(), plot_validation_datamc::p1, r(), and cet::rpad().

281  {
282 
283  TImage *img = findImage("tmva_logo.gif");
284  if (!img) {
285  cout << "+++ Could not open image tmva_logo.gif" << endl;
286  return;
287  }
288 
289  img->SetConstRatio(kFALSE);
290  UInt_t h_ = img->GetHeight();
291  UInt_t w_ = img->GetWidth();
292 
293  Float_t r = w_/h_;
294  gPad->Update();
295  Float_t rpad = Double_t(gPad->VtoAbsPixel(0) - gPad->VtoAbsPixel(1))/(gPad->UtoAbsPixel(1) - gPad->UtoAbsPixel(0));
296  r *= rpad;
297 
298  Float_t d = 0.055;
299  // absolute coordinates
300  Float_t x1R = 1 - gStyle->GetPadRightMargin();
301  Float_t y1B = 1 - gStyle->GetPadTopMargin()+.01; // we like the logo to sit a bit above the histo
302 
303  Float_t x1L = x1R - d*r/skew;
304  Float_t y1T = y1B + d*v_scale*skew;
305  if (y1T>0.99) y1T = 0.99;
306 
307  TPad *p1 = new TPad("imgpad", "imgpad", x1L, y1B, x1R, y1T );
308  p1->SetRightMargin(0);
309  p1->SetBottomMargin(0);
310  p1->SetLeftMargin(0);
311  p1->SetTopMargin(0);
312  p1->Draw();
313 
314  Int_t xSizeInPixel = p1->UtoAbsPixel(1) - p1->UtoAbsPixel(0);
315  Int_t ySizeInPixel = p1->VtoAbsPixel(0) - p1->VtoAbsPixel(1);
316  if (xSizeInPixel<=25 || ySizeInPixel<=25) {
317  delete p1;
318  return; // ROOT doesn't draw smaller than this
319  }
320 
321  p1->cd();
322  img->Draw();
323  }
TImage * findImage(const char *imageName)
Definition: tmvaglob.C:253
std::string rpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Float_t d
Definition: plot.C:236
def img(path, mouseover="")
Definition: HTMLTools.py:36
OStream cout
Definition: OStream.cxx:6
TRandom3 r(0)
void TMVAGlob::SetFrameStyle ( TH1 *  frame,
Float_t  scale = 1.0 
)

Definition at line 88 of file tmvaglob.C.

References scale.

89  {
90  frame->SetLabelOffset( 0.012, "X" );// label offset on x axis
91  frame->SetLabelOffset( 0.012, "Y" );// label offset on x axis
92  frame->GetXaxis()->SetTitleOffset( 1.25 );
93  frame->GetYaxis()->SetTitleOffset( 1.22 );
94  frame->GetXaxis()->SetTitleSize( 0.045*scale );
95  frame->GetYaxis()->SetTitleSize( 0.045*scale );
96  Float_t labelSize = 0.04*scale;
97  frame->GetXaxis()->SetLabelSize( labelSize );
98  frame->GetYaxis()->SetLabelSize( labelSize );
99 
100  // global style settings
101  gPad->SetTicks();
102  gPad->SetLeftMargin ( 0.108*scale );
103  gPad->SetRightMargin ( 0.050*scale );
104  gPad->SetBottomMargin( 0.120*scale );
105  }
Double_t scale
Definition: plot.C:25
void TMVAGlob::SetSignalAndBackgroundStyle ( TH1 *  sig,
TH1 *  bkg,
TH1 *  all = 0 
)

Definition at line 48 of file tmvaglob.C.

References c_BackgroundFill, c_BackgroundLine, c_SignalFill, and c_SignalLine.

49  {
50  //signal
51  // const Int_t FillColor__S = 38 + 150; // change of Color Scheme in ROOT-5.16.
52  // convince yourself with gROOT->GetListOfColors()->Print()
53  Int_t FillColor__S = c_SignalFill;
54  Int_t FillStyle__S = 1001;
55  Int_t LineColor__S = c_SignalLine;
56  Int_t LineWidth__S = 2;
57 
58  // background
59  //Int_t icolor = UsePaperStyle ? 2 + 100 : 2;
60  Int_t FillColor__B = c_BackgroundFill;
61  Int_t FillStyle__B = 3554;
62  Int_t LineColor__B = c_BackgroundLine;
63  Int_t LineWidth__B = 2;
64 
65  if (sig != NULL) {
66  sig->SetLineColor( LineColor__S );
67  sig->SetLineWidth( LineWidth__S );
68  sig->SetFillStyle( FillStyle__S );
69  sig->SetFillColor( FillColor__S );
70  }
71 
72  if (bkg != NULL) {
73  bkg->SetLineColor( LineColor__B );
74  bkg->SetLineWidth( LineWidth__B );
75  bkg->SetFillStyle( FillStyle__B );
76  bkg->SetFillColor( FillColor__B );
77  }
78 
79  if (all != NULL) {
80  all->SetLineColor( LineColor__S );
81  all->SetLineWidth( LineWidth__S );
82  all->SetFillStyle( FillStyle__S );
83  all->SetFillColor( FillColor__S );
84  }
85  }
static Int_t c_SignalLine
Definition: tmvaglob.C:41
static Int_t c_BackgroundLine
Definition: tmvaglob.C:43
static Int_t c_SignalFill
Definition: tmvaglob.C:42
static Int_t c_BackgroundFill
Definition: tmvaglob.C:44
void TMVAGlob::SetTMVAStyle ( )

Definition at line 107 of file tmvaglob.C.

Referenced by TMVA::TMVAGlob::Initialize().

107  {
108 
109  TStyle *TMVAStyle = gROOT->GetStyle("TMVA");
110  if(TMVAStyle!=0) {
111  gROOT->SetStyle("TMVA");
112  return;
113  }
114 
115  TMVAStyle = new TStyle(*gROOT->GetStyle("Plain")); // our style is based on Plain
116  TMVAStyle->SetName("TMVA");
117  TMVAStyle->SetTitle("TMVA style based on \"Plain\" with modifications defined in tmvaglob.C");
118  gROOT->GetListOfStyles()->Add(TMVAStyle);
119  gROOT->SetStyle("TMVA");
120 
121  TMVAStyle->SetLineStyleString( 5, "[52 12]" );
122  TMVAStyle->SetLineStyleString( 6, "[22 12]" );
123  TMVAStyle->SetLineStyleString( 7, "[22 10 7 10]" );
124 
125  // the pretty color palette of old
126  TMVAStyle->SetPalette((UsePaperStyle ? 18 : 1),0);
127 
128  // use plain black on white colors
129  TMVAStyle->SetFrameBorderMode(0);
130  TMVAStyle->SetCanvasBorderMode(0);
131  TMVAStyle->SetPadBorderMode(0);
132  TMVAStyle->SetPadColor(0);
133  TMVAStyle->SetFillStyle(0);
134 
135  TMVAStyle->SetLegendBorderSize(0);
136 
137  // title properties
138  // TMVAStyle->SetTitleW(.4);
139  // TMVAStyle->SetTitleH(.10);
140  // MVAStyle->SetTitleX(.5);
141  // TMVAStyle->SetTitleY(.9);
142  TMVAStyle->SetTitleFillColor( c_TitleBox );
143  if (!UsePaperStyle) {
144  TMVAStyle->SetFrameFillColor( c_FrameFill );
145  TMVAStyle->SetCanvasColor( c_Canvas );
146  }
147 
148  // set the paper & margin sizes
149  TMVAStyle->SetPaperSize(20,26);
150  TMVAStyle->SetPadTopMargin(0.10);
151  TMVAStyle->SetPadRightMargin(0.05);
152  TMVAStyle->SetPadBottomMargin(0.11);
153  TMVAStyle->SetPadLeftMargin(0.12);
154 
155  // use bold lines and markers
156  TMVAStyle->SetMarkerStyle(21);
157  TMVAStyle->SetMarkerSize(0.3);
158  TMVAStyle->SetHistLineWidth(2);
159  TMVAStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
160 
161  // do not display any of the standard histogram decorations
162  TMVAStyle->SetOptTitle(1);
163  TMVAStyle->SetTitleH(0.052);
164 
165  TMVAStyle->SetOptStat(0);
166  TMVAStyle->SetOptFit(0);
167 
168  // put tick marks on top and RHS of plots
169  TMVAStyle->SetPadTickX(1);
170  TMVAStyle->SetPadTickY(1);
171 
172  }
static Int_t c_FrameFill
Definition: tmvaglob.C:39
static Int_t c_Canvas
Definition: tmvaglob.C:38
static Int_t c_TitleBox
Definition: tmvaglob.C:40
static Bool_t UsePaperStyle
Definition: tmvaglob.C:28

Variable Documentation

Int_t TMVAGlob::c_BackgroundFill = TColor::GetColor( "#ff0000" )
static

Definition at line 44 of file tmvaglob.C.

Referenced by TMVA::TMVAGlob::SetSignalAndBackgroundStyle().

Int_t TMVAGlob::c_BackgroundLine = TColor::GetColor( "#ff0000" )
static

Definition at line 43 of file tmvaglob.C.

Referenced by TMVA::TMVAGlob::SetSignalAndBackgroundStyle().

Int_t TMVAGlob::c_Canvas = TColor::GetColor( "#e9e6da" )
static

Definition at line 38 of file tmvaglob.C.

Int_t TMVAGlob::c_FrameFill = TColor::GetColor( "#fffffd" )
static

Definition at line 39 of file tmvaglob.C.

Int_t TMVAGlob::c_NovelBlue = TColor::GetColor( "#2244a5" )
static

Definition at line 45 of file tmvaglob.C.

Int_t TMVAGlob::c_SignalFill = TColor::GetColor( "#7d99d1" )
static

Definition at line 42 of file tmvaglob.C.

Referenced by TMVA::TMVAGlob::SetSignalAndBackgroundStyle().

Int_t TMVAGlob::c_SignalLine = TColor::GetColor( "#0000ee" )
static

Definition at line 41 of file tmvaglob.C.

Referenced by TMVA::TMVAGlob::SetSignalAndBackgroundStyle().

Int_t TMVAGlob::c_TitleBox = TColor::GetColor( "#dae1e6" )
static

Definition at line 40 of file tmvaglob.C.

Bool_t TMVAGlob::UsePaperStyle = 0
static

Definition at line 28 of file tmvaglob.C.