RE: Variable tree array in class

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 05 Jul 2005 09:21:54 -0500


Hi Christian,

> Is it possible to write:

Yes. Note that since the data member is set 'transient' the information [fNPars] is not used (since it would be used only when storing and restoring).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of cstrato
Sent: Saturday, July 02, 2005 9:31 AM
To: Rene Brun
Cc: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] Variable tree array in class

Dear Rene

Meanwhile I realized that variable length arrays are only allowed for simple types, so I have to store the trees in a TList fTrees.

However, my question regarding transient data members remains: Is it possible to write:
class MyClass: public TObject {

    protected:

       TString    fType;    //Type of tree
       Int_t      fNPars;   //! number of parameters
       Double_t  *fPars;    //! [fNPars] array of fNPars parameters
}
in order to prevent that fNPars and fPars are written to file when I write MyClass to file?

Thank you.
Christian

Rene Brun wrote:
> Christian,
>
> I do not understand your question and what you try to achieve.
> More details please.
>
> Rene Brun
>
> On Fri, 1 Jul 2005, cstrato wrote:
>

>> Dear Rooters
>>
>> Root has a very elegant solution to init variable arrays in a class:
>> class MyClass: public TObject {
>>
>>   protected:
>>      TString    fType;    //Type of tree
>>      Int_t      fNPars;   //number of parameters
>>      Double_t  *fPars;    //[fNPars] array of fNPars parameters
>> }
>>
>> However, I want to store a class MyClass permanently in TFile
>> w/o storing an array fTree of fNTrees trees.
>> Is it possible to write "//! [fNTrees]", i.e.:
>> class MyClass: public TObject {
>>
>>   protected:
>>      TString    fType;    //Type of tree
>>      Int_t      fNTrees;  //! number of trees
>>      TTree     *fTree;    //! [fNTrees] array of fNTrees trees
>> }
>>
>> Thank you in advance.
>>
>> Best regards
>> Christian
>> _._._._._._._._._._._._._._._._
>> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
>> V.i.e.n.n.a       A.u.s.t.r.i.a
>> _._._._._._._._._._._._._._._._
>>

>
>
>
Received on Tue Jul 05 2005 - 16:22:56 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET