# Mathematical operations with 2-D histograms

Hi,

I have a two dimensional histogram that I would like to normalize to the value of the maximum element of the histogram.

So, for example:

[code]TH2D *ha = new TH2D(“ha”,“ha”,2,0,2,2,0,2);
ha->SetBinContent(1,1,1);
ha->SetBinContent(1,2,3);
ha->SetBinContent(2,1,2);
ha->SetBinContent(2,2,2);
ha->Draw(“LEGO2Z”);

TH2D *hb = new TH2D(“hb”,“hb”,2,0,2,2,0,2);
Double_t max=ha->GetMaximum();
hb->Divide(ha,max);
hb->Draw(“LEGO2Z”);[/code]

Should give a “hb” that is exactly as “ha”, but dividing the values of all its bins by the number 3.

But it does not work. I get following error:
/opt/root/lib/libHist.so -1:-1 0 public: virtual void TH1::Divide(TF1* f1,Double_t c1=1);
/opt/root/lib/libHist.so -1:-1 0 public: virtual void TH1::Divide(const TH1* h1);
/opt/root/lib/libHist.so -1:-1 0 public: virtual void TH1::Divide(const TH1* h1,const TH1* h2,Double_t c1=1,Double_t c2=1,Option_t* option=""); //MENU

Does it mean that the function “Divide” does not work for two-dimensional histograms? Or am I doing something else wrong?

Is there a way to make mathematical operations with 2-D histograms without calling them element by element?

Thanks,
Estela.

do

Rene

Thank you!

Estela