ROOT  6.06/09
Reference Guide
ROCCalc.cxx
Go to the documentation of this file.
1 #include <algorithm>
2 #include <cstdlib>
3 #include <errno.h>
4 
5 #include "TObjString.h"
6 #include "TMath.h"
7 #include "TString.h"
8 #include "TTree.h"
9 #include "TLeaf.h"
10 #include "TH1.h"
11 #include "TH2.h"
12 #include "TList.h"
13 #include "TSpline.h"
14 #include "TVector.h"
15 #include "TMatrixD.h"
16 #include "TMatrixDSymEigen.h"
17 #include "TVectorD.h"
18 #include "TTreeFormula.h"
19 #include "TXMLEngine.h"
20 #include "TROOT.h"
21 #include "TMatrixDSymEigen.h"
22 #include "TColor.h"
23 #include "TMVA/Config.h"
24 
25 
26 #ifndef ROOT_TMVA_Tools
27 #include "TMVA/Tools.h"
28 #endif
29 #ifndef ROOT_TMVA_ROCCalc
30 #include "TMVA/ROCCalc.h"
31 #endif
32 #ifndef ROOT_TMVA_Config
33 #include "TMVA/Config.h"
34 #endif
35 #ifndef ROOT_TMVA_Event
36 #include "TMVA/Event.h"
37 #endif
38 #ifndef ROOT_TMVA_Version
39 #include "TMVA/Version.h"
40 #endif
41 #ifndef ROOT_TMVA_PDF
42 #include "TMVA/PDF.h"
43 #endif
44 #ifndef ROOT_TMVA_MsgLogger
45 #include "TMVA/MsgLogger.h"
46 #endif
47 
48 #include "TMVA/PDF.h"
49 #include "TMVA/TSpline1.h"
50 #include "TMVA/TSpline2.h"
51 
52 using namespace std;
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 
57  fMaxIter(100),
58  fAbsTol(0.0),
59  fmvaS(0),
60  fmvaB(0),
61  fmvaSpdf(0),
62  fmvaBpdf(0),
63  fSplS(0),
64  fSplB(0),
65  fSplmvaCumS(0),
66  fSplmvaCumB(0),
67  fSpleffBvsS(0),
68  fnStot(0),
69  fnBtot(0),
70  fSignificance(0),
71  fPurity(0),
72  fLogger ( new TMVA::MsgLogger("ROCCalc") )
73 {
75  fNbins = 100;
76  // fmvaS = (TH1*) mvaS->Clone("MVA Signal"); fmvaS->SetTitle("MVA Signal");
77  // fmvaB = (TH1*) mvaB->Clone("MVA Backgr"); fmvaB->SetTitle("MVA Backgr");
78  fmvaS = mvaS; fmvaS->SetTitle("MVA Signal");
79  fmvaB = mvaB; fmvaB->SetTitle("MVA Backgr");
80  fXmax = fmvaS->GetXaxis()->GetXmax();
81  fXmin = fmvaS->GetXaxis()->GetXmin();
82 
83  if (TMath::Abs(fXmax-fmvaB->GetXaxis()->GetXmax()) > 0.000001 ||
84  TMath::Abs(fXmin-fmvaB->GetXaxis()->GetXmin()) > 0.000001 ||
85  fmvaB->GetNbinsX() != fmvaS->GetNbinsX()) {
86  Log() << kFATAL << " Cannot cal ROC curve etc, as in put mvaS and mvaB have differen #nbins or range "<<Endl;
87  }
88  if (!strcmp(fmvaS->GetXaxis()->GetTitle(),"")) fmvaS->SetXTitle("MVA-value");
89  if (!strcmp(fmvaB->GetXaxis()->GetTitle(),"")) fmvaB->SetXTitle("MVA-value");
90  if (!strcmp(fmvaS->GetYaxis()->GetTitle(),"")) fmvaS->SetYTitle("#entries");
91  if (!strcmp(fmvaB->GetYaxis()->GetTitle(),"")) fmvaB->SetYTitle("#entries");
93  fmvaSpdf = mvaS->RebinX(mvaS->GetNbinsX()/100,"MVA Signal PDF");
94  fmvaBpdf = mvaB->RebinX(mvaB->GetNbinsX()/100,"MVA Backgr PDF");
95  fmvaSpdf->SetTitle("MVA Signal PDF");
96  fmvaBpdf->SetTitle("MVA Backgr PDF");
102 
103  fCutOrientation = (fmvaS->GetMean() > fmvaB->GetMean()) ? +1 : -1;
104 
105  fNevtS = 0;
106 
107 }
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// Int_t c_Canvas = TColor::GetColor( "#f0f0f0" );
111 /// Int_t c_FrameFill = TColor::GetColor( "#fffffd" );
112 /// Int_t c_TitleBox = TColor::GetColor( "#5D6B7D" );
113 /// Int_t c_TitleBorder = TColor::GetColor( "#7D8B9D" );
114 /// Int_t c_TitleText = TColor::GetColor( "#FFFFFF" );
115 
117  Int_t c_SignalLine = TColor::GetColor( "#0000ee" );
118  Int_t c_SignalFill = TColor::GetColor( "#7d99d1" );
119  Int_t c_BackgroundLine = TColor::GetColor( "#ff0000" );
120  Int_t c_BackgroundFill = TColor::GetColor( "#ff0000" );
121  // Int_t c_NovelBlue = TColor::GetColor( "#2244a5" );
122 
123  //signal
124  // const Int_t FillColor__S = 38 + 150; // change of Color Scheme in ROOT-5.16.
125  // convince yourself with gROOT->GetListOfColors()->Print()
126  Int_t FillColor__S = c_SignalFill;
127  Int_t FillStyle__S = 1001;
128  Int_t LineColor__S = c_SignalLine;
129  Int_t LineWidth__S = 2;
130 
131  // background
132  //Int_t icolor = gConfig().fVariablePlotting.fUsePaperStyle ? 2 + 100 : 2;
133  Int_t FillColor__B = c_BackgroundFill;
134  Int_t FillStyle__B = 3554;
135  Int_t LineColor__B = c_BackgroundLine;
136  Int_t LineWidth__B = 2;
137 
138  if (sig != NULL) {
139  sig->SetLineColor( LineColor__S );
140  sig->SetLineWidth( LineWidth__S );
141  sig->SetFillStyle( FillStyle__S );
142  sig->SetFillColor( FillColor__S );
143  }
144 
145  if (bkg != NULL) {
146  bkg->SetLineColor( LineColor__B );
147  bkg->SetLineWidth( LineWidth__B );
148  bkg->SetFillStyle( FillStyle__B );
149  bkg->SetFillColor( FillColor__B );
150  }
151 
152  if (any != NULL) {
153  any->SetLineColor( LineColor__S );
154  any->SetLineWidth( LineWidth__S );
155  any->SetFillStyle( FillStyle__S );
156  any->SetFillColor( FillColor__S );
157  }
158 }
159 
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// destructor
163 
165  // delete Splines and all histograms that were created only for internal use
166  if (fSplS) { delete fSplS; fSplS = 0; }
167  if (fSplB) { delete fSplB; fSplB = 0; }
168  if (fSpleffBvsS) { delete fSpleffBvsS; fSpleffBvsS = 0; }
169  if (fSplmvaCumS) { delete fSplmvaCumS; fSplmvaCumS = 0; }
170  if (fSplmvaCumB) { delete fSplmvaCumB; fSplmvaCumB = 0; }
171  if (fmvaScumul) { delete fmvaScumul; }
172  if (fmvaBcumul) { delete fmvaBcumul; }
173 
174  delete fLogger;
175 }
176 
177 ////////////////////////////////////////////////////////////////////////////////
178 /// get the ROC curve
179 
181  // first get the cumulative distributions of the mva distribution
182  // --> efficiencies vs cut value
183  fNevtS = fmvaS->GetSumOfWeights(); // needed to get the error on the eff.. will only be correct if the histogram is not scaled to "integral == 1" Yet;
184  if (fNevtS < 2) {
185  Log() << kWARNING << "I guess the mva distributions fed into ROCCalc were already normalized, therefore the calculated error on the efficiency will be incorrect !! " << Endl;
186  fNevtS = 0; // reset to zero --> no error will be calculated on the efficiencies
187  }
188  fmvaScumul = gTools().GetCumulativeDist(fmvaS);
189  fmvaBcumul = gTools().GetCumulativeDist(fmvaB);
190  fmvaScumul->Scale( 1.0/TMath::Max(std::numeric_limits<double>::epsilon(),fmvaScumul->GetMaximum()) );
191  fmvaBcumul->Scale( 1.0/TMath::Max(std::numeric_limits<double>::epsilon(),fmvaBcumul->GetMaximum()) );
192  fmvaScumul->SetMinimum(0);
193  fmvaBcumul->SetMinimum(0);
194  // fmvaScumul->Draw("hist");
195  // fmvaBcumul->Draw("histsame");
196 
197  // background efficiency versus signal efficiency
198  TH1D* effBvsS = new TH1D("effBvsS", "ROC-Curve", fNbins, 0, 1 );
199  effBvsS->SetXTitle( "Signal eff" );
200  effBvsS->SetYTitle( "Backgr eff" );
201 
202  // background rejection (=1-eff.) versus signal efficiency
203  TH1D* rejBvsS = new TH1D( "rejBvsS", "ROC-Curve", fNbins, 0, 1 );
204  rejBvsS->SetXTitle( "Signal eff" );
205  rejBvsS->SetYTitle( "Backgr rejection (1-eff)" );
206 
207  // inverse background eff (1/eff.) versus signal efficiency
208  TH1D* inveffBvsS = new TH1D("invBeffvsSeff", "ROC-Curve" , fNbins, 0, 1 );
209  inveffBvsS->SetXTitle( "Signal eff" );
210  inveffBvsS->SetYTitle( "Inverse backgr. eff (1/eff)" );
211 
212  // use root finder
213  // spline background efficiency plot
214  // note that there is a bin shift when going from a TH1D object to a TGraph :-(
215  if (fUseSplines) {
216  fSplmvaCumS = new TSpline1( "spline2_signal", new TGraph( fmvaScumul ) );
217  fSplmvaCumB = new TSpline1( "spline2_background", new TGraph( fmvaBcumul ) );
218  // verify spline sanity
219  gTools().CheckSplines( fmvaScumul, fSplmvaCumS );
220  gTools().CheckSplines( fmvaBcumul, fSplmvaCumB );
221  }
222 
223  Double_t effB = 0;
224  for (UInt_t bini=1; bini<=fNbins; bini++) {
225 
226  // find cut value corresponding to a given signal efficiency
227  Double_t effS = effBvsS->GetBinCenter( bini );
228  Double_t cut = Root( effS );
229 
230  // retrieve background efficiency for given cut
231  if (fUseSplines) effB = fSplmvaCumB->Eval( cut );
232  else effB = fmvaBcumul->GetBinContent( fmvaBcumul->FindBin( cut ) );
233 
234  // and fill histograms
235  effBvsS->SetBinContent( bini, effB );
236  rejBvsS->SetBinContent( bini, 1.0-effB );
238  inveffBvsS->SetBinContent( bini, 1.0/effB );
239  }
240 
241  // create splines for histogram
242  fSpleffBvsS = new TSpline1( "effBvsS", new TGraph( effBvsS ) );
243 
244  // search for overlap point where, when cutting on it,
245  // one would obtain: eff_S = rej_B = 1 - eff_B
246 
247  Double_t effS = 0., rejB = 0., effS_ = 0., rejB_ = 0.;
248  Int_t nbins = 5000;
249  for (Int_t bini=1; bini<=nbins; bini++) {
250 
251  // get corresponding signal and background efficiencies
252  effS = (bini - 0.5)/Float_t(nbins);
253  rejB = 1.0 - fSpleffBvsS->Eval( effS );
254 
255  // find signal efficiency that corresponds to required background efficiency
256  if ((effS - rejB)*(effS_ - rejB_) < 0) break;
257  effS_ = effS;
258  rejB_ = rejB;
259  }
260  // find cut that corresponds to signal efficiency and update signal-like criterion
261  fSignalCut = Root( 0.5*(effS + effS_) );
262 
263  return rejBvsS;
264 }
265 
266 ////////////////////////////////////////////////////////////////////////////////
267 /// code to compute the area under the ROC ( rej-vs-eff ) curve
268 
270  Double_t effS = 0, effB = 0;
271  Int_t nbins = 1000;
272  if (fSpleffBvsS == 0) this->GetROC(); // that will make the ROC calculation if not done yet
273 
274  // compute area of rej-vs-eff plot
275  Double_t integral = 0;
276  for (Int_t bini=1; bini<=nbins; bini++) {
277 
278  // get corresponding signal and background efficiencies
279  effS = (bini - 0.5)/Float_t(nbins);
280  effB = fSpleffBvsS->Eval( effS );
281  integral += (1.0 - effB);
282  }
283  integral /= nbins;
284 
285  return integral;
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// get the signal efficiency for a particular backgroud efficiency
290 /// that will be the value of the efficiency retured (does not affect
291 /// the efficiency-vs-bkg plot which is done anyway.
292 
294  // find precise efficiency value
295  Double_t effS=0., effB, effSOld=1., effBOld=0.;
296  Int_t nbins = 1000;
297  if (fSpleffBvsS == 0) this->GetROC(); // that will make the ROC calculation if not done yet
298 
299  Float_t step=1./nbins; // stepsize in efficiency binning
300  for (Int_t bini=1; bini<=nbins; bini++) {
301  // get corresponding signal and background efficiencies
302  effS = (bini - 0.5)*step; // efficiency goes from 0-to-1 in nbins steps of 1/nbins (take middle of the bin)
303  effB = fSpleffBvsS->Eval( effS );
304 
305  // find signal efficiency that corresponds to required background efficiency
306  if ((effB - effBref)*(effBOld - effBref) <= 0) break;
307  effSOld = effS;
308  effBOld = effB;
309  }
310 
311  // take mean between bin above and bin below
312  effS = 0.5*(effS + effSOld);
313 
314 
315  if (fNevtS > 0) effSerr = TMath::Sqrt( effS*(1.0 - effS)/fNevtS );
316  else effSerr = 0;
317 
318  return effS;
319 }
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 /// returns efficiency as function of cut
323 
325 {
326  Double_t retVal=0;
327 
328  // retrieve the class object
329  if (fUseSplines) retVal = fSplmvaCumS->Eval( theCut );
330  else retVal = fmvaScumul->GetBinContent( fmvaScumul->FindBin( theCut ) );
331 
332  // caution: here we take some "forbidden" action to hide a problem:
333  // in some cases, in particular for likelihood, the binned efficiency distributions
334  // do not equal 1, at xmin, and 0 at xmax; of course, in principle we have the
335  // unbinned information available in the trees, but the unbinned minimization is
336  // too slow, and we don't need to do a precision measurement here. Hence, we force
337  // this property.
338  Double_t eps = 1.0e-5;
339  if (theCut-fXmin < eps) retVal = (fCutOrientation > 0) ? 1.0 : 0.0;
340  else if (fXmax-theCut < eps) retVal = (fCutOrientation > 0) ? 0.0 : 1.0;
341 
342 
343  return retVal;
344 }
345 
346 ////////////////////////////////////////////////////////////////////////////////
347 /// Root finding using Brents algorithm; taken from CERNLIB function RZERO
348 
350 {
351  Double_t a = fXmin, b = fXmax;
352  Double_t fa = GetEffForRoot( a ) - refValue;
353  Double_t fb = GetEffForRoot( b ) - refValue;
354  if (fb*fa > 0) {
355  Log() << kWARNING << "<ROCCalc::Root> initial interval w/o root: "
356  << "(a=" << a << ", b=" << b << "),"
357  << " (Eff_a=" << GetEffForRoot( a )
358  << ", Eff_b=" << GetEffForRoot( b ) << "), "
359  << "(fa=" << fa << ", fb=" << fb << "), "
360  << "refValue = " << refValue << Endl;
361  return 1;
362  }
363 
364  Bool_t ac_equal(kFALSE);
365  Double_t fc = fb;
366  Double_t c = 0, d = 0, e = 0;
367  for (Int_t iter= 0; iter <= fMaxIter; iter++) {
368  if ((fb < 0 && fc < 0) || (fb > 0 && fc > 0)) {
369 
370  // Rename a,b,c and adjust bounding interval d
371  ac_equal = kTRUE;
372  c = a; fc = fa;
373  d = b - a; e = b - a;
374  }
375 
376  if (TMath::Abs(fc) < TMath::Abs(fb)) {
377  ac_equal = kTRUE;
378  a = b; b = c; c = a;
379  fa = fb; fb = fc; fc = fa;
380  }
381 
382  Double_t tol = 0.5 * 2.2204460492503131e-16 * TMath::Abs(b);
383  Double_t m = 0.5 * (c - b);
384  if (fb == 0 || TMath::Abs(m) <= tol || TMath::Abs(fb) < fAbsTol) return b;
385 
386  // Bounds decreasing too slowly: use bisection
387  if (TMath::Abs (e) < tol || TMath::Abs (fa) <= TMath::Abs (fb)) { d = m; e = m; }
388  else {
389  // Attempt inverse cubic interpolation
390  Double_t p, q, r;
391  Double_t s = fb / fa;
392 
393  if (ac_equal) { p = 2 * m * s; q = 1 - s; }
394  else {
395  q = fa / fc; r = fb / fc;
396  p = s * (2 * m * q * (q - r) - (b - a) * (r - 1));
397  q = (q - 1) * (r - 1) * (s - 1);
398  }
399  // Check whether we are in bounds
400  if (p > 0) q = -q;
401  else p = -p;
402 
403  Double_t min1 = 3 * m * q - TMath::Abs (tol * q);
404  Double_t min2 = TMath::Abs (e * q);
405  if (2 * p < (min1 < min2 ? min1 : min2)) {
406  // Accept the interpolation
407  e = d; d = p / q;
408  }
409  else { d = m; e = m; } // Interpolation failed: use bisection.
410  }
411  // Move last best guess to a
412  a = b; fa = fb;
413  // Evaluate new trial root
414  if (TMath::Abs(d) > tol) b += d;
415  else b += (m > 0 ? +tol : -tol);
416 
417  fb = GetEffForRoot( b ) - refValue;
418 
419  }
420 
421  // Return our best guess if we run out of iterations
422  Log() << kWARNING << "<ROCCalc::Root> maximum iterations (" << fMaxIter
423  << ") reached before convergence" << Endl;
424 
425  return b;
426 }
427 
428 ////////////////////////////////////////////////////////////////////////////////
429 
431 {
432  if (fnStot!=nStot || fnBtot!=nBtot || !fSignificance) {
433  GetSignificance(nStot, nBtot);
434  fnStot=nStot;
435  fnBtot=nBtot;
436  }
437  return fPurity;
438 }
439 ////////////////////////////////////////////////////////////////////////////////
440 
442 {
443  if (fnStot==nStot && fnBtot==nBtot && !fSignificance) return fSignificance;
444  fnStot=nStot; fnBtot=nBtot;
445 
446  fSignificance = (TH1*) fmvaScumul->Clone("Significance"); fSignificance->SetTitle("Significance");
447  fSignificance->Reset(); fSignificance->SetFillStyle(0);
448  fSignificance->SetXTitle("mva cut value");
449  fSignificance->SetYTitle("Stat. significance S/Sqrt(S+B)");
450  fSignificance->SetLineColor(2);
451  fSignificance->SetLineWidth(5);
452 
453  fPurity = (TH1*) fmvaScumul->Clone("Purity"); fPurity->SetTitle("Purity");
454  fPurity->Reset(); fPurity->SetFillStyle(0);
455  fPurity->SetXTitle("mva cut value");
456  fPurity->SetYTitle("Purity: S/(S+B)");
457  fPurity->SetLineColor(3);
458  fPurity->SetLineWidth(5);
459 
460  Double_t maxSig=0;
461  for (Int_t i=1; i<=fSignificance->GetNbinsX(); i++) {
462  Double_t S = fmvaScumul->GetBinContent( i ) * nStot;
463  Double_t B = fmvaBcumul->GetBinContent( i ) * nBtot;
464  Double_t purity;
465  Double_t sig;
466  if (S+B > 0){
467  purity = S/(S+B);
468  sig = S/TMath::Sqrt(S+B);
469  if (sig > maxSig) {
470  maxSig = sig;
471  }
472  } else {
473  purity=0;
474  sig=0;
475  }
476  cout << "S="<<S<<" B="<<B<< " purity="<<purity<< endl;
477  fPurity->SetBinContent( i, purity );
478  fSignificance->SetBinContent( i, sig );
479  }
480 
481  /*
482  TLatex* line1;
483  TLatex* line2;
484  TLatex tl;
485  tl.SetNDC();
486  tl.SetTextSize( 0.033 );
487  Int_t maxbin = fSignificance->GetMaximumBin();
488  line1 = tl.DrawLatex( 0.15, 0.23, Form("For %1.0f signal and %1.0f background", nStot, nBtot));
489  tl.DrawLatex( 0.15, 0.19, "events the maximum S/Sqrt(S+B) is");
490 
491  line2 = tl.DrawLatex( 0.15, 0.15, Form("%4.2f when cutting at %5.2f",
492  maxSig,
493  fSignificance->GetXaxis()->GetBinCenter(maxbin)) );
494  */
495  return fSignificance;
496 
497 }
498 
499 
500 
501 
502 
503 
504 
505 
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition: TH1.cxx:6174
static double B[]
MsgLogger & Log() const
message logger
Definition: ROCCalc.h:71
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:162
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
float Float_t
Definition: RtypesCore.h:53
TH1 * fmvaSpdf
Definition: ROCCalc.h:56
ROCCalc(TH1 *mvaS, TH1 *mvaB)
Definition: ROCCalc.cxx:56
static Int_t c_SignalFill
Definition: tmvaglob.h:50
TH1 * fmvaBpdf
Definition: ROCCalc.h:56
UInt_t fNbins
Definition: ROCCalc.h:52
int Int_t
Definition: RtypesCore.h:41
virtual void SetYTitle(const char *title)
Definition: TH1.h:409
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
int nbins[3]
virtual Int_t GetNbinsX() const
Definition: TH1.h:296
STL namespace.
TH1 * fmvaS
Definition: ROCCalc.h:55
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
THist< 1, double > TH1D
Definition: THist.h:314
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2565
TH1D * GetROC()
get the ROC curve
Definition: ROCCalc.cxx:180
static struct mg_connection * fc(struct mg_context *ctx)
Definition: civetweb.c:839
Tools & gTools()
Definition: Tools.cxx:79
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:203
TH1 * fmvaB
Definition: ROCCalc.h:55
Double_t GetEffSForEffBof(Double_t effBref, Double_t &effSerr)
get the signal efficiency for a particular backgroud efficiency that will be the value of the efficie...
Definition: ROCCalc.cxx:293
Double_t Root(Double_t)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
Definition: ROCCalc.cxx:349
Bool_t fUseSplines
Definition: ROCCalc.h:53
Double_t GetEffForRoot(Double_t theCut)
returns efficiency as function of cut
Definition: ROCCalc.cxx:324
Bool_t CheckSplines(const TH1 *, const TSpline *)
Definition: Tools.cxx:487
std::map< std::string, std::string >::const_iterator iter
Definition: TAlienJob.cxx:54
Float_t fXmin
Definition: ROCCalc.h:57
Double_t GetXmin() const
Definition: TAxis.h:137
TH1 * GetPurity(Int_t nStot, Int_t nBtot)
Definition: ROCCalc.cxx:430
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
virtual Double_t GetBinCenter(Int_t bin) const
return bin center for 1D historam Better to use h1.GetXaxis().GetBinCenter(bin)
Definition: TH1.cxx:8470
const double tol
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
Definition: TH1.cxx:7014
ROOT::R::TRInterface & r
Definition: Object.C:4
Float_t fXmax
Definition: ROCCalc.h:57
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Definition: TH1.cxx:8543
TH1 * GetSignificance(Int_t nStot, Int_t nBtot)
Definition: ROCCalc.cxx:441
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition: TH1.cxx:7354
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb"...
Definition: TColor.cxx:1666
TAxis * GetYaxis()
Definition: TH1.h:320
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:133
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:613
TH1 * GetCumulativeDist(TH1 *h)
Definition: Tools.cxx:1759
REAL epsilon
Definition: triangle.c:617
const char * Root
Definition: TXMLSetup.cxx:47
static Int_t c_SignalLine
Definition: tmvaglob.h:49
virtual TH1 * RebinX(Int_t ngroup=2, const char *newname="")
Definition: TH1.h:347
double Double_t
Definition: RtypesCore.h:55
static const float S
Definition: mandel.cpp:113
Double_t GetXmax() const
Definition: TAxis.h:138
Int_t fCutOrientation
Definition: ROCCalc.h:59
The TH1 histogram class.
Definition: TH1.h:80
static Int_t c_BackgroundFill
Definition: tmvaglob.h:52
void ApplySignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *any=0)
Int_t c_Canvas = TColor::GetColor( "#f0f0f0" ); Int_t c_FrameFill = TColor::GetColor( "#fffffd" ); In...
Definition: ROCCalc.cxx:116
Abstract ClassifierFactory template that handles arbitrary types.
virtual void SetXTitle(const char *title)
Definition: TH1.h:408
Double_t fNevtS
Definition: ROCCalc.h:58
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
#define NULL
Definition: Rtypes.h:82
virtual void SetTitle(const char *title)
Change (i.e.
Definition: TH1.cxx:6268
Double_t GetROCIntegral()
code to compute the area under the ROC ( rej-vs-eff ) curve
Definition: ROCCalc.cxx:269
static Int_t c_BackgroundLine
Definition: tmvaglob.h:51
Double_t Sqrt(Double_t x)
Definition: TMath.h:464
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition: TH1.cxx:7921
const Bool_t kTRUE
Definition: Rtypes.h:91
float * q
Definition: THbookFile.cxx:87
~ROCCalc()
destructor
Definition: ROCCalc.cxx:164
Definition: math.cpp:60
TAxis * GetXaxis()
Definition: TH1.h:319