class TGeoIterator


 A geometry iterator that sequentially follows all nodes of the geometrical
 hierarchy of a volume. The iterator has to be initiated with a top volume

    TGeoIterator next(myVolume);

 One can use the iterator as any other in ROOT:

    TGeoNode *node;
    while ((node=next())) {


 The iterator can perform 2 types of iterations that can be selected via:

    next.SetType(Int_t type);

 Here TYPE can be:
    0 (default) - 'first daughter next' behavior
    1           - iteration at the current level only

 Supposing the tree structure looks like:

 TOP ___ A_1 ___ A1_1 ___ A11_1
    |       |        |___ A12_1
    |      |_____A2_1 ___ A21_1
    |                |___ A21_2
    |___ B_1 ...

 The order of iteration for TYPE=0 is: A_1, A1_1, A11_1, A12_1, A2_1, A21_1,
 A21_2, B_1, ...
 The order of iteration for TYPE=1 is: A_1, B_1, ...
 At any moment during iteration, TYPE can be changed. If the last iterated node
 is for instance A1_1 and the iteration type was 0, one can do:

 The next iterated nodes will be the rest of A daughters: A2,A3,... The iterator
 will return 0 after finishing all daughters of A.

 During iteration, the following can be retreived:
 - Top volume where iteration started:    TGeoIterator::GetTopVolume()
 - Node at level I in the current branch: TGeoIterator::GetNode(Int_t i)
 - Iteration type:                        TGeoIterator::GetType()
 - Global matrix of the current node with respect to the top volume:

 The iterator can be reset by changing (or not) the top volume:

    TGeoIterator::Reset(TGeoVolume *top);


 We want to find out a volume named "MyVol" in the hierarchy of TOP volume.

    TIter next(TOP);
    TGeoNode *node;
    TString name("MyVol");
    while ((node=next()))
       if (name == node->GetVolume()->GetName()) return node->GetVolume();

Function Members (Methods)

TGeoIterator(TGeoVolume* top)
TGeoIterator(const TGeoIterator& iter)
static TClass*Class()
const TGeoMatrix*GetCurrentMatrix() const
Int_tGetIndex(Int_t i) const
Int_tGetLevel() const
TGeoNode*GetNode(Int_t level) const
voidGetPath(TString& path) const
TGeoVolume*GetTopVolume() const
Int_tGetType() const
virtual TClass*IsA() const
TGeoIterator&operator=(const TGeoIterator& iter)
voidReset(TGeoVolume* top = 0)
voidSetTopName(const char* name)
voidSetType(Int_t type)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)

Data Members

Int_t*fArrayArray of node indices for the current path
Int_tfLevelCurrent level in the tree
TGeoHMatrix*fMatrixCurrent global matrix
Bool_tfMustResumePrivate flag to resume from current node.
Bool_tfMustStopPrivate flag to signal that the iterator has finished.
TGeoVolume*fTopTop volume of the iterated branch
TStringfTopNameUser name for top
Int_tfTypeType of iteration

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGeoIterator(TGeoVolume *top)
 Geometry iterator for a branch starting with a TOP node.
TGeoIterator(const TGeoIterator &iter)
 Copy ctor.
TGeoIterator & operator=(const TGeoIterator& iter)
TGeoNode * Next()
 Returns next node.
TGeoNode * operator()()
 Returns next node.
const TGeoMatrix * GetCurrentMatrix()
 Returns global matrix for current node.
TGeoNode * GetNode(Int_t level) const
 Returns current node at a given level.
void GetPath(TString& path) const
 Returns the path for the current node.
void IncreaseArray()
 Increase by 30 the size of the array.
void Reset(TGeoVolume* top = 0)
 Resets the iterator for volume TOP.
void SetTopName(const char* name)
 Set the top name for path
void Skip()
 Stop iterating the current branch. The iteration of the next node will
 behave as if the branch starting from the current node (included) is not existing.
Int_t GetIndex(Int_t i) const
{return 0;}
{ }
Int_t GetLevel()
{return fLevel;}
TGeoVolume * GetTopVolume()
{return fTop;}
Int_t GetType()
{return fType;}
void SetType(Int_t type)
{fType = type;}

Author: Andrei Gheata 24/10/01
Last update: root/geom:$Id: TGeoNode.h 21494 2007-12-19 15:50:40Z brun $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.