Re: pb in TTree::MakeCode() ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 25 1999 - 19:21:34 MET


Hi Michael,
TTree::MakeCode was the predecessor of TTree::MakeClass. It was designed
to handle simple ntuples involving only basic data types.
You should use TTree::MakeClass instead in your case.
The generated code is far more general and powerful.
I am considering dropping the support for MakeCode in a next version
unless there is a strong opposition.

Rene Brun

M. Sievers wrote:
> 
> Hello,
> 
> I have a problem when using TTree::MakeCode() with TLorentzVectors. I
> define them in the following way:
> 
>  static TLorentzVector *eff_HCMjet07
>  effTree->Branch("HCMjet07","TLorentzVector",&eff_HCMjet07,bsize,0);
> 
> It all works nicely, but when I issue an effTree->MakeCode(),
> out comes lines like
> 
>    effTree->SetBranchAddress("HCMjet07",&TLorentzVector);
> 
> this is with root 2.23/08 on linuxsuse6.
> I have found the doing the following change:
> 
> *** ../../root.2.23/src/TREEPLAYER_TreePlayer.cxx.orig  Thu Oct 21
> 09:53:08 1999
> --- ../../root.2.23/src/TREEPLAYER_TreePlayer.cxx       Thu Oct 21
> 10:08:00 1999
> ***************
> *** 1666,1672 ****
>         leafcount =leaf->GetLeafCount();
>         TBranch *branch = leaf->GetBranch();
>         if (leafcount) strcpy(branchname,branch->GetName());
> !       else           strcpy(branchname,leaf->GetTitle());
>         bname = branchname;
>         while (*bname) {if (*bname == '.') *bname='_'; bname++;}
>         char *brak = strstr(branchname,"[");
> --- 1666,1672 ----
>         leafcount =leaf->GetLeafCount();
>         TBranch *branch = leaf->GetBranch();
>         if (leafcount) strcpy(branchname,branch->GetName());
> !       else           strcpy(branchname,leaf->GetName());
>         bname = branchname;
>         while (*bname) {if (*bname == '.') *bname='_'; bname++;}
>         char *brak = strstr(branchname,"[");
> 
> Results in the correct behaviour:
> 
>    effTree->SetBranchAddress("HCMjet07",&HCMjet07);
> 
> Please tell me if I'm fixing a mistake I made in a complex way or whether
> this is a bug in root.
> 
> Thanks,
> Michael
> 
> --------------------------------------------------------------------------
> Michael Sievers
> Michael.Sievers@desy.de
> --------------------------------------------------------------------------
> esa$ gcc -Wall -o ariane5 ariane4.c
> ariane4.c: 666: warning: long float implicitly truncated to unsigned type
> esa$ ariane5



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET