[ROOT] Re: TNode hierarchy question

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Wed Oct 11 2000 - 16:18:37 MEST


If what you want is a complicate geometry you may regard TVolume class instead of TNode.
With this class we did describe the whole ATLAS detector. It contains 15 levels of hierarchy
and 30'000'000 nodes.

 See:
http://connery.star.bnl.gov/~fine/Detectors/ATLAS/AtlasInne.gif
http://connery.star.bnl.gov/~fine/Detectors/ATLAS/AtlasOrtho.gif
http://connery.star.bnl.gov/~fine/Detectors/ATLAS/AtlasPer.gif
http://connery.star.bnl.gov/~fine/Detectors/ATLAS/AtlasPers2.gif

and ROOT 2000 Workshop: http://root.cern.ch/root/R2000Program.html
17h00: STAR Simulation (ppt) (html): Pavel Nevski
ftp://root.cern.ch/root2k/pavelR2000.ppt

To reproduce the picture above one needs an access to
the "atlas.root" file and macro (see attachment)

"atlas.root" file is available on afs:

   /afs/rhic/star/user/fine/WWW/Detectors/ATLAS/atlas.root

or one  can download it from Web:
http://connery.star.bnl.gov/~fine/Detectors/ATLAS/atlas.root

To its hierarchy one can use ROOT TBrowser then:

TBrowser bb("Atlas",ATLS);


Each instance of TVolume class (http://root.cern.ch/root/html/TVolume.html)
can be created alone and then one can build the whole TVolume tree with some methods:


 virtual TVolumePosition* Add(TVolume* node, Double_t x = 0, Double_t y = 0, Double_t z = 0, TRotMatrix* matrix = 0, UInt_t id =
0, Option_t* option)

TVolumePosition* Add(TVolume *volume, Double_t x, Double_t y, Double_t z, const Text_t *matrixname, UInt_t id, Option_t *)

TVolumePosition* Add(TVolume *node, TVolumePosition *nodePosition)

To "navigate" that tree TDataSetIter class can be in use (since TVolume is derived from TDataSet)
but there is a special iterator too. See TVolumeViewIter.

           Valery


----- Original Message -----
From: Max Sang <sang@mppmu.mpg.de>
To: <rootdev@pcroot.cern.ch>
Subject: TNode hierarchy question


> Hello again
>
> I'm trying to build a simple visualisation tool for our
> vertex detector. I want to build a 'geometry' where the
> TNodes correspond to the tracks (TTUBEs at various angles).
> Since the number of nodes in the "geometry" is not known until
> run time I want to put them all in a container and build my
> geometry at the end of the function, just before drawing.
>
> I read in the Root mailing list the following message:
>
> ----------------------------------------------------
> Frederic MACHEFERT wrote:
> >
> >         Hi rooters,
> >
> > I define many different nodes whom the hierarchy is not defined from the
> > beginning. After the initialisation of the nodes, I wish to sort them
> > according to a certain hierarchy. I thought that the goud way was to use
> > the SetParent function. But what I plot doesn't seem to produce what I
> > expect and if I have a look at the browser and at the node hierarchy
> > nothing is modified.
> >
> > I think I missed something with respect to SetParent. I would like to
> know
> > how I can change the hierarchy without deleting and creating again my
> > nodes.
> >
>
> Salut Frederic,
> I suggest you look at the logic in the TNode constructor to understand
> the current logic. In your case, if you want to set the hierarchy only
> once you have defined all the nodes, I suggest;
>   file://disable current node in geometry
>    gGeometry->setCurrentNode(0);
>
>   file://define your nodes
>   TNode *node = new TNode(...)
>   ......
>
>   file://clear the list of nodes in the geometry
>   gGeometry->GetListOfNodes()->Clear();
>
>   file://now start creating your hierarchy
>   file://if a node has descendants, do:
>     node->BuildListOfNodes();
>
>   file://to insert a node in its parent node, do
>   node->SetParent(parentNode);
>   parentNode->GetListOfNodes()->Add(node);
>
> Let me know if you still have problems.
> I am curious to know why you can only build the hierarchy at the end.
> This is may be an interesting case.
>
> Rene Brun
> -----------------------------------------
>
> I tried doing something like this, storing the TNodes in a STL
> vector but had lots of basic problems with segmentation faults,
> for example:
>
>   vector<TNode> nodelist(200);
>
> causes a segmentation fault in TNode::~Tnode()
>
> I am not so interested in why - although I would be interested to
> see if you can replicate this behaviour or have some idea why it
> happens.
>
> I would just like a hint about how you would design such a function.
> All I need to do is loop over some objects representing the tracks
> or vertices etc. For each I need a new TRotMatrix, a new TTUBE, and
> obviously a new TNode. Once I reach the end of the loop, I just
> need to put them inside a global TNode and draw it. Could I use
> a TList? I have a feeling that there is a very simple way to
> proceed, but I don't know what it is!
>
> Many thanks for your time
> Max
>
>  +--------------------------------------------------------------+
>  |      Max Sang    Email: max.sang@cern.ch or max.sang@desy.de |
>  +---------------------------------+----------------------------+
>  | Max Planck Institut fuer Physik | GSM    +44-(0)77 8866 7605 |
>  | Foehringer Ring 6               | Office +49-(0)89 32354 327 |
>  | 80805 Muenchen                  | Fax    +49-(0)89  322 6704 |
>  +---------------------------------+----------------------------+
>
>
>
>
>





This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET