Hi,
so I have a class Event, that has a TCloneArray within TCloneArray:
Class Event: publicTObject {
...
private:
// array of nodes present in given time
TClonesArray *arryNodes; //->array with all nodes
UInt_t nNodes;
...
};
arryNodes is allocated, using TClonesArray(“RNode”, …)
where RNode also has a TClonesArray:
class RNode : public TObject {
...
private:
TClonesArray *mTrks; //->array with all tracks
UInt_t ntrks;
...
};
where mTrks is allocated, using TClonesArray(“RTrk”,…)
where RTrk is just another class that inherits TObject (similar to RNode).
So I have a standalone program that creates and fills this tree, where I only have one branch using the reference of an instance of Event:
[code] // Create a ROOT Tree
TTree tr(“tr”,“Node and arc events”);
// will instantiate this once and get it reset
// after each loop
Event *ePtr = new Event();
tr.Branch(“event”, &ePtr,16000*100,99);
// now start collecting events
for (size_t i=0; i<nEvents; ++i) {
// start filling Event where there are at least more than one node and within a
// given node there are multiple tracks
…
// Fill the tree with the contents of Event
tr.Fill();
// clear event for next event
ePtr->Clear();
} // end for-loop
hfile.Write();
// printout tree contents
tr.Print();
delete ePtr;[/code]
Every thing runs fine when this is executed, but when I view the tree (via StartViewer()), I could see the arryNodes is a branch, but mTrks is not appearing as a branch but a leaf (the mTrks doesn’t show its contents as the arryNodes does). What am I doing wrong? I could clearly see that the RTrk ctor is being trigger many times, but I don’t understand why it’s appearing as a leaf and not a branch from the StartViewer(). When I scanned this mTrks leaf, it dumps this:
[code]***********************************
- Row * Instance * arryNodes *
-
0 * 0 * *
-
1 * 0 * 0 *
-
1 * 1 * 0 *
-
1 * 2 * 0 *
-
1 * 3 * 0 *
-
1 * 4 * 0 *
-
1 * 5 * 0 *
-
2 * 0 * 0 *
-
2 * 1 * 0 *
-
2 * 2 * 0 *
-
2 * 3 * 0 *
-
2 * 4 * 0 *
-
2 * 5 * 0 *
-
3 * 0 * 0 *
-
3 * 1 * 0 *
-
3 * 2 * 0 *
-
3 * 3 * 0 *
-
3 * 4 * 0 *
-
3 * 5 * 0 *
-
4 * 0 * 0 *
-
4 * 1 * 0 *
-
4 * 2 * 0 *
-
4 * 3 * 0 *
-
4 * 4 * 0 *
-
4 * 5 * 0 *[/code]
So clearly there are multiple rows of it though it looks like all null…
Doesn’t a TClonesArray always result as a branch? So, viewing from the arryNode branch, shouldn’t I see another branch specified as mTrks, instead of a leaf? Or is TClonesArray within TClonesArray not possible? If it possible, do I need to do something differently than the code I have shown above? Is there a code example that someone could reference me to of a class that has a TClonesArray within a TClonesArray that will result in a branch within a branch?
Feed back would be much appreciated…Thanks!