Hi John,
A simple example where I've had no success would be as follows:
{
TH1F* hist = new TH1F("hist","",20,-10,10);
hist->FillRandom("gaus",1000);
hist->SetFillColor(kRed);
hist->SetFillStyle(3001);
hist->Draw();
TFile f("test.root","RECREATE");
f.cd();
hist->Write();
f.Close();
}
Now exit ROOT (just for good measure) and restart it. Then open the
test.root file and plot the histogram:
{
TFile f("test.root");
f.cd();
TH1F* hist = (TH1F*)f.Get("hist");
hist->Draw();
}
You'll see that the fill style and color are no longer set to 3001 and
kRed, respectively. I take it persisting attributes is more
complicated than just calling hist->Write()?
I have tried this with two versions of ROOT, 3.05/05 and 3.03/09. Both
behave identically.
Cheers,
Steve
}
On Tue, 27 May 2003 23:25:32 +0200
frankland@ganil.fr (Frankland John) wrote:
> Hi Steve
>
> Could you send an example of your code please ?
>
> Thanks,
> John
>
> Steve Sekula wrote:
>
> >Hi Folks,
> >
> >I have a question about persisting histogram attributes when
> >writing them out to TFiles. I'm trying to create a large number of
> >distributions and save them to disk for later examination. Several
> >species are written to each histogram, and each species is
> >color-coded.
> >
> >
> >When I persist the histogram to disk (TH1F::Write()) and then open
> >the TFile, I find that all the color-coding (shading, line
> >attributes, etc.) is lost. How does one persist the attribute
> >information along with the histogram itself to a TFile?
> >
> >Cheers,
> >Steve Sekula
> >
> >
> >
> >
> >
>
> --
> John D. Frankland
> Beam Coordinator
> GANIL
> B.P. 55027
> 14076 CAEN Cedex 05
>
> tel: +33 (0)231454628
> fax: +33 (0)231454665
>
>
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET