and I get one point at 2.5, but I think because of I have 2 values (3 and 4) and this point should be at 2. Also, entries part of the histogram shows that it has 1 entry. But again I think, it must be 2.
So, I’m really confused. Could you please help me to understand this situation.
Can you give us an idea why you wrote your “for” loop at all
[quote=“Ayben”]I made a very simple following macro to draw a histogram[/quote]I found your macro is overcomplicated.[quote=“Ayben”]So, I’m really confused. Could you please help me to understand this situation[/quote]If you remove all redundant statements from your example you may have ended up with the simpler code
TH1F *fh = new TH1F("fh", "fh" ,3 ,0 ,3);
fh->Fill(2);
fh->Draw();It does exactly the same job, eliminates the confusion, and it does answer your question ( I hope ).
maybe the question was why the point 2 was printed in 2.5
this is because your histogram only has 3 bins. They go from 0-1, 1-2 and 2-3.
All points which you are going to fill into that histogram are going to land in on of these 3 bins (+overflow and underflow bins).
so when you fill in 2 it puts it into the 2-3 bin. If you draw it as a point it gets drawn in the middle of the bin at 2.5.
The usual drawing style would be a bar from 2 to 3
That is because a histogram is basically just counting values inside a certain range(=bin width)
If you want your points exactly where they “should” be you need to use a TGraph (or very fine binning)