Root macro to plot pT Vs Efficiency distribution

Good Morning,

I am thinking about how to write a macro to plot a distribution of pT as a function of Efficiency. Any body can help me in this regard.


I think it’s not clear what you want to do. Can you please be more specific?

1 Like

Thanks for your response.
The example is attached. Kindly have a look.

I see. To make this kind of plot, you need 2 histograms: One of the measured pT, and one you use as reference. You then divide the measured by the reference, and get this kind of plot. I’ll fake some plausible looking data to demonstrate

TF1 *f1 = new TF1("f1", "sin(0.3*x)", 0, 10); 
TF1 *f2 = new TF1("f2", "1/(1+exp(-2*(x-3))) * sin(0.3*x)", 0, 10); 

TH1F * h1 = new TH1F("h1", "", 10, 0, 10);
TH1F * h2 = new TH1F("h2", "", 10, 0, 10);

h1->FillRandom("f1", 100000);
h2->FillRandom("f2", 100000);

You will have to make those histograms from your data.
Then just divide the two histograms and draw them

h2->Draw("E"); // "E" draws error bars
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.