Re: [ROOT] TTree Question

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jul 13 2000 - 12:34:20 MEST


Hello Airat,

You are hitting one of the limitations of the split mode: See
    http://root.cern.ch/root/HowtoWriteTree.html
    section "Making a Tree with many branches"

Change your last argument to tree->Branch from 1 to 0.

We hope to remove several of these limitations in the not too distant future.

Rene Brun



Airat A. Sadreev wrote:
> 
> I defined and compiled into a DLL a very simple class:
> 
> typedef Int_t TCode;
> typedef TString TName;
> 
> class TCodeObject: public TObject {
>   public:
>     TCodeObject();
>     TCodeObject(const TCode& code, const TName& name);
>     TCode Code() const;
>     TName Name() const;
>     void Code(const TCode& value);
>     void Name(const TName& value);
>   protected:
>     TCode fCode;
>     TName fObjectName;
> 
>   ClassDef(TCodeObject,1)
> };
> 
> Then I created ROOT's TFile and TTree and filled the tree:
> 
> {
>   gSystem.Load("incld.dll");
> 
>   TFile* file = new TFile("AFile.root", "RECREATE", "Example", 0);
>   TTree* tree = new TTree("T", "The Tree");
>   TCodeObject* cObject = new TCodeObject(1, "CodeObject_1");
>   tree->Branch("CodeObjectBranch", "TCodeObject", &cObject, 64000, 1);
>   for (Int_t i = 0; i < 200; ++i)
>   {
>     char buf[80];
>     sprintf(buf, "Object code is %d", i);
>     cObject->Code(i);
>     cObject->Name(buf);
>     tree->Fill();
>   }
>   file->Write();
>   delete file;
> }
> 
> Then I invoked TTree's MakeClass and this is result:
> 
> #include <TChain.h>
> #include <TFile.h>
> 
> class TTreeScanner {
>    public :
>    TTree          *fTree;    file://pointer to the analyzed TTree or TChain
>    Int_t           fCurrent; file://current Tree number in a TChain
> file://Declaration of leaves types
>    Int_t           fCode;
>    Char_t          fObjectName_*fData[4];
>    UInt_t          fUniqueID;
>    UInt_t          fBits;
> 
> file://List of branches
>    TBranch        *b_CodeObjectBranch;
>    TBranch        *b_fCode;
>    TBranch        *b_fObjectName_*fData;
>    TBranch        *b_fUniqueID;
>    TBranch        *b_fBits;
> 
>    TTreeScanner(TTree *tree=0);
>    ~TTreeScanner();
>    Int_t Cut(Int_t entry);
>    Int_t GetEntry(Int_t entry);
>    Int_t LoadTree(Int_t entry);
>    void  Init(TTree *tree);
>    void  Loop();
>    void  Notify();
>    void  Show(Int_t entry = -1);
> };
> ...
> 
> The questions is: what is the fields fUniqueID and fBits?
> Why fObjectName looks so strange: Char_t fObjectName_*fData[4];
> It seems that TTree correctly handle only members of scalar types (integer,
> double, etc), does it?
> 
> Thank you.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET