RE: [ROOT] Alpha/Linux and a TTree::Branch crash

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Jul 29 2002 - 17:27:18 MEST


Hi Thomas,

One of the difference of a the 2 code is that in Rene's version they are 2
placeholders.
In your version, you use the same placeholder, hence when loading the 2nd
branch the placeholder is not zero anymore (and the value is not
appropritate for the 2nd branche) hence the problems.

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Thomas Bretz
Sent: Monday, July 29, 2002 3:02 AM
To: Rene Brun; roottalk@pcroot.cern.ch
Subject: Re: [ROOT] Alpha/Linux and a TTree::Branch crash


Hi Rene,

> What you do is illegal. You should do

I think the pointer to a pointer sent to TTree::Branch is more or less a
placeholder, when 0.

However, can you explain me what the difference between:
void *
and
MPhoton* / MElectron*
is?

Thomas.

> MPhoton *photon = 0;
> MElectron *electron = 0;
> TBranch *B1=T1->Branch("MPhoton.",   "MPhoton",   &photon);
> TBranch *B2=T2->Branch("MElectron.", "MElectron", &electron);
>

> > void *ptr = NULL;
> > TFile file("name", "RECREATE", "", 9);
> > TTree *T1=new TTree("P", "");
> > TTree *T2=new TTree("E", "");
> > TBranch *B1=T1->Branch("MPhoton.",   "MPhoton",   &ptr);
> > TBranch *B2=T2->Branch("MElectron.", "MElectron", &ptr);
> >
> > while MPhoton and MElectron are only container classes (derived from
> > TObject) storing values (no arrays, no pointers, only floats). The
> > Address is later on setup with B1/B2->SetAddress(..) before calling
> > Fill.
> >
> > On Alpha the second call to T2->Branch craches...



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:02 MET