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