Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:30:26

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