ProjectionX of different Y bin

I have a TH2D, and I want to make X projections for the different Y bins. I have 9 Ybin and I want to save the individual X projection of Y as 1D when I do

TH1D* t3= time_L3->ProjectionY(“t3-t7”,4,5),

it give me the correct histo but when i do the second bin

TH1D* t4= time_L3->ProjectionY(“t3-t8”,7,8),
it add the second histo to the first and give me both the first and second bin histo
please I have no idea what to do.

What you get is not very clear. According to what you describe you should get two independent histograms t3 and t4 . Can you clarify what you mean by "it add the second histo to the first ? " may be a small reproducer whole help to better understand.

Thank for replying
My 2D plot is picture 2d and I want to get Xprojection of different Y . when I do
TH1D* t3= time_L3->ProjectionX(“t3-t7”,4,5),
I get picture t3.
but when I do
TH1D* t4= time_L3->ProjectionX(“t3-t8”,8,9),
I get picture t4


TH1D *t5 = time_L3->ProjectionX("t5", 5, 5);
TH1D *t8 = time_L3->ProjectionX("t8", 8, 8);
TH1D *t9 = time_L3->ProjectionX("t9", 9, 9);

Thanks so much. it works.
Really appreciate your help.

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