I’ve got a TH2F histogram, from which I’d like to extract a z vs y TH1F for a given value of x in the TH2F. Is there any method to do this right away? Or would I have to fill the new TH1F’s myself for the values of x I’m interested in?
Are you sure you want to start from a TH2F and not a TH3F. For a TH2F the individual z values are lost, theyr are accumulated in the xy bins.
see TH3F::Project3D
Thanks for your answer. However, I think I don’t need a TH2F, because I don’t have any variable for the z axis, but it is the frequency of the variables in xy.
I´ll try to make myself clear: I ´m using a TH2F because I´ve got a variable (#1), which I could use a TH1F for, that changes for different values of another variable (#2). So, instead of having lots of TH1F, one for each value of #2, I built a TH2F.
Thing is, I don’ t know, a priori, for which values of #2 will I want a TH1F of #1. That´s why I wanted to build the TH2F first and the extract the TH1F´s.