26 #ifndef ROOT_TMVA_Tools 29 #ifndef ROOT_TMVA_ROCCalc 32 #ifndef ROOT_TMVA_Config 35 #ifndef ROOT_TMVA_Event 38 #ifndef ROOT_TMVA_Version 44 #ifndef ROOT_TMVA_MsgLogger 91 Log() <<
kERROR <<
"Cannot cal ROC curve etc, as in put mvaS and mvaB have differen #nbins or range "<<
Endl;
107 Log() <<
kERROR <<
"Cannot Rebin Histograms mvaS and mvaB, ROC values will be calculated without Rebin histograms."<<
Endl;
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;
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;
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;
267 Double_t effS = 0., rejB = 0., effS_ = 0., rejB_ = 0.;
272 effS = (bini - 0.5)/
Float_t(nbins);
276 if ((effS - rejB)*(effS_ - rejB_) < 0)
break;
299 effS = (bini - 0.5)/
Float_t(nbins);
301 integral += (1.0 - effB);
315 Double_t effS=0., effB, effSOld=1., effBOld=0.;
322 effS = (bini - 0.5)*step;
326 if ((effB - effBref)*(effBOld - effBref) <= 0)
break;
332 effS = 0.5*(effS + effSOld);
375 Log() <<
kWARNING <<
"<ROCCalc::Root> initial interval w/o root: " 376 <<
"(a=" << a <<
", b=" << b <<
")," 379 <<
"(fa=" << fa <<
", fb=" << fb <<
"), " 380 <<
"refValue = " << refValue <<
Endl;
388 if ((fb < 0 && fc < 0) || (fb > 0 && fc > 0)) {
393 d = b -
a;
e = b -
a;
399 fa = fb; fb =
fc; fc = fa;
413 if (ac_equal) { p = 2 * m * s; q = 1 - s; }
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);
425 if (2 * p < (min1 < min2 ? min1 : min2)) {
429 else { d =
m;
e =
m; }
435 else b += (m > 0 ? +
tol : -
tol);
443 <<
") reached before convergence" <<
Endl;
496 cout <<
"S="<<S<<
" B="<<B<<
" purity="<<purity<< endl;
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
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...
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
MsgLogger & Endl(MsgLogger &ml)
virtual void SetMaximum(Double_t maximum=-1111)
ROCCalc(TH1 *mvaS, TH1 *mvaB)
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetMinimum(Double_t minimum=-1111)
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.
virtual void SetYTitle(const char *title)
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
TH1D * GetROC()
get the ROC curve
static struct mg_connection * fc(struct mg_context *ctx)
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...
Double_t Root(Double_t)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
Double_t GetEffForRoot(Double_t theCut)
returns efficiency as function of cut
TH1 * GetPurity(Int_t nStot, Int_t nBtot)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
RooArgSet S(const RooAbsArg &v1)
const char * GetTitle() const
Returns title of object.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
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...
TH1 * GetSignificance(Int_t nStot, Int_t nBtot)
MsgLogger & Log() const
message logger
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb"...
virtual Double_t Eval(Double_t x) const =0
tomato 1-D histogram with a double per channel (see TH1 documentation)}
virtual TH1 * RebinX(Int_t ngroup=2, const char *newname="")
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void ApplySignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *any=0)
Int_t c_Canvas = TColor::GetColor( "#f0f0f0" ); Int_t c_FrameFill = TColor::GetColor( "#fffffd" ); In...
Abstract ClassifierFactory template that handles arbitrary types.
virtual void SetXTitle(const char *title)
Short_t Max(Short_t a, Short_t b)
A Graph is a graphics object made of two arrays X and Y with npoints each.
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
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
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
virtual void SetTitle(const char *title)
Change (i.e.
Double_t GetROCIntegral()
code to compute the area under the ROC ( rej-vs-eff ) curve
virtual Int_t GetNbinsX() const
Double_t Sqrt(Double_t x)