Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 18/03/02
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11// Author : Andrei Gheata - date Wed 12 Dec 2001 09:45:08 AM CET
13#ifndef ROOT_TGeoCache
14#define ROOT_TGeoCache
16#include "TGeoNode.h"
18#include "TGeoStateInfo.h"
20// forward declarations
21class TGeoManager;
22class TGeoHMatrix;
24class TGeoCacheState : public TObject
27 Int_t fCapacity; // maximum level stored
28 Int_t fLevel; // level in the current branch
29 Int_t fNmany; // number of overlapping nodes on current branch
30 Int_t fStart; // start level
31 Int_t fIdBranch[30]; // ID branch
32 Double_t fPoint[3]; // last point in master frame
33 Bool_t fOverlapping; // overlap flag
35 TGeoNode **fNodeBranch; // last node branch stored
36 TGeoHMatrix **fMatrixBranch; // global matrices for last branch
37 TGeoHMatrix **fMatPtr; // array of matrix pointers
44 TGeoCacheState(Int_t capacity);
45 virtual ~TGeoCacheState();
47 void SetState(Int_t level, Int_t startlevel, Int_t nmany, Bool_t ovlp, Double_t *point=0);
48 Bool_t GetState(Int_t &level, Int_t &nmany, Double_t *point) const;
50 ClassDef(TGeoCacheState, 0) // class storing the cache state
53class TGeoNodeCache : public TObject
56 Int_t fGeoCacheMaxLevels;// maximum supported number of levels
57 Int_t fGeoCacheStackSize;// maximum size of the stack
58 Int_t fGeoInfoStackSize; // maximum size of the stack of info states
59 Int_t fLevel; // level in the current branch
60 Int_t fStackLevel; // current level in the stack
61 Int_t fInfoLevel; // current level in the stack
62 Int_t fCurrentID; // unique ID of current node
63 Int_t fIndex; // index in array of ID's
64 Int_t fIdBranch[100]; // current branch of indices
65 TString fPath; // path for current branch
66 TGeoNode *fTop; // top node
67 TGeoNode *fNode; //! current node
68 TGeoHMatrix *fMatrix; //! current matrix
69 TObjArray *fStack; // stack of cache states
70 TGeoHMatrix **fMatrixBranch; // current branch of global matrices
71 TGeoHMatrix **fMPB; // pre-built matrices
72 TGeoNode **fNodeBranch; // current branch of nodes
73 TGeoStateInfo **fInfoBranch; // current branch of nodes
74 TGeoStateInfo *fPWInfo; //! State info for the parallel world
75 Int_t *fNodeIdArray; //! array of node id's
77 TGeoNodeCache(const TGeoNodeCache&) = delete;
82 TGeoNodeCache(TGeoNode *top, Bool_t nodeid=kFALSE, Int_t capacity=30);
83 virtual ~TGeoNodeCache();
85 void BuildIdArray();
86 void BuildInfoBranch();
87 void CdNode(Int_t nodeid);
88 Bool_t CdDown(Int_t index);
89 Bool_t CdDown(TGeoNode *node);
90 void CdTop() {fLevel=1; CdUp();}
91 void CdUp();
92 void FillIdBranch(const Int_t *br, Int_t startlevel=0) {memcpy(fIdBranch+startlevel,br,(fLevel+1-startlevel)*sizeof(Int_t)); fIndex=fIdBranch[fLevel];}
93 const Int_t *GetIdBranch() const {return fIdBranch;}
94 void *GetBranch() const {return fNodeBranch;}
95 void GetBranchNames(Int_t *names) const;
96 void GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const;
97 void GetBranchOnlys(Int_t *isonly) const;
98 void *GetMatrices() const {return fMatrixBranch;}
100 Int_t GetCurrentNodeId() const;
101 TGeoNode *GetMother(Int_t up=1) const {return ((fLevel-up)>=0)?fNodeBranch[fLevel-up]:0;}
102 TGeoHMatrix *GetMotherMatrix(Int_t up=1) const {return ((fLevel-up)>=0)?fMatrixBranch[fLevel-up]:0;}
103 TGeoNode *GetNode() const {return fNode;}
104 TGeoNode *GetTopNode() const {return fTop;}
107 void ReleaseInfo();
108 Int_t GetLevel() const {return fLevel;}
109 const char *GetPath();
111 Int_t GetNodeId() const;
112 Bool_t HasIdArray() const { return fNodeIdArray ? kTRUE : kFALSE; }
113 Bool_t IsDummy() const {return kTRUE;}
115 void LocalToMaster(const Double_t *local, Double_t *master) const;
116 void MasterToLocal(const Double_t *master, Double_t *local) const;
117 void LocalToMasterVect(const Double_t *local, Double_t *master) const;
118 void MasterToLocalVect(const Double_t *master, Double_t *local) const;
119 void LocalToMasterBomb(const Double_t *local, Double_t *master) const;
120 void MasterToLocalBomb(const Double_t *master, Double_t *local) const;
121 Int_t PushState(Bool_t ovlp, Int_t ntmany=0, Int_t startlevel=0, Double_t *point=0);
122 Bool_t PopState(Int_t &nmany, Double_t *point=0);
123 Bool_t PopState(Int_t &nmany, Int_t level, Double_t *point=0);
124 void PopDummy(Int_t ipop=9999) {fStackLevel=(ipop>fStackLevel)?(fStackLevel-1):(ipop-1);}
126 Bool_t RestoreState(Int_t &nmany, TGeoCacheState *state, Double_t *point=0);
128 ClassDef(TGeoNodeCache, 0) // cache of reusable physical nodes
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
Class storing the state of the cache at a given moment.
Definition: TGeoCache.h:25
Int_t fLevel
Definition: TGeoCache.h:28
TGeoHMatrix ** fMatPtr
Definition: TGeoCache.h:37
Bool_t GetState(Int_t &level, Int_t &nmany, Double_t *point) const
Restore a modeler state.
Definition: TGeoCache.cxx:591
Int_t fIdBranch[30]
Definition: TGeoCache.h:31
Bool_t fOverlapping
Definition: TGeoCache.h:33
TGeoHMatrix ** fMatrixBranch
Definition: TGeoCache.h:36
Int_t fNmany
Definition: TGeoCache.h:29
void SetState(Int_t level, Int_t startlevel, Int_t nmany, Bool_t ovlp, Double_t *point=0)
Fill current modeller state.
Definition: TGeoCache.cxx:564
Int_t fCapacity
Definition: TGeoCache.h:27
TGeoNode ** fNodeBranch
Definition: TGeoCache.h:35
Default ctor.
Definition: TGeoCache.cxx:460
Double_t fPoint[3]
Definition: TGeoCache.h:32
virtual ~TGeoCacheState()
Definition: TGeoCache.cxx:549
TGeoCacheState & operator=(const TGeoCacheState &)
assignment operator
Definition: TGeoCache.cxx:522
Int_t fStart
Definition: TGeoCache.h:30
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition: TGeoMatrix.h:421
The manager class for any TGeo geometry.
Definition: TGeoManager.h:43
Special pool of reusable nodes.
Definition: TGeoCache.h:54
virtual ~TGeoNodeCache()
Definition: TGeoCache.cxx:101
TGeoNodeCache(const TGeoNodeCache &)=delete
array of node id's
void * GetMatrices() const
Definition: TGeoCache.h:98
TGeoNode * GetTopNode() const
Definition: TGeoCache.h:104
Bool_t IsDummy() const
Definition: TGeoCache.h:113
Int_t fGeoCacheStackSize
Definition: TGeoCache.h:57
TGeoHMatrix ** fMPB
Definition: TGeoCache.h:71
TGeoNode * GetNode() const
Definition: TGeoCache.h:103
void CdNode(Int_t nodeid)
Change current path to point to the node having this id.
Definition: TGeoCache.cxx:165
void * GetBranch() const
Definition: TGeoCache.h:94
Dummy constructor.
Definition: TGeoCache.cxx:34
void CdTop()
Definition: TGeoCache.h:90
void GetBranchOnlys(Int_t *isonly) const
Fill copy numbers of current branch nodes.
Definition: TGeoCache.cxx:307
Int_t fIndex
Definition: TGeoCache.h:63
TGeoNodeCache & operator=(const TGeoNodeCache &)=delete
const char * GetPath()
Returns the current geometry path.
Definition: TGeoCache.cxx:344
void MasterToLocal(const Double_t *master, Double_t *local) const
Point in master frame defined by current matrix converted to local one.
Definition: TGeoCache.cxx:411
TGeoStateInfo * fPWInfo
Definition: TGeoCache.h:74
Int_t fIdBranch[100]
Definition: TGeoCache.h:64
void BuildIdArray()
Builds node id array.
Definition: TGeoCache.cxx:124
Int_t fInfoLevel
Definition: TGeoCache.h:61
Int_t * fNodeIdArray
State info for the parallel world.
Definition: TGeoCache.h:75
void BuildInfoBranch()
Builds info branch. Navigation is possible only after this step.
Definition: TGeoCache.cxx:142
const Int_t * GetIdBranch() const
Definition: TGeoCache.h:93
void PopDummy(Int_t ipop=9999)
Definition: TGeoCache.h:124
TGeoHMatrix ** fMatrixBranch
Definition: TGeoCache.h:70
void GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const
Fill copy numbers of current branch nodes.
Definition: TGeoCache.cxx:296
TGeoStateInfo ** fInfoBranch
Definition: TGeoCache.h:73
TObjArray * fStack
current matrix
Definition: TGeoCache.h:69
Int_t GetNodeId() const
Get unique node id.
Definition: TGeoCache.cxx:273
TGeoStateInfo * GetInfo()
Get next state info pointer.
Definition: TGeoCache.cxx:319
TGeoStateInfo * GetMakePWInfo(Int_t nd)
Get the PW info, if none create one.
Definition: TGeoCache.cxx:154
TGeoHMatrix * GetMotherMatrix(Int_t up=1) const
Definition: TGeoCache.h:102
Int_t fStackLevel
Definition: TGeoCache.h:60
void MasterToLocalVect(const Double_t *master, Double_t *local) const
Vector in master frame defined by current matrix converted to local one.
Definition: TGeoCache.cxx:427
void MasterToLocalBomb(const Double_t *master, Double_t *local) const
Point in master frame defined by current matrix converted to local one and rescaled with bomb factor.
Definition: TGeoCache.cxx:443
Int_t fCurrentID
Definition: TGeoCache.h:62
Bool_t PopState(Int_t &nmany, Double_t *point=0)
Pop next state/point from heap.
Definition: TGeoCache.cxx:370
Bool_t HasIdArray() const
Definition: TGeoCache.h:112
TGeoHMatrix * fMatrix
current node
Definition: TGeoCache.h:68
Bool_t CdDown(Int_t index)
Make daughter INDEX of current node the active state. Compute global matrix.
Definition: TGeoCache.cxx:202
void LocalToMaster(const Double_t *local, Double_t *master) const
Local point converted to master frame defined by current matrix.
Definition: TGeoCache.cxx:403
void LocalToMasterVect(const Double_t *local, Double_t *master) const
Local vector converted to master frame defined by current matrix.
Definition: TGeoCache.cxx:419
Int_t GetCurrentNodeId() const
Returns a fixed ID for current physical node.
Definition: TGeoCache.cxx:264
Int_t PushState(Bool_t ovlp, Int_t ntmany=0, Int_t startlevel=0, Double_t *point=0)
Push current state into heap.
Definition: TGeoCache.cxx:357
TGeoNode ** fNodeBranch
Definition: TGeoCache.h:72
TGeoNode * fTop
Definition: TGeoCache.h:66
TString fPath
Definition: TGeoCache.h:65
Int_t fLevel
Definition: TGeoCache.h:59
TGeoNode * fNode
Definition: TGeoCache.h:67
void LocalToMasterBomb(const Double_t *local, Double_t *master) const
Local point converted to master frame defined by current matrix and rescaled with bomb factor.
Definition: TGeoCache.cxx:435
Int_t GetStackLevel() const
Definition: TGeoCache.h:110
void CdUp()
Make mother of current node the active state.
Definition: TGeoCache.cxx:252
void GetBranchNames(Int_t *names) const
Fill names with current branch volume names (4 char - used by GEANT3 interface).
Definition: TGeoCache.cxx:284
TGeoHMatrix * GetCurrentMatrix() const
Definition: TGeoCache.h:99
void FillIdBranch(const Int_t *br, Int_t startlevel=0)
Definition: TGeoCache.h:92
void ReleaseInfo()
Release last used state info pointer.
Definition: TGeoCache.cxx:336
void Refresh()
Definition: TGeoCache.h:125
Int_t fGeoCacheMaxLevels
Definition: TGeoCache.h:56
Bool_t RestoreState(Int_t &nmany, TGeoCacheState *state, Double_t *point=0)
Pop next state/point from a backed-up state.
Definition: TGeoCache.cxx:393
TGeoNode * GetMother(Int_t up=1) const
Definition: TGeoCache.h:101
Int_t GetLevel() const
Definition: TGeoCache.h:108
Int_t fGeoInfoStackSize
Definition: TGeoCache.h:58
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:41
An array of TObjects.
Definition: TObjArray.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:131
Statefull info for the current geometry level.
Definition: TGeoStateInfo.h:21