Re: [ROOT] Persisting Histogram Attributes in TFiles...

From: Steve Sekula (sjsekula@students.wisc.edu)
Date: Wed May 28 2003 - 00:54:36 MEST


Hi John,

The moment you said "There must be something else somewhere..." it
dawned on me -- a long time ago I set the default style in my
rootlogon.C script to be the standard defined by my collaboration. As
with all standards, it is rather drab. :)

I commented out the default style changes and plotted my persisted
figures and it worked! Thanks for writing just the right combination
of words in that previous message, and thanks for you patience on this
one...!

Cheers,
Steve

On Wed, 28 May 2003 00:08:51 +0200
frankland@ganil.fr (Frankland John) wrote:

> Hi Steve
> 
> I just pasted your two bits of code into two files, stevewrite.C
> and steveread.C
> I executed the first (.x stevewrite.C), then exited ROOT,
> and then executed the second (.x steveread.C).
> In both cases I was left with a canvas showing a red, shaded
> histogram!
> I can't see anything wrong with what you're doing, and it
> works fine for me (with ROOT v3.05/05). There must be
> something else somewhere...
> 
> ???
> John
> 
> Steve Sekula wrote:
> 
> >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
> >
> >
> >  
> >
> 
> -- 
> 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