Dividing histograms

Hi.
I got a problem in dividing histograms. I have two TH1I histograms (you can see in the attached code, they are called “One_deltaR_dist” and “Ref_deltaR_dist”), and I’d like to divide them, I tried using the Divide function, but I keep getting this error message when I try to compile:

Compiling analyzer.o … analyzer.cpp: In function int main()': analyzer.cpp:152: error: no matching function for call toTH1F::Divide(TH1F&)’
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:152: note: candidates are: virtual void TH1::Divide(TF1*, Double_t)
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:153: note: virtual void TH1::Divide(const TH1*)
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:154: note: virtual void TH1::Divide(const TH1*, const TH1*, Double_t, Double_t, const Option_t*)
make: *** [analyzer.o] Error 1
analyzer.cpp (6.6 KB)

You need: One_deltaR_dist.Divide( &Ref_deltaR_dist );
Philipppe

Thank you very much, it worked.
Aye.

As I said, I did as you said and I get very weird division. I thought (and correct me if I got it al wrong) that Divide function takes one bin’s contains from one histogram and divides it with the same bin contains of the other, so if my histograms has the same amount of bins and the same scales, it should work…
I attach the ps files I get after the division and the files before, and I add my code in the following reply.
Aye.
ref_dR.ps (10.2 KB)
eff_1_dR.ps (10.1 KB)
1_dR.ps (10.3 KB)

Here the code I use.
Aye.
analyzer.cpp (7.11 KB)

You should not use TH1I but TH1F or TH1D if you plan to do
h1.Divide(h2) because the result being fractional will be truncated to the
lowest integer.

Rene

Thank you very much!