Hi all,
I would like to implement the storage model in subj, and for that playing with
code:
void Tree()
{
const char *descrip="branch of TObjArray of 2 TClonesArray of TVector3";
const char *filename="~/kir.root";
const char *treename="Tree";
const char *branchname="Branch";
TFile *pFile=TFile::Open(filename,"RECREATE");
TTree *pTr=new TTree(treename,descrip);
TObjArray *pLstAll=new TObjArray(2);
pLstAll->SetOwner();
pTr->Branch(branchname,&pLstAll,32000,0); //here set split to 1
TClonesArray *pLst[2];
for(Int_t i=0;i<2>AddAt(pLst[i]=new TClonesArray("TVector3"),i);
for(Int_t iEvt=0;iEvt<3;iEvt++){
for(Int_t iHit=0;iHit<iEvt;iHit++)
new((*pLst[0])[iHit]) TVector3(iEvt,iHit,111);
for(Int_t iHit=0;iHit<iEvt>Fill();
pLst[0]->Clear();
pLst[1]->Clear();
}
pTr->Write();
delete pFile;
pLstAll->Delete();
pFile=TFile::Open(filename);
pTr=(TTree*)pFile->Get(treename);
pTr->SetBranchAddress(branchname,&pLstAll);
for(Int_t i=0;i<pTr>GetEntries();i++){
pTr->GetEntry(i);
pLst[0]=(TClonesArray*)pLstAll->At(0);
pLst[1]=(TClonesArray*)pLstAll->At(1);
Printf("Event %i first list:",i);pLst[0]->Print();
Printf("Event %i second list:",i);pLst[1]->Print();
}
}
If i fill the tree in spliting mode the message that splitting for TObjArray is not allowed is printed also claiming that split is reset to 0, but in this case
there are problems namely no entries for the first list and only single entry for the second. In case i put no spliting manually everything works as expected.
I can’t figure out what is going on.
I use v5-13-06 selfcompiled on SLC4