I am having troubles, wouldn’t you mind to help me please :
I am trying to rebin the TH2F I draw below (basically because I have too much data points and I want to group them 5 by 5 for instance).
TTree *t1 = new TTree("t1", "a tree 2");
t1->ReadFile("myfle.txt","e_energy/D:FOM_energy/D:score/I:simu/I");
t1->Draw("FOM_energy:e_energy"," SOME SELECTION "," SOME OPTION ");
I tried the rebin() method, but it works only with TH1F. Then I tried to cast my draw in a TH2F with few bins, but it doesn’t work neither… would you have any idea on how to proceed ? Thanks
tree.Draw("sqrt(x):sin(y)>>hsqrt(100,10,60,50,.1,.5)")
// plot sqrt(x) against sin(y)
// 100 bins in x-direction; lower limit on x-axis is 10; upper limit is 60
// 50 bins in y-direction; lower limit on y-axis is .1; upper limit is .5
Yus,
Thanks for the TTree doc you shared I have missed an info : I have already been trying that option of casting an histogram into another one yet I forgot to retrieve the “hsqrt”. It works now !
t1->Draw("FOM_energy:e_energy>>hsqrt(100,0.,1.,1000,0.,0.002)"," SOME SELECTION"," SOME OPTION");
TH2F *hsqrt = (TH2F*)gDirectory->Get("hsqrt"); //missed that line
hsqrt->Draw();
Thanks both.
Well, turns out that one does not even need the last two line … hum…