RE: [ROOT] binary output from a TH2F

From: Faine, Valeri (fine@bnl.gov)
Date: Thu May 08 2003 - 00:53:17 MEST


Hello Fernando,
 
-----Original Message-----
From: Fernando Rannou [mailto:rannou@mednet.ucla.edu] 
Sent: Wednesday, May 07, 2003 5:19 PM
To: fine@bnl.gov
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] binary output from a TH2F
 
Thanks Valeri. It worked like a charm.
However, I still get the information I don't need in the
file; like underflow and things like that.


 
There was just an idea rather a ready-to-eat code.
The code you are supposed to write yourself aren't you?-)
Please, look up TH<n> class methods to see how you can extract 
what you need exactly.
 
           Valeri
 

Fernando

Valeri Fine wrote:


Hello Rooters,
 
I would like to know whether there
is a convenient way to write a 2D sinogram (just the entry values)
as a raw file.
    
 
  Try:
 
  void writeRaw(TArtrayF *h) {
    FILE *f= fopen("myfile","w");
    fwrite(h->GetArray(),sizeof(float),h->GetSize(),f);
    fclose(f);
  }
 
The you can use it for any 1/2D histogram;
  
  TH1F *h1;
  writeRaw(h1);
 
  TH2F *h2;
  writeRaw(h2);
 
 
  Hope it helps
                   Valeri
  
Thanks
Fernando
    
 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET