Re: [ROOT] PAW to ROOT

From: Tim Miller (tim.miller@vanderbilt.edu)
Date: Wed Sep 05 2001 - 22:46:36 MEST


Marcia Begalli wrote:
> 
> Can somebody translate PAW to ROOT, please?
> 
> h/get_vect/contents  hist_id  vector
> 
> for a 2D histogram

The brute force way to do this, if I remember my
PAW correctly, is:

TH2 *hist = (TH2*)file->Get("hist_id");
int dimX = (int)hist->GetNbinsX();
int dimY = (int)hist->GetNbinsY();

double vect[dimX][dimY];

for(int i=1; i <= dimX; i++) {
   for(int j=1; j <= dimY; j++) {
      int bin = (int)hist->GetBin(i,j);
      vect[i][j] = (double)hist->GetBinContent(bin);
   }
}

Whether there is a clean, simple function call in a ROOT
class, I'm not sure (haven't look at recent versions)

Cheers,
-Tim

P.S. I haven't run the code above, but from first glance
it looks like it has no bugs (tm).



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