Projecting 2D histogram with condition

Dear Root users,
Hi !
I have a 2D histograms “hxy” with X & Y axis as variable A & variable B. I want to project axis B for specific values of A (like 200 < A > 400). To achieve this presently I am doing :

TH1D *h1= hxy->ProjectionB("",200,400);

With this I am not getting the correct statistics in histogram h1. Is this the correct way ?
If not then please tell me the correct method.


Could you specify which version of ROOT you are using. In case it is old, I suggest to try with 5.21/04


Dear Rene,
Hi !
Thanks for the reply. I am using root version 5.17/06. Please tell me is this the correct way of projecting an axis of a 2D histogram with condition ?

Thanks & regards,