38using std::cout, std::endl;
 
   76      Log() << kERROR << 
"Cannot cal ROC curve etc, as in put mvaS and mvaB have differen #nbins or range "<<
Endl;
 
   92         Log() << kERROR << 
"Cannot Rebin Histograms mvaS and mvaB, ROC values will be calculated without Rebin histograms."<<
Endl;
 
 
  162   if (fSplS)            { 
delete fSplS; fSplS = 0; }
 
  163   if (fSplB)            { 
delete fSplB; fSplB = 0; }
 
  164   if (fSpleffBvsS)      { 
delete fSpleffBvsS; fSpleffBvsS = 0; }
 
  165   if (fSplmvaCumS)      { 
delete fSplmvaCumS; fSplmvaCumS = 0; }
 
  166   if (fSplmvaCumB)      { 
delete fSplmvaCumB; fSplmvaCumB = 0; }
 
  167   if (fmvaScumul)       { 
delete fmvaScumul; }
 
  168   if (fmvaBcumul)       { 
delete fmvaBcumul; }
 
  169   if (effBvsS)          { 
delete effBvsS; }
 
  170   if (rejBvsS)          { 
delete rejBvsS; }
 
  171   if (inveffBvsS)       { 
delete inveffBvsS; }
 
 
  183      Log() << kERROR << 
"I guess the mva distributions fed into ROCCalc were already normalized, therefore the calculated error on the efficiency will be incorrect !! " << 
Endl;
 
  189   fmvaScumul->
Scale( 1.0/
TMath::Max(std::numeric_limits<double>::epsilon(),fmvaScumul->GetMaximum()) );
 
  190   fmvaBcumul->Scale( 1.0/
TMath::Max(std::numeric_limits<double>::epsilon(),fmvaBcumul->GetMaximum()) );
 
  191   fmvaScumul->SetMinimum(0);
 
  192   fmvaBcumul->SetMinimum(0);
 
  197   if(effBvsS==0) effBvsS = 
new TH1D(
"effBvsS", 
"ROC-Curve", fNbins, 0, 1 );
 
  198   effBvsS->SetXTitle( 
"Signal eff" );
 
  199   effBvsS->SetYTitle( 
"Backgr eff" );
 
  202   if(rejBvsS==0) rejBvsS = 
new TH1D( 
"rejBvsS", 
"ROC-Curve", fNbins, 0, 1 );
 
  203   rejBvsS->SetXTitle( 
"Signal eff" );
 
  204   rejBvsS->SetYTitle( 
"Backgr rejection (1-eff)" );
 
  207   if(inveffBvsS ==0) inveffBvsS = 
new TH1D(
"invBeffvsSeff", 
"ROC-Curve" , fNbins, 0, 1 );
 
  208   inveffBvsS->SetXTitle( 
"Signal eff" );
 
  209   inveffBvsS->SetYTitle( 
"Inverse backgr. eff (1/eff)" );
 
  215      fSplmvaCumS  = 
new TSpline1( 
"spline2_signal",     
new TGraph( fmvaScumul ) );
 
  216      fSplmvaCumB  = 
new TSpline1( 
"spline2_background", 
new TGraph( fmvaBcumul ) );
 
  230      if (fUseSplines) 
effB = fSplmvaCumB->Eval( cut );
 
  231      else             effB = fmvaBcumul->GetBinContent( fmvaBcumul->FindBin( cut ) );
 
  234      effBvsS->SetBinContent( 
bini, 
effB     );
 
  235      rejBvsS->SetBinContent( 
bini, 1.0-
effB );
 
  236      if (
effB>std::numeric_limits<double>::epsilon())
 
  237         inveffBvsS->SetBinContent( 
bini, 1.0/
effB );
 
  252      rejB = 1.0 - fSpleffBvsS->Eval( 
effS );
 
 
  271   if (fSpleffBvsS == 0) this->GetROC(); 
 
  280      integral += (1.0 - 
effB);
 
 
  296   if (fSpleffBvsS == 0) this->GetROC(); 
 
 
  329   else             retVal = fmvaScumul->GetBinContent( fmvaScumul->FindBin( 
theCut ) );
 
  338   if      (
theCut-fXmin < eps) 
retVal = (fCutOrientation > 0) ? 1.0 : 0.0;
 
  339   else if (fXmax-
theCut < eps) 
retVal = (fCutOrientation > 0) ? 0.0 : 1.0;
 
 
  354      Log() << kWARNING << 
"<ROCCalc::Root> initial interval w/o root: " 
  355            << 
"(a=" << 
a << 
", b=" << 
b << 
")," 
  356            << 
" (Eff_a=" << GetEffForRoot( 
a )
 
  357            << 
", Eff_b=" << GetEffForRoot( 
b ) << 
"), " 
  358            << 
"(fa=" << fa << 
", fb=" << fb << 
"), " 
  366   for (
Int_t iter= 0; iter <= fMaxIter; iter++) {
 
  367      if ((fb < 0 && 
fc < 0) || (fb > 0 && 
fc > 0)) {
 
  378         fa = fb; fb = 
fc; 
fc = fa;
 
  395            p = s * (2 * 
m * 
q * (
q - 
r) - (
b - 
a) * (
r - 1));
 
  396            q = (
q - 1) * (
r - 1) * (s - 1);
 
  408         else { 
d = 
m; 
e = 
m; } 
 
  421   Log() << kWARNING << 
"<ROCCalc::Root> maximum iterations (" << fMaxIter
 
  422         << 
") reached before convergence" << 
Endl;
 
 
  431   if (fnStot!=
nStot || fnBtot!=
nBtot || !fSignificance) {
 
 
  442   if (fnStot==
nStot && fnBtot==
nBtot && !fSignificance) 
return fSignificance;
 
  445   fSignificance = (
TH1*) fmvaScumul->
Clone(
"Significance"); fSignificance->SetTitle(
"Significance");
 
  446   fSignificance->Reset(); fSignificance->SetFillStyle(0);
 
  447   fSignificance->SetXTitle(
"mva cut value");
 
  448   fSignificance->SetYTitle(
"Stat. significance S/Sqrt(S+B)");
 
  449   fSignificance->SetLineColor(2);
 
  450   fSignificance->SetLineWidth(5);
 
  452   fPurity = (
TH1*) fmvaScumul->
Clone(
"Purity"); fPurity->SetTitle(
"Purity");
 
  453   fPurity->Reset(); fPurity->SetFillStyle(0);
 
  454   fPurity->SetXTitle(
"mva cut value");
 
  455   fPurity->SetYTitle(
"Purity: S/(S+B)");
 
  456   fPurity->SetLineColor(3);
 
  457   fPurity->SetLineWidth(5);
 
  460   for (
Int_t i=1; i<=fSignificance->GetNbinsX(); i++) {
 
  475      cout << 
"S="<<S<<
" B="<<B<< 
" purity="<<
purity<< endl;
 
  476      fPurity->SetBinContent( i, 
purity );
 
  477      fSignificance->SetBinContent( i, sig );
 
  494   return fSignificance;
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
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
 
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
 
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
 
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
 
virtual void SetLineColor(Color_t lcolor)
Set the line color.
 
const char * GetTitle() const override
Returns title of object.
 
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
 
A TGraph is an object made of two arrays X and Y with npoints each.
 
1-D histogram with a double per channel (see TH1 documentation)
 
TH1 is the base class of all histogram classes in ROOT.
 
void SetTitle(const char *title) override
Change/set the title.
 
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 SetXTitle(const char *title)
 
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 Int_t GetNbinsX() const
 
virtual void SetMaximum(Double_t maximum=-1111)
 
virtual void SetYTitle(const char *title)
 
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
 
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
 
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
 
ostringstream derivative to redirect and format output
 
Double_t Root(Double_t)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
 
void ApplySignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *any=nullptr)
 
Double_t GetROCIntegral()
code to compute the area under the ROC ( rej-vs-eff ) curve
 
Float_t fXmax
min and max of the mva distribution
 
Bool_t fStatus
false if is found some error in mvaS or mvaB
 
Int_t fCutOrientation
+1 if larger mva value means more signal like, -1 otherwise
 
TH1 * GetPurity(Int_t nStot, Int_t nBtot)
 
Double_t GetEffSForEffBof(Double_t effBref, Double_t &effSerr)
get the signal efficiency for a particular background efficiency that will be the value of the effici...
 
ROCCalc(TH1 *mvaS, TH1 *mvaB)
 
TH1 * GetSignificance(Int_t nStot, Int_t nBtot)
 
MsgLogger & Log() const
message logger
 
TH1D * GetROC()
get the ROC curve
 
TH1 * fmvaB
the input mva distributions
 
TH1 * fmvaBpdf
the normalized (and rebinned) input mva distributions
 
Double_t GetEffForRoot(Double_t theCut)
returns efficiency as function of cut
 
Double_t fNevtS
number of signal events (used in error calculation)
 
Linear interpolation of TGraph.
 
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
 
create variable transformations
 
MsgLogger & Endl(MsgLogger &ml)
 
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
 
Double_t Sqrt(Double_t x)
Returns the square root of x.
 
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.