Dear Rooters,

I want to plot a real (floating) variable against an integer parameter using the 2D histogram constructor. My script essentially generates a series of histograms from a root file (created using the TTree constructor).

The problem I have is that the resulting plot bins the integer parameter as a float. When plotting direct from TTree no problem. See below.

Example of plot direct from the TTree. This is what it should look like.

The same plot after dumping the parameters into a 2D histogram and plotting. The data points should be binned at integer intervals along the x-axis.

I’d be grateful for any help on a work around. I’ve tried TH2I as opposed to TH2F…same result. The other thing i thought of is perhaps how I’ve declared the variables. In the TTree preamble I’ve declared the variables in the form:

t->Branch(“GL1”,&GL1,“GL1/I”);

t->Branch(“GL2”,&GL2,“GL2/I”);

t->Branch(“P_D90_Imp”,&P_D90_Imp,“P_D90_Imp/F”);

while in preamble of the script that reads the rootfile to generate the histograms, I declare the variables in the form:

seed->SetBranchAddress(“GL1”,&GL1);

seed->SetBranchAddress(“GL2”,&GL2);

seed->SetBranchAddress(“P_D90_Imp”,&P_D90_Imp);

Is there a way to explicitly declare parameters in histograms as floats or integers?

Many thanks