[ROOT] matrix in TTree with a C structure

From: Matthieu Lechowski (lechowsk@lal.in2p3.fr)
Date: Wed Aug 27 2003 - 10:07:37 MEST


Hello,

I have a problem which is a little hard to explain.

I have a TTree with a C structure:

const Int_t nmax=250;
typedef struct
{
  Int_t   TREEn;
  Float_t TREEpt[nmax], ... ;
  ...
  Float_t TREEmmax[nmax][5],TREEptmax[nmax][5], ... ;
} ENTITE;

ENTITE P[n_entite];

for(int i_P;i_P<n_entite;++i_P)
{
  TREE.Branch("n"+suffix[i_P],&P[i_P].TREEn,"n"+suffix[i_P]+"/I");
  TREE.Branch("pt"+suffix[i_P],P[i_P].TREEpt,
              "pt"+suffix[i_P]+"[n"+suffix[i_P]+"]/F");
  ...
  TREE.Branch("mmax"+suffix[i_P],P[i_P].TREEmmax,
              "mmax"+suffix[i_P]+
              "["+Nsel_str[i_P]+"]["+Nattendu_str[i_P]+"]/F");
  ...
}

As you can see, each object ("ENTITE") has its suffix for the name of
the variables, and its dimensions for the matrixes as mmax (Nsel_str and
Nattendu_str are TString, I did Nsel_str[i_P]+=Nsel[i_P]; where Nsel[]
are integers; I think it was not necessary)

This synthax works with "pt", but not with mmax. Indeed, when I read the
Tree, the variable has the good dimension (2x2 for example), but fields
are empty beyond the first column (or line!), i.e mmax[0][j] are filled,
but mmax[i>0][j] are 0.

I checked, just before filling (function Fill()) the Tree, that my
variables are really filled, and they are, so informations are lost
filling the Tree.
I think my synthax of "Branch(..)" is not correct for matrix.

Have you an idea ?
(I'm using root at cern om lxplus:
ROOTSYS=/afs/cern.ch/sw/root/v3.05.05/rh73_gcc2952/root )

Thank you.


Matthieu Lechowski
LAL Orsay



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET