Hi Sebastien,
I cannot reproduce your problem with the test on Zombie.
Note that in your example, you had a typo, testing on aclone
instead of aclonesarray.
I have added the call to MakeZombie in the second TClonesArray
constructor. Thanks for this remark.
Rene Brun
On Wed, 9 Apr
2003, Sebastien Greder wrote:
> Hello,
>
> I'm facing a small problem concerning the TClonesArray constructor :
>
> I create a TClonesArray with the usual constructor :
>
> TClonesArray* aclone = new TClonesArray("aclassname",100) ;
>
> If the classname is not known by ROOT (i.e gROOT->GetClass("classname")
> fails) one gets the message : "classname is not a valid clas name"
> and MakeZombie() is called .
>
> Since I want to test if the TClonesArray has been successfuly built , that
> means not only have a message but be able to stop my prog somehow I
> decided to test the TClonesArray by : aclone->IsZombie() but this doesn't
> work, so to sum up the code :
>
> TClonesArray* trackarray = 0 ;
> TClonesArray* muonarray = 0;
> ....
>
> trackarray = InitArrays(track_branch,trackarray,"Track") ;
> muonarray = Init...
>
> TClonesArray* InitArrays(TBranchElement* abranch,
> TClonesArray* aclonesarray,
> TString aclassname)
> {
> if(abranch) {
> aclonesarray = new TClonesArray(aclassname.Data(),100) ;
> if(aclone->IsZombie()) return 0 ;
> else {
> tree->SetBranchAddress(abranch->GetName(),&aclonesarray);
> return aclonesarray ;
> }
> }
> else {
> cout << "couldn't find branch" << endl ;
> return 0 ;
> }
> }
>
> Am I doing something wrong ?
>
> Thanks for help,
>
> seb.
>
> ps : by the way the second constructor of TClonesArray :
> TClonesArray(const TClass *cl,....)
>
> does not have the call MakeZombie() if cl is NULL, just a message error
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET