Multipling and Dividing histograms

Hello Rooters,

I need to work on following thing
h1 ,h2,h3,h4 histograms, defined as pointers.(Need to work on both 1D and 2D histograms)

h1= (h2/h3) * h4;

I tried to use Divide and Multiply, looked like it worked, but I cannot display h1 histogram on the canvas.

Tried to follow the example code in forum, How to divide and multiply 2D histograms , but I don’t really understand the solution.
Any ideas would be greatly appreciated.

Thanks
Dil

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi,

You should be able to use first Divide for h2/h3 then use Multiply for the multiplication with h4.
Code like this one would world:

TH1 * h1 = (TH1*) h2->Clone();
h1.Divide(h3);
h1.Multiply(h4) 

Lorenzo

Hi,

Thanks Lorenzo,
Just need to confirm one thing?

TH1 * h1 = (TH1*) h2->Clone();
h1->Divide(h3);

TH1 * h1 = (TH1*) h2->Clone();
h1->Divide(h2,h3);

I realized that these two give the same answer.
Are both correct?

Yes , they are both correct !

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