Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGeoManager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/geom:$Id$
0002 // Author: Andrei Gheata   25/10/01
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGeoManager
0013 #define ROOT_TGeoManager
0014 
0015 #include <mutex>
0016 #include <thread>
0017 #include <map>
0018 
0019 #include "TNamed.h"
0020 #include "TObjArray.h"
0021 #include "TGeoNavigator.h"
0022 
0023 // forward declarations
0024 class TVirtualGeoTrack;
0025 class TGeoNode;
0026 class TGeoPhysicalNode;
0027 class TGeoPNEntry;
0028 class TGeoVolume;
0029 class TGeoVolumeMulti;
0030 class TGeoMatrix;
0031 class TGeoHMatrix;
0032 class TGeoMaterial;
0033 class TGeoMedium;
0034 class TGeoShape;
0035 class TVirtualGeoPainter;
0036 class THashList;
0037 class TGeoParallelWorld;
0038 class TGeoRegion;
0039 class TGDMLMatrix;
0040 class TGeoOpticalSurface;
0041 class TGeoSkinSurface;
0042 class TGeoBorderSurface;
0043 
0044 class TGeoManager : public TNamed {
0045 public:
0046    enum EDefaultUnits { kG4Units = 0, kRootUnits = 1 };
0047 
0048 protected:
0049    static std::mutex fgMutex;           //! mutex for navigator booking in MT mode
0050    static Bool_t fgLock;                //! Lock preventing a second geometry to be loaded
0051    static Int_t fgVerboseLevel;         //! Verbosity level for Info messages (no IO).
0052    static Int_t fgMaxLevel;             //! Maximum level in geometry
0053    static Int_t fgMaxDaughters;         //! Maximum number of daughters
0054    static Int_t fgMaxXtruVert;          //! Maximum number of Xtru vertices
0055    static UInt_t fgExportPrecision;     //! Precision to be used in ASCII exports
0056    static EDefaultUnits fgDefaultUnits; //! Default units in GDML if not explicit in some tags
0057 
0058    TGeoManager(const TGeoManager &) = delete;
0059    TGeoManager &operator=(const TGeoManager &) = delete;
0060 
0061 private:
0062    Double_t fPhimin;                //! lowest range for phi cut
0063    Double_t fPhimax;                //! highest range for phi cut
0064    Double_t fTmin;                  //! lower time limit for tracks drawing
0065    Double_t fTmax;                  //! upper time limit for tracks drawing
0066    Int_t fNNodes;                   // total number of physical nodes
0067    TString fPath;                   //! path to current node
0068    TString fParticleName;           //! particles to be drawn
0069    Double_t fVisDensity;            // transparency threshold by density
0070    Int_t fExplodedView;             // exploded view mode
0071    Int_t fVisOption;                // global visualization option
0072    Int_t fVisLevel;                 // maximum visualization depth
0073    Int_t fNsegments;                // number of segments to approximate circles
0074    Int_t fNtracks;                  // number of tracks
0075    Int_t fMaxVisNodes;              // maximum number of visible nodes
0076    TVirtualGeoTrack *fCurrentTrack; //! current track
0077    Int_t fNpdg;                     // number of different pdg's stored
0078    Int_t fPdgId[1024];              // pdg conversion table
0079    Bool_t fClosed;                  //! flag that geometry is closed
0080    Bool_t fLoopVolumes;             //! flag volume lists loop
0081    Bool_t fStreamVoxels;            // flag to allow voxelization I/O
0082    Bool_t fIsGeomReading;           //! flag set when reading geometry
0083    Bool_t fIsGeomCleaning;          //! flag to notify that the manager is being destructed
0084    Bool_t fPhiCut;                  // flag for phi cuts
0085    Bool_t fTimeCut;                 // time cut for tracks
0086    Bool_t fDrawExtra;               //! flag that the list of physical nodes has to be drawn
0087    Bool_t fMatrixTransform;         //! flag for using GL matrix
0088    Bool_t fMatrixReflection;        //! flag for GL reflections
0089    Bool_t fActivity;                //! switch ON/OFF volume activity (default OFF - all volumes active))
0090    Bool_t fIsNodeSelectable;        //! flag that nodes are the selected objects in pad rather than volumes
0091    TVirtualGeoPainter *fPainter;    //! current painter
0092 
0093    TObjArray *fMatrices;        //-> list of local transformations
0094    TObjArray *fShapes;          //-> list of shapes
0095    TObjArray *fVolumes;         //-> list of volumes
0096    TObjArray *fPhysicalNodes;   //-> list of physical nodes
0097    TObjArray *fGShapes;         //! list of runtime shapes
0098    TObjArray *fGVolumes;        //! list of runtime volumes
0099    TObjArray *fTracks;          //-> list of tracks attached to geometry
0100    TObjArray *fPdgNames;        //-> list of pdg names for tracks
0101    TObjArray *fGDMLMatrices;    //-> list of matrices read from GDML
0102    TObjArray *fOpticalSurfaces; //-> list of optical surfaces read from GDML
0103    TObjArray *fSkinSurfaces;    //-> list of skin surfaces read from GDML
0104    TObjArray *fBorderSurfaces;  //-> list of border surfaces read from GDML
0105    TList *fMaterials;           //-> list of materials
0106    TList *fMedia;               //-> list of tracking media
0107    TObjArray *fNodes;           //-> current branch of nodes
0108    TObjArray *fOverlaps;        //-> list of geometrical overlaps
0109    TObjArray *fRegions;         //-> list of regions
0110    UChar_t *fBits;              //! bits used for voxelization
0111    // Map of navigator arrays per thread
0112    typedef std::map<std::thread::id, TGeoNavigatorArray *> NavigatorsMap_t;
0113    typedef NavigatorsMap_t::iterator NavigatorsMapIt_t;
0114    typedef std::map<std::thread::id, Int_t> ThreadsMap_t;
0115    typedef ThreadsMap_t::const_iterator ThreadsMapIt_t;
0116    // Map of constant properties
0117    typedef std::map<std::string, Double_t> ConstPropMap_t;
0118 
0119    NavigatorsMap_t fNavigators;      //! Map between thread id's and navigator arrays
0120    static ThreadsMap_t *fgThreadId;  //! Thread id's map
0121    static Int_t fgNumThreads;        //! Number of registered threads
0122    static Bool_t fgLockNavigators;   //! Lock existing navigators
0123    TGeoNavigator *fCurrentNavigator; //! current navigator
0124    TGeoVolume *fCurrentVolume;       //! current volume
0125    TGeoVolume *fTopVolume;           //! top level volume in geometry
0126    TGeoNode *fTopNode;               //! top physical node
0127    TGeoVolume *fMasterVolume;        // master volume
0128    TGeoHMatrix *fGLMatrix;           // matrix to be used for view transformations
0129    TObjArray *fUniqueVolumes;        //-> list of unique volumes
0130    TGeoShape *fClippingShape;        //! clipping shape for raytracing
0131    TGeoElementTable *fElementTable;  //! table of elements
0132 
0133    Int_t fNLevel;                     // maximum accepted level in geometry
0134    TGeoVolume *fPaintVolume;          //! volume currently painted
0135    TGeoVolume *fUserPaintVolume;      //!
0136    THashList *fHashVolumes;           //! hash list of volumes providing fast search
0137    THashList *fHashGVolumes;          //! hash list of group volumes providing fast search
0138    THashList *fHashPNE;               //-> hash list of physical node entries
0139    mutable TObjArray *fArrayPNE;      //! array of physical node entries
0140    Int_t fSizePNEId;                  // size of the array of unique ID's for PN entries
0141    Int_t fNPNEId;                     // number of PN entries having a unique ID
0142    Int_t *fKeyPNEId;                  //[fSizePNEId] array of uid values for PN entries
0143    Int_t *fValuePNEId;                //[fSizePNEId] array of pointers to PN entries with ID's
0144    Int_t fMaxThreads;                 //! Max number of threads
0145    Bool_t fMultiThread;               //! Flag for multi-threading
0146    Int_t fRaytraceMode;               //! Raytrace mode: 0=normal, 1=pass through, 2=transparent
0147    Bool_t fUsePWNav;                  // Activate usage of parallel world in navigation
0148    TGeoParallelWorld *fParallelWorld; // Parallel world
0149    ConstPropMap_t fProperties;        // Map of user-defined constant properties
0150                                       //--- private methods
0151    Bool_t IsLoopingVolumes() const { return fLoopVolumes; }
0152    void Init();
0153    Bool_t InitArrayPNE() const;
0154    Bool_t InsertPNEId(Int_t uid, Int_t ientry);
0155    void SetLoopVolumes(Bool_t flag = kTRUE) { fLoopVolumes = flag; }
0156    void UpdateElements();
0157    void Voxelize(Option_t *option = nullptr);
0158 
0159 public:
0160    // constructors
0161    TGeoManager();
0162    TGeoManager(const char *name, const char *title);
0163    // destructor
0164    ~TGeoManager() override;
0165    //--- adding geometrical objects
0166    Int_t AddMaterial(const TGeoMaterial *material);
0167    Int_t AddOverlap(const TNamed *ovlp);
0168    Int_t AddRegion(TGeoRegion *region);
0169    Int_t AddTransformation(const TGeoMatrix *matrix);
0170    Int_t AddShape(const TGeoShape *shape);
0171    Int_t AddTrack(Int_t id, Int_t pdgcode, TObject *particle = nullptr);
0172    Int_t AddTrack(TVirtualGeoTrack *track);
0173    Int_t AddVolume(TGeoVolume *volume);
0174    TGeoNavigator *AddNavigator();
0175    Bool_t AddProperty(const char *property, Double_t value);
0176    Double_t GetProperty(const char *name, Bool_t *error = nullptr) const;
0177    Double_t GetProperty(size_t i, TString &name, Bool_t *error = nullptr) const;
0178    Int_t GetNproperties() const { return fProperties.size(); }
0179    void ClearOverlaps();
0180    void RegisterMatrix(const TGeoMatrix *matrix);
0181    void SortOverlaps();
0182    //--- browsing and tree navigation
0183    void Browse(TBrowser *b) override;
0184    void SetVisibility(TObject *obj, Bool_t vis);
0185    virtual Bool_t cd(const char *path = ""); // *MENU*
0186    Bool_t CheckPath(const char *path) const;
0187    void CdNode(Int_t nodeid);
0188    void CdDown(Int_t index);
0189    void CdUp();
0190    void CdTop();
0191    void CdNext();
0192    void GetBranchNames(Int_t *names) const;
0193    void GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const;
0194    void GetBranchOnlys(Int_t *isonly) const;
0195    Int_t GetNmany() const { return GetCurrentNavigator()->GetNmany(); }
0196    const char *GetPdgName(Int_t pdg) const;
0197    void SetPdgName(Int_t pdg, const char *name);
0198    Bool_t IsFolder() const override { return kTRUE; }
0199    //--- visualization settings
0200    virtual void Edit(Option_t *option = ""); // *MENU*
0201    void BombTranslation(const Double_t *tr, Double_t *bombtr);
0202    void UnbombTranslation(const Double_t *tr, Double_t *bombtr);
0203    void ClearAttributes(); // *MENU*
0204    void DefaultAngles();   // *MENU*
0205    void DefaultColors();   // *MENU*
0206    TGeoShape *GetClippingShape() const { return fClippingShape; }
0207    Int_t GetNsegments() const;
0208    TVirtualGeoPainter *GetGeomPainter();
0209    TVirtualGeoPainter *GetPainter() const { return fPainter; }
0210    Int_t GetBombMode() const { return fExplodedView; }
0211    void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const;
0212    Int_t GetMaxVisNodes() const { return fMaxVisNodes; }
0213    Bool_t GetTminTmax(Double_t &tmin, Double_t &tmax) const;
0214    Double_t GetTmax() const { return fTmax; }
0215    TGeoVolume *GetPaintVolume() const { return fPaintVolume; }
0216    TGeoVolume *GetUserPaintVolume() const { return fUserPaintVolume; }
0217    Double_t GetVisDensity() const { return fVisDensity; }
0218    Int_t GetVisLevel() const;
0219    Int_t GetVisOption() const;
0220    Bool_t IsInPhiRange() const;
0221    Bool_t IsDrawingExtra() const { return fDrawExtra; }
0222    Bool_t IsNodeSelectable() const { return fIsNodeSelectable; }
0223    Bool_t IsVisLeaves() const { return fVisOption == 1; }
0224    void ModifiedPad() const;
0225    void OptimizeVoxels(const char *filename = "tgeovox.C");                                     // *MENU*
0226    void SetClipping(Bool_t flag = kTRUE) { SetClippingShape(flag ? fClippingShape : nullptr); } // *MENU*
0227    void SetClippingShape(TGeoShape *clip);
0228    void SetExplodedView(Int_t iopt = 0); // *MENU*
0229    void SetPhiRange(Double_t phimin = 0., Double_t phimax = 360.);
0230    void SetNsegments(Int_t nseg); // *MENU*
0231    Bool_t SetCurrentNavigator(Int_t index);
0232    void
0233    SetBombFactors(Double_t bombx = 1.3, Double_t bomby = 1.3, Double_t bombz = 1.3, Double_t bombr = 1.3); // *MENU*
0234    void SetPaintVolume(TGeoVolume *vol) { fPaintVolume = vol; }
0235    void SetUserPaintVolume(TGeoVolume *vol) { fUserPaintVolume = vol; }
0236    void SetTopVisible(Bool_t vis = kTRUE);
0237    void SetTminTmax(Double_t tmin = 0, Double_t tmax = 999);
0238    void SetDrawExtraPaths(Bool_t flag = kTRUE) { fDrawExtra = flag; }
0239    void SetNodeSelectable(Bool_t flag = kTRUE) { fIsNodeSelectable = flag; }
0240    void SetVisDensity(Double_t dens = 0.01); // *MENU*
0241    void SetVisLevel(Int_t level = 3);        // *MENU*
0242    void SetVisOption(Int_t option = 0);
0243    void ViewLeaves(Bool_t flag = kTRUE);                    // *TOGGLE* *GETTER=IsVisLeaves
0244    void SaveAttributes(const char *filename = "tgeoatt.C"); // *MENU*
0245    void RestoreMasterVolume();                              // *MENU*
0246    void SetMaxVisNodes(Int_t maxnodes = 10000);             // *MENU*
0247    //--- geometry checking
0248    void AnimateTracks(Double_t tmin = 0, Double_t tmax = 5E-8, Int_t nframes = 200, Option_t *option = "/*"); // *MENU*
0249    void CheckBoundaryErrors(Int_t ntracks = 1000000, Double_t radius = -1.);                                  // *MENU*
0250    void CheckBoundaryReference(Int_t icheck = -1);
0251    void CheckGeometryFull(Int_t ntracks = 1000000, Double_t vx = 0., Double_t vy = 0., Double_t vz = 0.,
0252                           Option_t *option = "ob"); // *MENU*
0253    void CheckGeometry(Option_t *option = "");
0254    void CheckOverlaps(Double_t ovlp = 0.1, Option_t *option = "");                         // *MENU*
0255    void CheckPoint(Double_t x = 0, Double_t y = 0, Double_t z = 0, Option_t *option = "", Double_t safety = 0.); // *MENU*
0256    void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option);
0257    void ConvertReflections();
0258    void DrawCurrentPoint(Int_t color = 2); // *MENU*
0259    void DrawTracks(Option_t *option = ""); // *MENU*
0260    void SetParticleName(const char *pname) { fParticleName = pname; }
0261    const char *GetParticleName() const { return fParticleName.Data(); }
0262    void DrawPath(const char *path, Option_t *option = "");
0263    void PrintOverlaps() const; // *MENU*
0264    void RandomPoints(const TGeoVolume *vol, Int_t npoints = 10000, Option_t *option = "");
0265    void RandomRays(Int_t nrays = 1000, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0,
0266                    const char *target_vol = nullptr, Bool_t check_norm = kFALSE);
0267    TGeoNode *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil = 1E-5, const char *g3path = "");
0268    void SetNmeshPoints(Int_t npoints = 1000);
0269    void SetCheckedNode(TGeoNode *node);
0270    void Test(Int_t npoints = 1000000, Option_t *option = "");           // *MENU*
0271    void TestOverlaps(const char *path = "");                            // *MENU*
0272    Double_t Weight(Double_t precision = 0.01, Option_t *option = "va"); // *MENU*
0273 
0274    //--- GEANT3-like geometry creation
0275    TGeoVolume *Division(const char *name, const char *mother, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step,
0276                         Int_t numed = 0, Option_t *option = "");
0277    void
0278    Matrix(Int_t index, Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3);
0279    TGeoMaterial *Material(const char *name, Double_t a, Double_t z, Double_t dens, Int_t uid, Double_t radlen = 0,
0280                           Double_t intlen = 0);
0281    TGeoMaterial *
0282    Mixture(const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nelem, Float_t *wmat, Int_t uid);
0283    TGeoMaterial *
0284    Mixture(const char *name, Double_t *a, Double_t *z, Double_t dens, Int_t nelem, Double_t *wmat, Int_t uid);
0285    TGeoMedium *Medium(const char *name, Int_t numed, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm,
0286                       Double_t tmaxfd, Double_t stemax, Double_t deemax, Double_t epsil, Double_t stmin);
0287    void Node(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot,
0288              Bool_t isOnly, Float_t *upar, Int_t npar = 0);
0289    void Node(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot,
0290              Bool_t isOnly, Double_t *upar, Int_t npar = 0);
0291    TGeoVolume *Volume(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t npar = 0);
0292    TGeoVolume *Volume(const char *name, const char *shape, Int_t nmed, Double_t *upar, Int_t npar = 0);
0293    void SetVolumeAttribute(const char *name, const char *att, Int_t val);
0294    //--- geometry building
0295    void BuildDefaultMaterials();
0296    void CloseGeometry(Option_t *option = "d");
0297    Bool_t IsClosed() const { return fClosed; }
0298    TGeoVolume *MakeArb8(const char *name, TGeoMedium *medium, Double_t dz, Double_t *vertices = nullptr);
0299    TGeoVolume *MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz);
0300    TGeoVolume *MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1,
0301                         Double_t rmin2, Double_t rmax2);
0302    TGeoVolume *MakeCons(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1,
0303                         Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2);
0304    TGeoVolume *MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1,
0305                         Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
0306    TGeoVolume *MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz);
0307    TGeoVolume *MakeGtra(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t twist,
0308                         Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2,
0309                         Double_t tl2, Double_t alpha2);
0310    TGeoVolume *MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha,
0311                         Double_t theta, Double_t phi);
0312    TGeoVolume *MakePcon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nz);
0313    TGeoVolume *MakeParaboloid(const char *name, TGeoMedium *medium, Double_t rlo, Double_t rhi, Double_t dz);
0314    TGeoVolume *MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout,
0315                         Double_t stout, Double_t dz);
0316    TGeoVolume *MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz);
0317    TGeoVolume *MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin = 0,
0318                           Double_t themax = 180, Double_t phimin = 0, Double_t phimax = 360);
0319    TGeoVolume *MakeTorus(const char *name, TGeoMedium *medium, Double_t r, Double_t rmin, Double_t rmax,
0320                          Double_t phi1 = 0, Double_t dphi = 360);
0321    TGeoVolume *MakeTrap(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t h1,
0322                         Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2,
0323                         Double_t alpha2);
0324    TGeoVolume *MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz);
0325    TGeoVolume *
0326    MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz);
0327    TGeoVolume *MakeTube(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz);
0328    TGeoVolume *MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1,
0329                         Double_t phi2);
0330    TGeoVolume *MakeXtru(const char *name, TGeoMedium *medium, Int_t nz);
0331 
0332    TGeoPNEntry *SetAlignableEntry(const char *unique_name, const char *path, Int_t uid = -1);
0333    TGeoPNEntry *GetAlignableEntry(const char *name) const;
0334    TGeoPNEntry *GetAlignableEntry(Int_t index) const;
0335    TGeoPNEntry *GetAlignableEntryByUID(Int_t uid) const;
0336    Int_t GetNAlignable(Bool_t with_uid = kFALSE) const;
0337    TGeoPhysicalNode *MakeAlignablePN(const char *name);
0338    TGeoPhysicalNode *MakeAlignablePN(TGeoPNEntry *entry);
0339    TGeoPhysicalNode *MakePhysicalNode(const char *path = nullptr);
0340    void ClearPhysicalNodes(Bool_t mustdelete = kFALSE);
0341    void RefreshPhysicalNodes(Bool_t lock = kTRUE);
0342    TVirtualGeoTrack *MakeTrack(Int_t id, Int_t pdgcode, TObject *particle);
0343    TGeoVolumeAssembly *MakeVolumeAssembly(const char *name);
0344    TGeoVolumeMulti *MakeVolumeMulti(const char *name, TGeoMedium *medium);
0345    void SetTopVolume(TGeoVolume *vol);
0346 
0347    //--- geometry queries
0348    TGeoNode *CrossBoundaryAndLocate(Bool_t downwards, TGeoNode *skipnode);
0349    TGeoNode *FindNextBoundary(Double_t stepmax = TGeoShape::Big(), const char *path = "", Bool_t frombdr = kFALSE);
0350    TGeoNode *FindNextDaughterBoundary(Double_t *point, Double_t *dir, Int_t &idaughter, Bool_t compmatrix = kFALSE);
0351    TGeoNode *FindNextBoundaryAndStep(Double_t stepmax = TGeoShape::Big(), Bool_t compsafe = kFALSE);
0352    TGeoNode *FindNode(Bool_t safe_start = kTRUE);
0353    TGeoNode *FindNode(Double_t x, Double_t y, Double_t z);
0354    Double_t *FindNormal(Bool_t forward = kTRUE);
0355    Double_t *FindNormalFast();
0356    TGeoNode *InitTrack(const Double_t *point, const Double_t *dir);
0357    TGeoNode *InitTrack(Double_t x, Double_t y, Double_t z, Double_t nx, Double_t ny, Double_t nz);
0358    void ResetState();
0359    Double_t Safety(Bool_t inside = kFALSE);
0360    TGeoNode *SearchNode(Bool_t downwards = kFALSE, const TGeoNode *skipnode = nullptr);
0361    TGeoNode *Step(Bool_t is_geom = kTRUE, Bool_t cross = kTRUE);
0362    void DisableInactiveVolumes() { fActivity = kTRUE; }
0363    void EnableInactiveVolumes() { fActivity = kFALSE; }
0364    void SetCurrentTrack(Int_t i) { fCurrentTrack = (TVirtualGeoTrack *)fTracks->At(i); }
0365    void SetCurrentTrack(TVirtualGeoTrack *track) { fCurrentTrack = track; }
0366    Int_t GetNtracks() const { return fNtracks; }
0367    TVirtualGeoTrack *GetCurrentTrack() { return fCurrentTrack; }
0368    TVirtualGeoTrack *GetLastTrack()
0369    {
0370       return (TVirtualGeoTrack *)((fNtracks > 0) ? fTracks->At(fNtracks - 1) : nullptr);
0371    }
0372    const Double_t *GetLastPoint() const { return GetCurrentNavigator()->GetLastPoint(); }
0373    TVirtualGeoTrack *GetTrack(Int_t index)
0374    {
0375       return (index < fNtracks) ? (TVirtualGeoTrack *)fTracks->At(index) : nullptr;
0376    }
0377    Int_t GetTrackIndex(Int_t id) const;
0378    TVirtualGeoTrack *GetTrackOfId(Int_t id) const;
0379    TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
0380    TVirtualGeoTrack *GetParentTrackOfId(Int_t id) const;
0381    Int_t GetVirtualLevel();
0382    Bool_t GotoSafeLevel();
0383    Int_t GetSafeLevel() const;
0384    Double_t GetSafeDistance() const { return GetCurrentNavigator()->GetSafeDistance(); }
0385    Double_t GetLastSafety() const { return GetCurrentNavigator()->GetLastSafety(); }
0386    Double_t GetStep() const { return GetCurrentNavigator()->GetStep(); }
0387    void InspectState() const;
0388    Bool_t IsAnimatingTracks() const { return fIsGeomReading; }
0389    Bool_t IsCheckingOverlaps() const { return GetCurrentNavigator()->IsCheckingOverlaps(); }
0390    Bool_t IsMatrixTransform() const { return fMatrixTransform; }
0391    Bool_t IsMatrixReflection() const { return fMatrixReflection; }
0392    Bool_t IsSameLocation(Double_t x, Double_t y, Double_t z, Bool_t change = kFALSE);
0393    Bool_t IsSameLocation() const { return GetCurrentNavigator()->IsSameLocation(); }
0394    Bool_t IsSamePoint(Double_t x, Double_t y, Double_t z) const;
0395    Bool_t IsStartSafe() const { return GetCurrentNavigator()->IsStartSafe(); }
0396    void SetCheckingOverlaps(Bool_t flag = kTRUE) { GetCurrentNavigator()->SetCheckingOverlaps(flag); }
0397    void SetStartSafe(Bool_t flag = kTRUE) { GetCurrentNavigator()->SetStartSafe(flag); }
0398    void SetMatrixTransform(Bool_t on = kTRUE) { fMatrixTransform = on; }
0399    void SetMatrixReflection(Bool_t flag = kTRUE) { fMatrixReflection = flag; }
0400    void SetStep(Double_t step) { GetCurrentNavigator()->SetStep(step); }
0401    Bool_t IsCurrentOverlapping() const { return GetCurrentNavigator()->IsCurrentOverlapping(); }
0402    Bool_t IsEntering() const { return GetCurrentNavigator()->IsEntering(); }
0403    Bool_t IsExiting() const { return GetCurrentNavigator()->IsExiting(); }
0404    Bool_t IsStepEntering() const { return GetCurrentNavigator()->IsStepEntering(); }
0405    Bool_t IsStepExiting() const { return GetCurrentNavigator()->IsStepExiting(); }
0406    Bool_t IsOutside() const { return GetCurrentNavigator()->IsOutside(); }
0407    Bool_t IsOnBoundary() const { return GetCurrentNavigator()->IsOnBoundary(); }
0408    Bool_t IsNullStep() const { return GetCurrentNavigator()->IsNullStep(); }
0409    Bool_t IsActivityEnabled() const { return fActivity; }
0410    void SetOutside(Bool_t flag = kTRUE) { GetCurrentNavigator()->SetOutside(flag); }
0411 
0412    //--- cleaning
0413    void CleanGarbage();
0414    void ClearShape(const TGeoShape *shape);
0415    void ClearTracks()
0416    {
0417       fTracks->Delete();
0418       fNtracks = 0;
0419    }
0420    void ClearNavigators();
0421    void RemoveMaterial(Int_t index);
0422    void RemoveNavigator(const TGeoNavigator *nav);
0423    void ResetUserData();
0424 
0425    //--- utilities
0426    Int_t CountNodes(const TGeoVolume *vol = nullptr, Int_t nlevels = 10000, Int_t option = 0);
0427    void CountLevels();
0428    void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0429    static Int_t Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3);
0430    Int_t ReplaceVolume(TGeoVolume *vorig, TGeoVolume *vnew);
0431    Int_t TransformVolumeToAssembly(const char *vname);
0432    UChar_t *GetBits() { return fBits; }
0433    virtual Int_t GetByteCount(Option_t *option = nullptr);
0434    void SetAllIndex();
0435    static Int_t GetMaxDaughters();
0436    static Int_t GetMaxLevels();
0437    static Int_t GetMaxXtruVert();
0438    Int_t GetMaxThreads() const { return fMaxThreads - 1; }
0439    void SetMaxThreads(Int_t nthreads);
0440    Int_t GetRTmode() const { return fRaytraceMode; }
0441    void SetRTmode(Int_t mode); // *MENU*
0442    Bool_t IsMultiThread() const { return fMultiThread; }
0443    static void SetNavigatorsLock(Bool_t flag);
0444    static Int_t ThreadId();
0445    static Int_t GetNumThreads();
0446    static void ClearThreadsMap();
0447    void ClearThreadData() const;
0448    void CreateThreadData() const;
0449 
0450    //--- I/O
0451    virtual Int_t Export(const char *filename, const char *name = "", Option_t *option = "vg");
0452    static void LockGeometry();
0453    static void UnlockGeometry();
0454    static Int_t GetVerboseLevel();
0455    static void SetVerboseLevel(Int_t vl);
0456    static TGeoManager *Import(const char *filename, const char *name = "", Option_t *option = "");
0457    static Bool_t IsLocked();
0458    static void SetExportPrecision(UInt_t prec);
0459    static UInt_t GetExportPrecision();
0460    static void SetDefaultUnits(EDefaultUnits new_value);
0461    static EDefaultUnits GetDefaultUnits();
0462    static Bool_t LockDefaultUnits(Bool_t new_value);
0463    Bool_t IsStreamingVoxels() const { return fStreamVoxels; }
0464    Bool_t IsCleaning() const { return fIsGeomCleaning; }
0465 
0466    //--- list getters
0467    TObjArray *GetListOfNodes() { return fNodes; }
0468    TObjArray *GetListOfPhysicalNodes() { return fPhysicalNodes; }
0469    TObjArray *GetListOfOverlaps() { return fOverlaps; }
0470    TObjArray *GetListOfMatrices() const { return fMatrices; }
0471    TList *GetListOfMaterials() const { return fMaterials; }
0472    TList *GetListOfMedia() const { return fMedia; }
0473    TObjArray *GetListOfVolumes() const { return fVolumes; }
0474    TObjArray *GetListOfGVolumes() const { return fGVolumes; }
0475    TObjArray *GetListOfShapes() const { return fShapes; }
0476    TObjArray *GetListOfGShapes() const { return fGShapes; }
0477    TObjArray *GetListOfUVolumes() const { return fUniqueVolumes; }
0478    TObjArray *GetListOfTracks() const { return fTracks; }
0479    TObjArray *GetListOfGDMLMatrices() const { return fGDMLMatrices; }
0480    TObjArray *GetListOfOpticalSurfaces() const { return fOpticalSurfaces; }
0481    TObjArray *GetListOfSkinSurfaces() const { return fSkinSurfaces; }
0482    TObjArray *GetListOfBorderSurfaces() const { return fBorderSurfaces; }
0483    TObjArray *GetListOfRegions() const { return fRegions; }
0484    TGeoNavigatorArray *GetListOfNavigators() const;
0485    TGeoElementTable *GetElementTable();
0486 
0487    //--- modeler state getters/setters
0488    void DoBackupState();
0489    void DoRestoreState();
0490    TGeoNode *GetNode(Int_t level) const { return (TGeoNode *)fNodes->UncheckedAt(level); }
0491    Int_t GetNodeId() const { return GetCurrentNavigator()->GetNodeId(); }
0492    TGeoNode *GetNextNode() const { return GetCurrentNavigator()->GetNextNode(); }
0493    TGeoNode *GetMother(Int_t up = 1) const { return GetCurrentNavigator()->GetMother(up); }
0494    TGeoHMatrix *GetMotherMatrix(Int_t up = 1) const { return GetCurrentNavigator()->GetMotherMatrix(up); }
0495    TGeoHMatrix *GetHMatrix();
0496    TGeoHMatrix *GetCurrentMatrix() const { return GetCurrentNavigator()->GetCurrentMatrix(); }
0497    TGeoHMatrix *GetGLMatrix() const { return fGLMatrix; }
0498    TGeoNavigator *GetCurrentNavigator() const;
0499    TGeoNode *GetCurrentNode() const { return GetCurrentNavigator()->GetCurrentNode(); }
0500    Int_t GetCurrentNodeId() const;
0501    const Double_t *GetCurrentPoint() const { return GetCurrentNavigator()->GetCurrentPoint(); }
0502    const Double_t *GetCurrentDirection() const { return GetCurrentNavigator()->GetCurrentDirection(); }
0503    TGeoVolume *GetCurrentVolume() const { return GetCurrentNavigator()->GetCurrentVolume(); }
0504    const Double_t *GetCldirChecked() const { return GetCurrentNavigator()->GetCldirChecked(); }
0505    const Double_t *GetCldir() const { return GetCurrentNavigator()->GetCldir(); }
0506    const Double_t *GetNormal() const { return GetCurrentNavigator()->GetNormal(); }
0507    Int_t GetLevel() const { return GetCurrentNavigator()->GetLevel(); }
0508    Int_t GetMaxLevel() const { return fNLevel; }
0509    const char *GetPath() const;
0510    Int_t GetStackLevel() const { return GetCurrentNavigator()->GetStackLevel(); }
0511    TGeoVolume *GetMasterVolume() const { return fMasterVolume; }
0512    TGeoVolume *GetTopVolume() const { return fTopVolume; }
0513    TGeoNode *GetTopNode() const { return fTopNode; }
0514    TGeoPhysicalNode *GetPhysicalNode(Int_t i) const { return (TGeoPhysicalNode *)fPhysicalNodes->UncheckedAt(i); }
0515    void SetCurrentPoint(Double_t *point) { GetCurrentNavigator()->SetCurrentPoint(point); }
0516    void SetCurrentPoint(Double_t x, Double_t y, Double_t z) { GetCurrentNavigator()->SetCurrentPoint(x, y, z); }
0517    void SetLastPoint(Double_t x, Double_t y, Double_t z) { GetCurrentNavigator()->SetLastPoint(x, y, z); }
0518    void SetCurrentDirection(Double_t *dir) { GetCurrentNavigator()->SetCurrentDirection(dir); }
0519    void SetCurrentDirection(Double_t nx, Double_t ny, Double_t nz)
0520    {
0521       GetCurrentNavigator()->SetCurrentDirection(nx, ny, nz);
0522    }
0523    void SetCldirChecked(Double_t *dir) { GetCurrentNavigator()->SetCldirChecked(dir); }
0524 
0525    //--- point/vector reference frame conversion
0526    void LocalToMaster(const Double_t *local, Double_t *master) const
0527    {
0528       GetCurrentNavigator()->LocalToMaster(local, master);
0529    }
0530    void LocalToMasterVect(const Double_t *local, Double_t *master) const
0531    {
0532       GetCurrentNavigator()->LocalToMasterVect(local, master);
0533    }
0534    void LocalToMasterBomb(const Double_t *local, Double_t *master) const
0535    {
0536       GetCurrentNavigator()->LocalToMasterBomb(local, master);
0537    }
0538    void MasterToLocal(const Double_t *master, Double_t *local) const
0539    {
0540       GetCurrentNavigator()->MasterToLocal(master, local);
0541    }
0542    void MasterToLocalVect(const Double_t *master, Double_t *local) const
0543    {
0544       GetCurrentNavigator()->MasterToLocalVect(master, local);
0545    }
0546    void MasterToLocalBomb(const Double_t *master, Double_t *local) const
0547    {
0548       GetCurrentNavigator()->MasterToLocalBomb(master, local);
0549    }
0550    void MasterToTop(const Double_t *master, Double_t *top) const;
0551    void TopToMaster(const Double_t *top, Double_t *master) const;
0552 
0553    //--- general use getters/setters
0554    TGeoMaterial *FindDuplicateMaterial(const TGeoMaterial *mat) const;
0555    TGeoVolume *FindVolumeFast(const char *name, Bool_t multi = kFALSE);
0556    TGeoMaterial *GetMaterial(const char *matname) const;
0557    TGeoMaterial *GetMaterial(Int_t id) const;
0558    TGeoMedium *GetMedium(const char *medium) const;
0559    TGeoMedium *GetMedium(Int_t numed) const;
0560    Int_t GetMaterialIndex(const char *matname) const;
0561 
0562    //--- GDML object accessors
0563    TGDMLMatrix *GetGDMLMatrix(const char *name) const;
0564    void AddGDMLMatrix(TGDMLMatrix *mat);
0565    TGeoOpticalSurface *GetOpticalSurface(const char *name) const;
0566    void AddOpticalSurface(TGeoOpticalSurface *optsurf);
0567    TGeoSkinSurface *GetSkinSurface(const char *name) const;
0568    void AddSkinSurface(TGeoSkinSurface *surf);
0569    TGeoBorderSurface *GetBorderSurface(const char *name) const;
0570    void AddBorderSurface(TGeoBorderSurface *surf);
0571 
0572    //   TGeoShape             *GetShape(const char *name) const;
0573    TGeoVolume *GetVolume(const char *name) const;
0574    TGeoVolume *GetVolume(Int_t uid) const { return (TGeoVolume *)fUniqueVolumes->At(uid); }
0575    int GetNregions() const { return fRegions->GetEntriesFast(); }
0576    TGeoRegion *GetRegion(int i) { return (TGeoRegion *)fRegions->At(i); }
0577    Int_t GetUID(const char *volname) const;
0578    Int_t GetNNodes()
0579    {
0580       if (!fNNodes)
0581          CountNodes();
0582       return fNNodes;
0583    }
0584    TGeoNodeCache *GetCache() const { return GetCurrentNavigator()->GetCache(); }
0585    //   void                   SetCache(const TGeoNodeCache *cache) {fCache = (TGeoNodeCache*)cache;}
0586    void SetAnimateTracks(Bool_t flag = kTRUE) { fIsGeomReading = flag; }
0587    virtual ULong_t SizeOf(const TGeoNode *node, Option_t *option); // size of the geometry in memory
0588    void SelectTrackingMedia();
0589 
0590    //--- stack manipulation
0591    Int_t PushPath(Int_t startlevel = 0) { return GetCurrentNavigator()->PushPath(startlevel); }
0592    Bool_t PopPath() { return GetCurrentNavigator()->PopPath(); }
0593    Bool_t PopPath(Int_t index) { return GetCurrentNavigator()->PopPath(index); }
0594    Int_t PushPoint(Int_t startlevel = 0) { return GetCurrentNavigator()->PushPoint(startlevel); }
0595    Bool_t PopPoint() { return GetCurrentNavigator()->PopPoint(); }
0596    Bool_t PopPoint(Int_t index) { return GetCurrentNavigator()->PopPoint(index); }
0597    void PopDummy(Int_t ipop = 9999) { return GetCurrentNavigator()->PopDummy(ipop); }
0598 
0599    //--- parallel world navigation
0600    TGeoParallelWorld *CreateParallelWorld(const char *name);
0601    TGeoParallelWorld *GetParallelWorld() const { return fParallelWorld; }
0602    void SetUseParallelWorldNav(Bool_t flag);
0603    Bool_t IsParallelWorldNav() const { return fUsePWNav; }
0604 
0605    ClassDefOverride(TGeoManager, 17) // geometry manager
0606 };
0607 
0608 R__EXTERN TGeoManager *gGeoManager;
0609 
0610 #endif