On 02/13/12 23:25, Timur Pocheptsov wrote:
> TCanvas' ctor you are using, is not reading anything from file.
>
> void cnv() { TFile *f = new TFile("canvas.root", "read"); TCanvas *c
> = (TCanvas *)f->Get("a");
Many thanks Timur! Everything is ok now!
Adrian
> if (c && c->GetListOfPrimitives()) {
> c->GetListOfPrimitives()->Print(); } }
>
> I have a root file with TCanvas inside, canvas has a name "a", its
> list of primitives contains one object (TH1F, with name "aa"), output
> is:
>
> root [0] .x cnv.C Collection name='TList', class='TList', size=1
> TH1.Print Name =h aa, Entries= 100000, Total sum= 100000.
>
> I think, if you want to use objects from TCanvas, you'll also have to
> do something about objects' lifetime later.
>
> ________________________________________ From: Adrian Sevcenco Sent:
> 13 February 2012 21:25 To: Timur Pocheptsov; roottalk_at_root.cern.ch
> Subject: Re: [ROOT] histograms embedded in TCanvas
>
> On 02/13/12 21:47, Timur Pocheptsov wrote:
>> Hi Adrian.
>> Read your canvas and ask it for a list of primitives? >> >> TCanvas * c = (TCanvas *)f->Get(.....); if (c) { .... TList >> *primitives = c->GetListOfPrimitives();
>> >> ///iterate on this list. >> >> } ________________________________________ From: >> owner-roottalk_at_root.cern.ch [owner-roottalk_at_root.cern.ch] on behalf >> of Adrian Sevcenco [Adrian.Sevcenco_at_cern.ch] Sent: 13 February 2012 >> 20:24 To: roottalk_at_root.cern.ch Subject: [ROOT] histograms embedded >> in TCanvas >> >> Hi! I have an root file that have an TCanvas saved inside. Inside >> in that TCanvas somehow there are a few histograms. How can i list >> and handle (access) those histograms? >> >> Thank you, Adrian
-- ---------------------------------------------- Adrian Sevcenco | Institute of Space Sciences - ISS, Romania | adrian.sevcenco at {cern.ch,spacescience.ro} | ----------------------------------------------Received on Tue Feb 14 2012 - 08:03:58 CET
- application/pkcs7-signature attachment: S/MIME Cryptographic Signature
This archive was generated by hypermail 2.2.0 : Mon Feb 20 2012 - 23:50:01 CET