Cumulative TEfficiency/TGraphAsymErrors problem

Hi everyone.

I have a TEfficiency histogram, and I wish to calculate its cumulative. As I couldn’t find any method to do so,
I tried to get the total and passed histograms, integrate them, and then try to recombine them in a new TEfficiency object. Happens that the results is not what I would expect. I went even further and tried TGraphAsymErrors with the same principle. It also gave something wrong, and different from what I got with TEfficiency,

My code is the following:

TFile f1 = TFile("../MultijetTriggerCurves.AntiKt4LCTopo.allGRL_eta2.8_4thjet40.root");

TEfficiency * EF_5j55n_LC = (TEfficiency*) f1.Get("5Jets/EF_5j55_a4tchad_L2FS_vs_nthJet");
	
TH1* EF_5j55n_LC_total = EF_5j55n_LC->GetCopyTotalHisto();
TH1* EF_5j55n_LC_passed = EF_5j55n_LC->GetCopyPassedHist();

EF_5j55n_LC_total->ComputeIntegral();
EF_5j55n_LC_total->SetContent( EF_5j55n_LC_total->GetIntegral() );

EF_5j55n_LC_passed->ComputeIntegral();
EF_5j55n_LC_passed->SetContent( EF_5j55n_LC_passed->GetIntegral() );

TEfficiency* EF_5j55n_LC_cumulative = new TEfficiency(*EF_5j55n_LC_passed, *EF_5j55n_LC_total);
EF_5j55n_LC_total->Draw();
EF_5j55n_LC_passed->Draw("SAME");
EF_5j55n_LC_cumulative->Draw("SAMEP");

TGraphAsymmErrors* test = new TGraphAsymmErrors(EF_5j55n_LC_passed,EF_5j55n_LC_total);
test->SetMarkerStyle(23);
test->SetMarkerColor(kRed);
test->SetLineColor(kRed);
test->Draw("SAMEP");

The output is in attachment. As you can see, I only get 0 or 1. Am I doing it wrong?
Can you shine some light in this issue, please?

Many thanks in advance,
Ricardo


HI,
The problem is that the cumulative integral you are producing are normalized to 1. The TEfficiency class expected instead integer values for each bin. You should then normalize your cumulative histograms to the total content, thus do before creating the TEfficiency class

double n = EF_5j55n_LC_total->GetSumOfWeights();
EF_5j55n_LC_total->ComputeIntegral();
EF_5j55n_LC_total->SetContent( EF_5j55n_LC_total->GetIntegral() );
EF_5j55n_LC_total->Scale(n);

and the same for EF_5j55n_LC_passed

Lorenzo