Event class containing variable length array

Dear ROOTers,
I filled a tree with an event class (SiRectangleDetector in source.tar.gz) and saved it into the file (simfile.root in attachment). It was successful and I didn’t get any error message, but I have serious troubles to read the file (scripts opentree1.cxx and opentree2.cxx). I suspect that it can be somehow connected with the class member Double_t *fXEnergy and *fYEnergy, probably with the streamers.

[code] Int_t m_iXStripNumber;
Int_t m_iYStripNumber;

Double_t *fXEnergy;			//[m_iXStripNumber]
Double_t *fYEnergy;			//[m_iYStripNumber][/code]

However, I wrote the class according to instructions given in User Guide and searched in the forum for some similar topic, I am afraid that I overlooked something important. I need to use variable length array in this case, so be so kind and advice me where I should look for the bug.

Vratislav
simfile.root (547 KB)
source.tar.gz (7.71 KB)
opentree2.cxx (404 Bytes)
opentree1.cxx (425 Bytes)

I believe you created the two branches in your tree like this:
tr->Branch(“rEdetector”, &rEdetectorObject);
tr->Branch(“rdEdetector”, &rdEdetectorObject);
I’d like to propose that you do (note the trailing dots):
tr->Branch(“rEdetector.”, &rEdetectorObject);
tr->Branch(“rdEdetector.”, &rdEdetectorObject);
Then in your “opentree” scripts do (note the trailing dots):
cout << “branchstatus:\t” << tr->GetBranchStatus(“rdEdetector.”) << endl;
TBranch *bde = tr->GetBranch(“rdEdetector.”);

Search for “parent” in http://root.cern.ch/root/html534/TTree.html#TTree:GetEntry and http://root.cern.ch/root/html534/TTree.html#TTree:SetBranchStatus descriptions.

Pepe,

thanks for your help, now it works perfectly. I found the explanation of the “dot” feature in http://root.cern.ch/root/html/TTree.html#TTree:Bronch description.

Vratislav