I am trying to calculate the integral of my ROC curves for background rejection vs signal efficiency using the Integral() method described in the ROOT TH1:Integral reference guide.
Instead of returning values between 0 and 1. For values around 0.5, indicating a straight line ROC curve, I am instead receiving values around 0 with values trending upwards towards some value from there. I am not sure why the integral method would read out 0 for what is basically a triangle.
Here is the code I am using:
// Calculate Background Vs. Signal Efficiency
int nSigBins = hist->GetNbinsX();
int nBkgBins = bkghist->GetNbinsX();
double TSigIntegral = hist->Integral();
double TBkgIntegral = bkghist->Integral();
std::vector<double> LeftSigEff(nSigBins, 0.0);
std::vector<double> RightSigEff(nSigBins, 0.0);
std::vector<double> LeftBkgEff(nBkgBins, 0.0);
std::vector<double> RightBkgEff(nBkgBins, 0.0);
for (int i = 0; i < nSigBins; i++) {
LeftSigEff[i] = (hist->Integral(0, i) / TSigIntegral);
RightSigEff[i] = (hist->Integral(i, nSigBins) / TSigIntegral);
}
for (int i = 0; i < nBkgBins; i++) {
LeftBkgEff[i] = 1 - (bkghist->Integral(0, i) / TBkgIntegral);
RightBkgEff[i] = 1 - (bkghist->Integral(i, nBkgBins) / TBkgIntegral);
}
// Plot Efficiency Comparison of Background and Signal
TCanvas *LeftCanvas = new TCanvas("LeftCanvas", "LeftCanvas", 800, 600);
TLegend *LeftLegend = new TLegend(0.6, 0.6, 0.9, 0.9);
LeftCanvas->cd();
auto g = new TGraph(nSigBins, &LeftBkgEff[0], &LeftSigEff[0]);
LeftCanvas->SetTitle("Left Cut Efficiency Comparison");
g->GetXaxis()->SetTitle("#epsilon_{Sig}");
g->GetYaxis()->SetTitle("1 - #epsilon_{Bkg}");
g->GetYaxis()->SetRangeUser(0, 1);
g->GetXaxis()->SetRangeUser(0, 1);
std::cout << "----------------------------------------" << std::endl;
std::cout << "Left Cut Efficiency Comparison" << std::endl;
std::cout << "Decay Channel: " << decayinfo << std::endl;
std::cout << "Observable: " << obs << std::endl;
std::cout << "Particle: " << part << std::endl;
std::cout << "ROC Curve Plot Integral: " << 100*g->Integral() << std::endl;
g->Draw("AC*");
LeftCanvas->SaveAs(("Output/RequestAnalysis/AllSMass/" + decayinfo + "_" + part + "_" + obs + "_LeftEfficiencyComparison.png").c_str());
Where hist and bkghist are histograms loaded in separately.
Here is some of my output:
Left Cut Efficiency Comparison
Decay Channel: ttbb
Observable: jet
Particle: N
ROC Curve Plot Integral: 31.4656
Left Cut Efficiency Comparison
Decay Channel: ttbb
Observable: jet
Particle: pt
ROC Curve Plot Integral: 2.94997
Left Cut Efficiency Comparison
Decay Channel: ttbb
Observable: E
Particle: met
ROC Curve Plot Integral: 27.6885
Left Cut Efficiency Comparison
Decay Channel: ttbb
Observable: E
Particle: st
ROC Curve Plot Integral: 2.8683
Left Cut Efficiency Comparison
Decay Channel: ttbb
Observable: N
Particle: tau
ROC Curve Plot Integral: 0
I multiplied the output by 100 simply for readability.
_ROOT Version: 6.24/06
_Platform: lxplus
Compiler: Not Provided