Using cuts on pre-existing histograms

Hello, I am a fairly new root user and cant seem to figure out how to do the following. I have a tree, which I created an analysis script for using “makeselector”. In this script I make several 2D histograms. I want to make a cut on one histogram, and use that cut on another histogram. I make the cut graphically, and then name it. Then in the terminal I redraw the plot using HistName->Draw("[cutname]") and it draws the histo with the cut. Then when I try to use the cut on another histogram in the same manner, ie Hist2Name->Draw("[cutname]") I get a blank histogram. I fill both histograms under the same conditions and they share one of the same axes. They are filled with the following lines:

AngVsEnX3[0]->Fill(Theta_1,Float_t(X3RawE[i]) PosVsAngX3[0]->Fill(Theta_1,PosX3)
(I have arrays of histograms)

Thanks in advance!


The cut will by apply to the X and Y values independently of what their semantic/name are. So I assume that in you case the values of PosX3 are all out of the range of value you selected ( … and yes this does not make much sense since your cut was created in term of value of X3RawE[i] …). In order to do the cut you want (a set of (Theta_1,PosX3) where the selection is based on the values of (Theta_1,Float_t(X3RawE[i]), you must go back to the original data (the ntuple/TTree).