Problem in 2D histograms calculations

Dear developers,

I am writing a script in which i am trying to rebin my histograms and draw them in “colz text e” draw option. At the same time i want to evaluate this formula
nt3 = f*nt2/(1-f)
I am not doing the job correctly. I did what I understand. Please help me to solve this issue.
I am attaching my script and root file.


tt_final_new.root (10.0 KB) (2.1 KB)


what is the actual issue? We cannot debug/write your code :sweat_smile:


The actual issues are :slight_smile:

  1. I donot know how to draw histograms in “colz text e”
  2. I want to mutliply two 2D histograms and then draw in “colz text e”
  3. Basically i have to calculate the above mentioned formula

nt3= f*nt2/1-f
where f and nt2 are 2D histograms and f=h1/h2

Note: you cannot change histogram binning the way you try it. You need to use the “correct” binning when you create your histograms (which are then stored in your “tt_final_new.root” file). (1.8 KB)

Dear Wile_E_Coyote,

Thank you.
Is there is some other way to change the bining of the histograms. Because at that instance I cannot change the binning due to long running jobs, it will take much time to do it again.

Dear Wile_E_Coyote,

I want the following plot. That is why I changed the bin size. I just want to plot my data inside these bins.

I modified the “” macro in my previous post. it includes some “rebinning” now (this is the closest to what you want, which can be achieved with your current histograms).

1 Like

Dear Wile_F_Coyote,

I am again facing difficulty in binning the histograms like above mentioned plot. When I will try to rebin x and y axis seperately it will not plot the data in the respective bins.
It just give me the points in these bins. I want the color plot like above.
Kindly help me to do it.


Thank you Wile_E_Coyote for your unconditional help :smiley:

Dear Wile_E_Coyote,

I have used the script sent by you. I changed the binning like

" int nxg = 8, nyg = 30; // how many bins to merge
int nxf = 2, nyf = 0; // the first bin to use / draw
int nxl = 3, nyl = -2; // the last bin to use / draw
I am getting the plot like below. I want to change y-axis 0-3 (0-1, 1-2, 2-3)with equal bin size (if variable binning is not possibe). How I would get this.

loose_ttbar.root (13.0 KB)

Until a proper “rebin” method for 2-D histograms is implemented (if ever), you can try to use the attached macro. (5.6 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.