Re: [ROOT] dividing 2 d histograms

From: Tim Miller (tim.miller@vanderbilt.edu)
Date: Fri Sep 14 2001 - 20:51:08 MEST


Benn Tannenbaum wrote:
> 
> That's what I thought, too, but I get this message:
> 
> Error: No symbol denominator in current scope

Yes, but let me make a wild guess:  you opened a root file with
the two histograms in them, then called draw on their names without
assigning them to a new variable...i.e. as follows

TFile *f = new TFile("myfile.root");

f->ls();
   TH2D   h810;1  Hist title
   TH2D   h811;1  Hist title

h810->Draw();  // this works
h811->Draw();  // this works

h810->Divide(h811);  // this does not work.

Well, to tell you the truth, I don't know why that doesn't
work because it doesn't work for me either.  However, if you
do the following:

TFile *f = new TFile("myfile.root");

f->ls();
   TH2D   h810;1  Hist title
   TH2D   h811;1  Hist title

h810->Draw();  // this works
h811->Draw();  // this works

TH2D *num = (TH2D*)f->Get("h810");
TH2D *den = (TH2D*)f->Get("h811");

num->Divide(den);  //  this works!

Am I close?  To help out...provide a bit more details 
about what you're doing.

Cheers,
-Tim



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET