RE: [ROOTDEV] subbranches?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 19 Feb 2007 11:37:55 -0600


Hi Christian,

Your class TTrackCollection is not known to ROOT as a 'collection' but just as a series of unrelated data member and thus it has no way to collate them the way you want. You __could__ advertize your class as a collection (via a hand code TVirtualCollectionProxy) but this is certainly much more work than the easy alternative.

I simply recomment that you replace the 3 data member of TTrackCollection by:

        std::vector<TTestTrack> Track;
(or even maybe replace TTrackCollection entirely by std::vector<TTestTrack>). You could also used any of the other existing/supported collection (all STL collections or TClonesArray).

You should then get from TTreeViewer the behavior you want.

Cheers,
Philippe.

-----Original Message-----
From: owner-rootdev_at_pcroot.cern.ch [mailto:owner-rootdev_at_pcroot.cern.ch] On Behalf Of Christian Hansen
Sent: Saturday, February 17, 2007 7:40 PM To: Philippe Canal
Cc: 'roottalk'; roottalk_at_pcroot.cern.ch
Subject: RE: [ROOTDEV] subbranches?

Hi Philippe,

thanks a lot for your respond!

So if I understood you right the only way to make for example a "collection of tracks" to expand in the TTreeViewer is to make the collection to be a branch. I did a small test program that I attached to this email (see trackCollectionTest.tgz). After compiling and running it produces "testTree.root". When I use the TTreeViewer to look at the tree in testTree.root the collections of tracks (TPCTracks and FGDTracks) expand but in each of these collections I have three TTestTracks that I hoped they would also expand in the TTreeViewer in the same way as the TTrackCollections. But instead the variables of the tracks are seen as leafs of the collections and not as leafs of the tracks. Does this happen also for you when you look at the testTree.root with the TTreeViewer? If then, why is that so?

Is this is the only way to have a collection of tracks to expand in the TTreeViewer or is there some other recommended way?

Thanks alot!
/Christian

> Hi Christian,
>
> A priori, all real sub-branches are shown in the TTreeViewer.
>
> In the case of test/Event, fLastTrack is a TRef and hence has
> __no__ real sub-branches. In addition the TTreeViewer still
> needs to be renovated :) to handle some of the newer case
> (like the ability to automatic follow the references).
>
> You may find that the TBrowser is able to better unwind
> branches since it is also able to drill though non split
> branches (aka unwind objects).
>
> Cheers,
> Philippe
>
> -----Original Message-----
> From: owner-rootdev_at_pcroot.cern.ch [mailto:owner-rootdev_at_pcroot.cern.ch]
On
> Behalf Of Christian Hansen
> Sent: Saturday, February 17, 2007 7:07 AM
> To: roottalk; roottalk_at_pcroot.cern.ch
> Subject: [ROOTDEV] subbranches?
>
>
> Dear Rooters,
>
> I'm having problems expanding sub-branches in the
> TreeViewer. Since my program looks very much like
> the MainEvent.cxx example provided in the "test"
> folder, I can base my question on this example:
>
> In the "test" folder in root version 5.04/00
> I compiled and ran ./Event
> Then I used the TreeViewer to look at the TTree
> in the Event.root file.
> Why does all variables of "event" looks like leafs
> in the viewer?
> Is it possible to make for example fLastTrack an
> expandable sub-branch so that one could reach e.g.
> the last tracks fPx, fPy and fPz with the TreeViewer?
>
> I get some warnings when I open the TreeViewer:
> Warning in <TClass::TClass>: no dictionary for class Event is available
> I tried to produce dictionaries with cint, but without
> any luck.
>
> Is there any way I can make the sub-branches expandable
> in the TreeViewer?
>
> With best regards
> / Christian Hansen
>
> PS. I have no problems in reading in a complex TTree,
> this is just about using the TreeViewer.
>
>
>
>
>
>
> ================================================
> Dep. of Phys. Office: +1 250 721 7710
> Univ of Victoria Mobile: +1 250 588 0860
> PO Box 3055
> V8W 3P6 Victoria BC
> Canada
> ------------------------------------------------
> Home Page : http://particle.phys.uvic.ca/~hansen
> http://cern.ch/christian.hansen
>
>
>

/ Christian Hansen


Dep. of Phys.         Office: +1 250 721 7710
Univ of Victoria      Mobile: +1 250 588 0860
PO Box 3055
V8W 3P6 Victoria BC
Canada

Home Page : http://particle.phys.uvic.ca/~hansen

            http://cern.ch/christian.hansen Received on Mon Feb 19 2007 - 18:40:02 CET

This archive was generated by hypermail 2.2.0 : Mon Feb 19 2007 - 23:50:01 CET