Inconsistency between 2D histo and its projection

Hello, I have a 2D histo that I attached (2D.C). The TPaveStat box says that there are around 15460 hits in the 2D histo.

I did a Y projection using the ProjectionY method and I got the 1D histo that I attached. Here, the number of counts is slightly different (15587).

Do you have any explanation?
Thank you in advance.
1D.C (112 KB)
2D.C (594 KB)

Possibly something like this:
[TH2::Projection entries problem
[ProjectionY problem

I am not sure that the problem I have is the same as the ones you describe. Actually, I fill both histos by this way

if(A>0 && B>0) h1->Fill(B); if(A>0 && B>0) h2->Fill(A,B);
where h1 is a 1D histo and h2 a 2D one.
Doing like that I should find exactly the same integral but this is not the case; the 1D histo I fill like that is exactly the same than the one I get doing a ProjectionY.