Getting TH1F for a bin from TH2F

Hi ROOT users,

I have a TH2F histogram with an x and y-axis. I want to extract the distribution of x variable for a particular y bin (or value). This should be a TH1F. Is there a way to extract bin-specific TH1F from TH2F?

I am new to root and stuck with this problem for some time now, and I will be very grateful for any help.

ROOT Version:6.24/00
Compiler: gcc 11.1.0

Use TH2F::ProjectionX See for example the DynamicSlice.C tutorial.

Thanks a lot!

1 Like