Dear All,

I’m trying to plot phi distribution (in 0-2pi interval )after simulation. When I use

fPhi = new TH1F(“fPhi”, “#phi distribution”, 60, -1.0, 7.0);

line in the histogram macro, the first and the last points has very low position.

If I use Pi() like below,

fPhi= new TH1F(“fPhi”, “#phi distribution”, 50, -1.+0.*TMath::Pi(), 1.+2.*TMath::Pi());

Those two points become higher but still not in order to line.

This histogram should be straight line. Could you please help me how can I fix this points.

I have attached the two histos.

Thank you very much,

Kind regards to All.

Ayben

This is a binning effect due to the different number of bins.
Check teh way you are filling your histogram.
Post the shortest possible running script if you still have a problem.

Rene

Dear Rene,

Thank you for your reply. I am still suffering from the same problem. I will attached one of my other macros with the same error. How can I eliminate this binning effect? Could you please help me to solve this problem.

Thank you very much,

With my best regards,

Ayben

You are creating your histogram between -2pi to 2pi and 70 bins.
However your data are only between -pi and pi. Your edge bins oare only half filled.

Rene

Dear Rene,

When I use 60 bin like here,

TH1D* hist2b = new TH1D(“histo_two_b”, “charged particles #phi distribution for 900GeV”, 60, -2TMath::Pi(), 2TMath::Pi());

I get correct plot. But if I use

TH1D* hist2b = new TH1D(“histo_two_b”, “charged particles #phi distribution for 900GeV”, 70, -2TMath::Pi(), 2TMath::Pi());

So 20,40,60,80,100 bin numbers produces correct histogram but 30,50,70,90 bins produces wrong histogram which
the first and the last channels are half filled. How can I know which binning is correct.

Thank you,

Kind regards,

Ayben

of course (as I already told you) this is a binning effect. Depending on the edges, the bin containing -pi or +pi will get less statistics because -pi and +pi do not correspond to a bin boundary.

Rene