Logo ROOT  
Reference Guide
TGeoManager.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 25/10/01
3 
4 /*************************************************************************
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 
12 /** \class TGeoManager
13 \ingroup Geometry_classes
14 
15 The manager class for any TGeo geometry. Provides user
16 interface for geometry creation, navigation, state querying,
17 visualization, IO, geometry checking and other utilities.
18 
19 ## General architecture
20 
21  The ROOT geometry package is a tool designed for building, browsing,
22 tracking and visualizing a detector geometry. The code is independent from
23 other external MC for simulation, therefore it does not contain any
24 constraints related to physics. However, the package defines a number of
25 hooks for tracking, such as media, materials, magnetic field or track state flags,
26 in order to allow interfacing to tracking MC's. The final goal is to be
27 able to use the same geometry for several purposes, such as tracking,
28 reconstruction or visualization, taking advantage of the ROOT features
29 related to bookkeeping, I/O, histogramming, browsing and GUI's.
30 
31  The geometrical modeler is the most important component of the package and
32 it provides answers to the basic questions like "Where am I ?" or "How far
33 from the next boundary ?", but also to more complex ones like "How far from
34 the closest surface ?" or "Which is the next crossing along a helix ?".
35 
36  The architecture of the modeler is a combination between a GEANT-like
37 containment scheme and a normal CSG binary tree at the level of shapes. An
38 important common feature of all detector geometry descriptions is the
39 mother-daughter concept. This is the most natural approach when tracking
40 is concerned and imposes a set of constraints to the way geometry is defined.
41 Constructive solid geometry composition is used only in order to create more
42 complex shapes from an existing set of primitives through boolean operations.
43 This feature is not implemented yet but in future full definition of boolean
44 expressions will be supported.
45 
46  Practically every geometry defined in GEANT style can be mapped by the modeler.
47 The basic components used for building the logical hierarchy of the geometry
48 are called "volumes" and "nodes". Volumes (sometimes called "solids") are fully
49 defined geometrical objects having a given shape and medium and possibly
50 containing a list of nodes. Nodes represent just positioned instances of volumes
51 inside a container volume and they are not directly defined by user. They are
52 automatically created as a result of adding one volume inside other or dividing
53 a volume. The geometrical transformation hold by nodes is always defined with
54 respect to their mother (relative positioning). Reflection matrices are allowed.
55 All volumes have to be fully aware of their containees when the geometry is
56 closed. They will build additional structures (voxels) in order to fasten-up
57 the search algorithms. Finally, nodes can be regarded as bidirectional links
58 between containers and containees objects.
59 
60  The structure defined in this way is a graph structure since volumes are
61 replicable (same volume can become daughter node of several other volumes),
62 every volume becoming a branch in this graph. Any volume in the logical graph
63 can become the actual top volume at run time (see TGeoManager::SetTopVolume()).
64 All functionalities of the modeler will behave in this case as if only the
65 corresponding branch starting from this volume is the registered geometry.
66 
67 \image html geom_graf.jpg
68 
69  A given volume can be positioned several times in the geometry. A volume
70 can be divided according default or user-defined patterns, creating automatically
71 the list of division nodes inside. The elementary volumes created during the
72 dividing process follow the same scheme as usual volumes, therefore it is possible
73 to position further geometrical structures inside or to divide them further more
74 (see TGeoVolume::Divide()).
75 
76  The primitive shapes supported by the package are basically the GEANT3
77 shapes (see class TGeoShape), arbitrary wedges with eight vertices on two parallel
78 planes. All basic primitives inherits from class TGeoBBox since the bounding box
79 of a solid is essential for the tracking algorithms. They also implement the
80 virtual methods defined in the virtual class TGeoShape (point and segment
81 classification). User-defined primitives can be directly plugged into the modeler
82 provided that they override these methods. Composite shapes will be soon supported
83 by the modeler. In order to build a TGeoCompositeShape, one will have to define
84 first the primitive components. The object that handle boolean
85 operations among components is called TGeoBoolCombinator and it has to be
86 constructed providing a string boolean expression between the components names.
87 
88 
89 ## Example for building a simple geometry
90 
91 Begin_Macro(source)
92 ../../../tutorials/geom/rootgeom.C
93 End_Macro
94 
95 ## TGeoManager - the manager class for the geometry package.
96 
97  TGeoManager class is embedding all the API needed for building and tracking
98 a geometry. It defines a global pointer (gGeoManager) in order to be fully
99 accessible from external code. The mechanism of handling multiple geometries
100 at the same time will be soon implemented.
101 
102  TGeoManager is the owner of all geometry objects defined in a session,
103 therefore users must not try to control their deletion. It contains lists of
104 media, materials, transformations, shapes and volumes. Logical nodes (positioned
105 volumes) are created and destroyed by the TGeoVolume class. Physical
106 nodes and their global transformations are subjected to a caching mechanism
107 due to the sometimes very large memory requirements of logical graph expansion.
108 The caching mechanism is triggered by the total number of physical instances
109 of volumes and the cache manager is a client of TGeoManager. The manager class
110 also controls the painter client. This is linked with ROOT graphical libraries
111 loaded on demand in order to control visualization actions.
112 
113 ## Rules for building a valid geometry
114 
115  A given geometry can be built in various ways, but there are mandatory steps
116 that have to be followed in order to be validated by the modeler. There are
117 general rules : volumes needs media and shapes in order to be created,
118 both container and containee volumes must be created before linking them together,
119 and the relative transformation matrix must be provided. All branches must
120 have an upper link point otherwise they will not be considered as part of the
121 geometry. Visibility or tracking properties of volumes can be provided both
122 at build time or after geometry is closed, but global visualization settings
123 (see TGeoPainter class) should not be provided at build time, otherwise the
124 drawing package will be loaded. There is also a list of specific rules :
125 positioned daughters should not extrude their mother or intersect with sisters
126 unless this is specified (see TGeoVolume::AddNodeOverlap()), the top volume
127 (containing all geometry tree) must be specified before closing the geometry
128 and must not be positioned - it represents the global reference frame. After
129 building the full geometry tree, the geometry must be closed
130 (see TGeoManager::CloseGeometry()). Voxelization can be redone per volume after
131 this process.
132 
133 
134  Below is the general scheme of the manager class.
135 
136 \image html geom_mgr.jpg
137 
138 ## An interactive session
139 
140  Provided that a geometry was successfully built and closed (for instance the
141 previous example $ROOTSYS/tutorials/geom/rootgeom.C ), the manager class will register
142 itself to ROOT and the logical/physical structures will become immediately browsable.
143 The ROOT browser will display starting from the geometry folder : the list of
144 transformations and media, the top volume and the top logical node. These last
145 two can be fully expanded, any intermediate volume/node in the browser being subject
146 of direct access context menu operations (right mouse button click). All user
147 utilities of classes TGeoManager, TGeoVolume and TGeoNode can be called via the
148 context menu.
149 
150 \image html geom_browser.jpg
151 
152 ### Drawing the geometry
153 
154  Any logical volume can be drawn via TGeoVolume::Draw() member function.
155 This can be directly accessed from the context menu of the volume object
156 directly from the browser.
157  There are several drawing options that can be set with
158 TGeoManager::SetVisOption(Int_t opt) method :
159 
160 #### opt=0
161  only the content of the volume is drawn, N levels down (default N=3).
162  This is the default behavior. The number of levels to be drawn can be changed
163  via TGeoManager::SetVisLevel(Int_t level) method.
164 
165 \image html geom_frame0.jpg
166 
167 #### opt=1
168  the final leaves (e.g. daughters with no containment) of the branch
169  starting from volume are drawn down to the current number of levels.
170  WARNING : This mode is memory consuming
171  depending of the size of geometry, so drawing from top level within this mode
172  should be handled with care for expensive geometries. In future there will be
173  a limitation on the maximum number of nodes to be visualized.
174 
175 \image html geom_frame1.jpg
176 
177 #### opt=2
178  only the clicked volume is visualized. This is automatically set by
179  TGeoVolume::DrawOnly() method
180 
181 #### opt=3 - only a given path is visualized. This is automatically set by
182  TGeoVolume::DrawPath(const char *path) method
183 
184  The current view can be exploded in cartesian, cylindrical or spherical
185 coordinates :
186  TGeoManager::SetExplodedView(Int_t opt). Options may be :
187 - 0 - default (no bombing)
188 - 1 - cartesian coordinates. The bomb factor on each axis can be set with
189  TGeoManager::SetBombX(Double_t bomb) and corresponding Y and Z.
190 - 2 - bomb in cylindrical coordinates. Only the bomb factors on Z and R
191  are considered
192  \image html geom_frameexp.jpg
193 
194 - 3 - bomb in radial spherical coordinate : TGeoManager::SetBombR()
195 
196 Volumes themselves support different visualization settings :
197  - TGeoVolume::SetVisibility() : set volume visibility.
198  - TGeoVolume::VisibleDaughters() : set daughters visibility.
199 All these actions automatically updates the current view if any.
200 
201 ### Checking the geometry
202 
203  Several checking methods are accessible from the volume context menu. They
204 generally apply only to the visible parts of the drawn geometry in order to
205 ease geometry checking, and their implementation is in the TGeoChecker class
206 from the painting package.
207 
208 #### Checking a given point.
209  Can be called from TGeoManager::CheckPoint(Double_t x, Double_t y, Double_t z).
210 This method is drawing the daughters of the volume containing the point one
211 level down, printing the path to the deepest physical node holding this point.
212 It also computes the closest distance to any boundary. The point will be drawn
213 in red.
214 
215 \image html geom_checkpoint.jpg
216 
217 #### Shooting random points.
218  Can be called from TGeoVolume::RandomPoints() (context menu function) and
219 it will draw this volume with current visualization settings. Random points
220 are generated in the bounding box of the top drawn volume. The points are
221 classified and drawn with the color of their deepest container. Only points
222 in visible nodes will be drawn.
223 
224 \image html geom_random1.jpg
225 
226 
227 #### Raytracing.
228  Can be called from TGeoVolume::RandomRays() (context menu of volumes) and
229 will shoot rays from a given point in the local reference frame with random
230 directions. The intersections with displayed nodes will appear as segments
231 having the color of the touched node. Drawn geometry will be then made invisible
232 in order to enhance rays.
233 
234 \image html geom_random2.jpg
235 */
236 
237 #include <cstdlib>
238 #include <iostream>
239 #include <fstream>
240 
241 #include "TROOT.h"
242 #include "TGeoManager.h"
243 #include "TStyle.h"
244 #include "TVirtualPad.h"
245 #include "TBrowser.h"
246 #include "TFile.h"
247 #include "TKey.h"
248 #include "THashList.h"
249 #include "TClass.h"
250 #include "ThreadLocalStorage.h"
251 #include "TBufferText.h"
252 
253 #include "TGeoVoxelFinder.h"
254 #include "TGeoElement.h"
255 #include "TGeoMaterial.h"
256 #include "TGeoMedium.h"
257 #include "TGeoMatrix.h"
258 #include "TGeoNode.h"
259 #include "TGeoPhysicalNode.h"
260 #include "TGeoPara.h"
261 #include "TGeoParaboloid.h"
262 #include "TGeoTube.h"
263 #include "TGeoEltu.h"
264 #include "TGeoHype.h"
265 #include "TGeoCone.h"
266 #include "TGeoSphere.h"
267 #include "TGeoArb8.h"
268 #include "TGeoPgon.h"
269 #include "TGeoTrd1.h"
270 #include "TGeoTrd2.h"
271 #include "TGeoTorus.h"
272 #include "TGeoXtru.h"
273 #include "TGeoCompositeShape.h"
274 #include "TGeoBoolNode.h"
275 #include "TGeoBuilder.h"
276 #include "TVirtualGeoPainter.h"
277 #include "TPluginManager.h"
278 #include "TVirtualGeoTrack.h"
279 #include "TQObject.h"
280 #include "TMath.h"
281 #include "TEnv.h"
282 #include "TGeoParallelWorld.h"
283 #include "TGeoRegion.h"
284 #include "TGDMLMatrix.h"
285 #include "TGeoOpticalSurface.h"
286 
287 // statics and globals
288 
290 
292 
293 std::mutex TGeoManager::fgMutex;
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 /// Default constructor.
307 
309 {
312  fTimeCut = kFALSE;
313  fTmin = 0.;
314  fTmax = 999.;
315  fPhiCut = kFALSE;
316  fPhimin = 0;
317  fPhimax = 360;
318  fDrawExtra = kFALSE;
322  fClosed = kFALSE;
324  fBits = 0;
325  fCurrentNavigator = 0;
326  fMaterials = 0;
327  fHashPNE = 0;
328  fArrayPNE = 0;
329  fMatrices = 0;
330  fNodes = 0;
331  fOverlaps = 0;
332  fRegions = 0;
333  fNNodes = 0;
334  fMaxVisNodes = 10000;
335  fVolumes = 0;
336  fPhysicalNodes = 0;
337  fShapes = 0;
338  fGVolumes = 0;
339  fGShapes = 0;
340  fTracks = 0;
341  fMedia = 0;
342  fNtracks = 0;
343  fNpdg = 0;
344  fPdgNames = 0;
345  fGDMLMatrices = 0;
346  fOpticalSurfaces = 0;
347  fSkinSurfaces = 0;
348  fBorderSurfaces = 0;
349  memset(fPdgId, 0, 1024*sizeof(Int_t));
350 // TObjArray *fNavigators; //! list of navigators
351  fCurrentTrack = 0;
352  fCurrentVolume = 0;
353  fTopVolume = 0;
354  fTopNode = 0;
355  fMasterVolume = 0;
356  fPainter = 0;
357  fActivity = kFALSE;
359  fVisDensity = 0.;
360  fVisLevel = 3;
361  fVisOption = 1;
362  fExplodedView = 0;
363  fNsegments = 20;
364  fNLevel = 0;
365  fUniqueVolumes = 0;
366  fClippingShape = 0;
369  fGLMatrix = 0;
370  fPaintVolume = 0;
371  fUserPaintVolume = 0;
372  fElementTable = 0;
373  fHashVolumes = 0;
374  fHashGVolumes = 0;
375  fSizePNEId = 0;
376  fNPNEId = 0;
377  fKeyPNEId = 0;
378  fValuePNEId = 0;
380  fRaytraceMode = 0;
381  fMaxThreads = 0;
382  fUsePWNav = kFALSE;
383  fParallelWorld = 0;
384  ClearThreadsMap();
385  } else {
386  Init();
389  }
390 }
391 
392 ////////////////////////////////////////////////////////////////////////////////
393 /// Constructor.
394 
395 TGeoManager::TGeoManager(const char *name, const char *title)
396  :TNamed(name, title)
397 {
398  if (!gROOT->GetListOfGeometries()->FindObject(this)) gROOT->GetListOfGeometries()->Add(this);
399  if (!gROOT->GetListOfBrowsables()->FindObject(this)) gROOT->GetListOfBrowsables()->Add(this);
400  Init();
401  gGeoIdentity = new TGeoIdentity("Identity");
403  if (fgVerboseLevel>0) Info("TGeoManager","Geometry %s, %s created", GetName(), GetTitle());
404 }
405 
406 ////////////////////////////////////////////////////////////////////////////////
407 /// Initialize manager class.
408 
410 {
411  if (gGeoManager) {
412  Warning("Init","Deleting previous geometry: %s/%s",gGeoManager->GetName(),gGeoManager->GetTitle());
413  delete gGeoManager;
414  if (fgLock) Fatal("Init", "New geometry created while the old one locked !!!");
415  }
416 
417  gGeoManager = this;
419  fTimeCut = kFALSE;
420  fTmin = 0.;
421  fTmax = 999.;
422  fPhiCut = kFALSE;
423  fPhimin = 0;
424  fPhimax = 360;
425  fDrawExtra = kFALSE;
429  fClosed = kFALSE;
431  fBits = new UChar_t[50000]; // max 25000 nodes per volume
432  fCurrentNavigator = 0;
433  fHashPNE = new THashList(256,3);
434  fArrayPNE = 0;
435  fMaterials = new THashList(200,3);
436  fMatrices = new TObjArray(256);
437  fNodes = new TObjArray(30);
438  fOverlaps = new TObjArray(256);
439  fRegions = new TObjArray(256);
440  fNNodes = 0;
441  fMaxVisNodes = 10000;
442  fVolumes = new TObjArray(256);
443  fPhysicalNodes = new TObjArray(256);
444  fShapes = new TObjArray(256);
445  fGVolumes = new TObjArray(256);
446  fGShapes = new TObjArray(256);
447  fTracks = new TObjArray(256);
448  fMedia = new THashList(200,3);
449  fNtracks = 0;
450  fNpdg = 0;
451  fPdgNames = 0;
452  fGDMLMatrices = new TObjArray();
453  fOpticalSurfaces = new TObjArray();
454  fSkinSurfaces = new TObjArray();
455  fBorderSurfaces = new TObjArray();
456  memset(fPdgId, 0, 1024*sizeof(Int_t));
457  fCurrentTrack = 0;
458  fCurrentVolume = 0;
459  fTopVolume = 0;
460  fTopNode = 0;
461  fMasterVolume = 0;
462  fPainter = 0;
463  fActivity = kFALSE;
465  fVisDensity = 0.;
466  fVisLevel = 3;
467  fVisOption = 1;
468  fExplodedView = 0;
469  fNsegments = 20;
470  fNLevel = 0;
471  fUniqueVolumes = new TObjArray(256);
472  fClippingShape = 0;
475  fGLMatrix = new TGeoHMatrix();
476  fPaintVolume = 0;
477  fUserPaintVolume = 0;
478  fElementTable = 0;
479  fHashVolumes = 0;
480  fHashGVolumes = 0;
481  fSizePNEId = 0;
482  fNPNEId = 0;
483  fKeyPNEId = 0;
484  fValuePNEId = 0;
486  fRaytraceMode = 0;
487  fMaxThreads = 0;
488  fUsePWNav = kFALSE;
489  fParallelWorld = 0;
490  ClearThreadsMap();
491 }
492 
493 ////////////////////////////////////////////////////////////////////////////////
494 /// Destructor
495 
497 {
498  if (gGeoManager != this) gGeoManager = this;
500 
501  if (gROOT->GetListOfFiles()) { //in case this function is called from TROOT destructor
502  gROOT->GetListOfGeometries()->Remove(this);
503  gROOT->GetListOfBrowsables()->Remove(this);
504  }
505 // TSeqCollection *brlist = gROOT->GetListOfBrowsers();
506 // TIter next(brlist);
507 // TBrowser *browser = 0;
508 // while ((browser=(TBrowser*)next())) browser->RecursiveRemove(this);
509  ClearThreadsMap();
510  ClearThreadData();
511  delete TGeoBuilder::Instance(this);
512  if (fBits) delete [] fBits;
519  if (fMedia) {fMedia->Delete(); SafeDelete(fMedia);}
523  if (fArrayPNE) {delete fArrayPNE;}
525  if (fShapes) {fShapes->Delete(); SafeDelete( fShapes );}
528  if (fTracks) {fTracks->Delete(); SafeDelete( fTracks );}
535  ClearNavigators();
536  CleanGarbage();
537  SafeDelete( fPainter );
539  if (fSizePNEId) {
540  delete [] fKeyPNEId;
541  delete [] fValuePNEId;
542  }
543  delete fParallelWorld;
545  gGeoIdentity = 0;
546  gGeoManager = 0;
547 }
548 
549 ////////////////////////////////////////////////////////////////////////////////
550 /// Add a material to the list. Returns index of the material in list.
551 
553 {
554  return TGeoBuilder::Instance(this)->AddMaterial((TGeoMaterial*)material);
555 }
556 
557 ////////////////////////////////////////////////////////////////////////////////
558 /// Add an illegal overlap/extrusion to the list.
559 
561 {
562  Int_t size = fOverlaps->GetEntriesFast();
563  fOverlaps->Add((TObject*)ovlp);
564  return size;
565 }
566 
567 ////////////////////////////////////////////////////////////////////////////////
568 /// Add a new region of volumes.
570 {
571  Int_t size = fRegions->GetEntriesFast();
572  fRegions->Add(region);
573  return size;
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Add a user-defined property. Returns true if added, false if existing.
578 
579 Bool_t TGeoManager::AddProperty(const char* property, Double_t value)
580 {
581  auto pos = fProperties.insert(ConstPropMap_t::value_type(property, value));
582  if (!pos.second) {
583  Warning("AddProperty", "Property \"%s\" already exists with value %g", property, (pos.first)->second);
584  return false;
585  }
586  return true;
587 }
588 
589 ////////////////////////////////////////////////////////////////////////////////
590 /// Get a user-defined property
591 
592 Double_t TGeoManager::GetProperty(const char *property, Bool_t *error) const
593 {
594  auto pos = fProperties.find(property);
595  if (pos == fProperties.end()) {
596  if (error) *error = kTRUE;
597  return 0.;
598  }
599  if (error) *error = kFALSE;
600  return pos->second;
601 }
602 
603 ////////////////////////////////////////////////////////////////////////////////
604 /// Get a user-defined property from a given index
605 
607 {
608  // This is a quite inefficient way to access map elements, but needed for the GDML writer to
609  if (i >= fProperties.size()) {
610  if (error) *error = kTRUE;
611  return 0.;
612  }
613  size_t pos = 0;
614  auto it = fProperties.begin();
615  while (pos < i) { ++it; ++pos; }
616  if (error) *error = kFALSE;
617  name = (*it).first;
618  return (*it).second;
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 /// Add a matrix to the list. Returns index of the matrix in list.
623 
625 {
626  return TGeoBuilder::Instance(this)->AddTransformation((TGeoMatrix*)matrix);
627 }
628 
629 ////////////////////////////////////////////////////////////////////////////////
630 /// Add a shape to the list. Returns index of the shape in list.
631 
633 {
634  return TGeoBuilder::Instance(this)->AddShape((TGeoShape*)shape);
635 }
636 
637 ////////////////////////////////////////////////////////////////////////////////
638 /// Add a track to the list of tracks. Use this for primaries only. For secondaries,
639 /// add them to the parent track. The method create objects that are registered
640 /// to the analysis manager but have to be cleaned-up by the user via ClearTracks().
641 
643 {
644  Int_t index = fNtracks;
645  fTracks->AddAtAndExpand(GetGeomPainter()->AddTrack(id,pdgcode,particle),fNtracks++);
646  return index;
647 }
648 
649 ////////////////////////////////////////////////////////////////////////////////
650 /// Add a track to the list of tracks
651 
653 {
654  Int_t index = fNtracks;
655  fTracks->AddAtAndExpand(track,fNtracks++);
656  return index;
657 }
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Makes a primary track but do not attach it to the list of tracks. The track
661 /// can be attached as daughter to another one with TVirtualGeoTrack::AddTrack
662 
664 {
665  TVirtualGeoTrack *track = GetGeomPainter()->AddTrack(id,pdgcode,particle);
666  return track;
667 }
668 
669 ////////////////////////////////////////////////////////////////////////////////
670 /// Add a volume to the list. Returns index of the volume in list.
671 
673 {
674  if (!volume) {
675  Error("AddVolume", "invalid volume");
676  return -1;
677  }
679  if (!uid) uid++;
680  if (!fCurrentVolume) {
681  fCurrentVolume = volume;
682  fUniqueVolumes->AddAtAndExpand(volume,uid);
683  } else {
684  if (!strcmp(volume->GetName(), fCurrentVolume->GetName())) {
685  uid = fCurrentVolume->GetNumber();
686  } else {
687  fCurrentVolume = volume;
688  Int_t olduid = GetUID(volume->GetName());
689  if (olduid<0) {
690  fUniqueVolumes->AddAtAndExpand(volume,uid);
691  } else {
692  uid = olduid;
693  }
694  }
695  }
696  volume->SetNumber(uid);
697  if (!fHashVolumes) {
698  fHashVolumes = new THashList(256);
699  fHashGVolumes = new THashList(256);
700  }
701  TObjArray *list = fVolumes;
702  if (!volume->GetShape() || volume->IsRunTime() || volume->IsVolumeMulti()) {
703  list = fGVolumes;
704  fHashGVolumes->Add(volume);
705  } else {
706  fHashVolumes->Add(volume);
707  }
708  Int_t index = list->GetEntriesFast();
709  list->AddAtAndExpand(volume,index);
710  return uid;
711 }
712 
713 ////////////////////////////////////////////////////////////////////////////////
714 /// Add a navigator in the list of navigators. If it is the first one make it
715 /// current navigator.
716 
718 {
719  if (fMultiThread) { TGeoManager::ThreadId(); fgMutex.lock(); }
720  std::thread::id threadId = std::this_thread::get_id();
721  NavigatorsMap_t::const_iterator it = fNavigators.find(threadId);
722  TGeoNavigatorArray *array = 0;
723  if (it != fNavigators.end()) array = it->second;
724  else {
725  array = new TGeoNavigatorArray(this);
726  fNavigators.insert(NavigatorsMap_t::value_type(threadId, array));
727  }
728  TGeoNavigator *nav = array->AddNavigator();
729  if (fClosed) nav->GetCache()->BuildInfoBranch();
730  if (fMultiThread) fgMutex.unlock();
731  return nav;
732 }
733 
734 ////////////////////////////////////////////////////////////////////////////////
735 /// Returns current navigator for the calling thread.
736 
738 {
739  TTHREAD_TLS(TGeoNavigator*) tnav = 0;
740  if (!fMultiThread) return fCurrentNavigator;
741  TGeoNavigator *nav = tnav; // TTHREAD_TLS_GET(TGeoNavigator*,tnav);
742  if (nav) return nav;
743  std::thread::id threadId = std::this_thread::get_id();
744  NavigatorsMap_t::const_iterator it = fNavigators.find(threadId);
745  if (it == fNavigators.end()) return 0;
746  TGeoNavigatorArray *array = it->second;
747  nav = array->GetCurrentNavigator();
748  tnav = nav; // TTHREAD_TLS_SET(TGeoNavigator*,tnav,nav);
749  return nav;
750 }
751 
752 ////////////////////////////////////////////////////////////////////////////////
753 /// Get list of navigators for the calling thread.
754 
756 {
757  std::thread::id threadId = std::this_thread::get_id();
758  NavigatorsMap_t::const_iterator it = fNavigators.find(threadId);
759  if (it == fNavigators.end()) return 0;
760  TGeoNavigatorArray *array = it->second;
761  return array;
762 }
763 
764 ////////////////////////////////////////////////////////////////////////////////
765 /// Switch to another existing navigator for the calling thread.
766 
768 {
769  std::thread::id threadId = std::this_thread::get_id();
770  NavigatorsMap_t::const_iterator it = fNavigators.find(threadId);
771  if (it == fNavigators.end()) {
772  Error("SetCurrentNavigator", "No navigator defined for this thread\n");
773  std::cout << " thread id: " << threadId << std::endl;
774  return kFALSE;
775  }
776  TGeoNavigatorArray *array = it->second;
777  TGeoNavigator *nav = array->SetCurrentNavigator(index);
778  if (!nav) {
779  Error("SetCurrentNavigator", "Navigator %d not existing for this thread\n", index);
780  std::cout << " thread id: " << threadId << std::endl;
781  return kFALSE;
782  }
783  if (!fMultiThread) fCurrentNavigator = nav;
784  return kTRUE;
785 }
786 
787 ////////////////////////////////////////////////////////////////////////////////
788 /// Set the lock for navigators.
789 
791 {
792  fgLockNavigators = flag;
793 }
794 
795 ////////////////////////////////////////////////////////////////////////////////
796 /// Clear all navigators.
797 
799 {
800  if (fMultiThread) fgMutex.lock();
801  TGeoNavigatorArray *arr = 0;
802  for (NavigatorsMap_t::iterator it = fNavigators.begin();
803  it != fNavigators.end(); ++it) {
804  arr = (*it).second;
805  if (arr) delete arr;
806  }
807  fNavigators.clear();
808  if (fMultiThread) fgMutex.unlock();
809 }
810 
811 ////////////////////////////////////////////////////////////////////////////////
812 /// Clear a single navigator.
813 
815 {
816  if (fMultiThread) fgMutex.lock();
817  for (NavigatorsMap_t::iterator it = fNavigators.begin(); it != fNavigators.end(); ++it) {
818  TGeoNavigatorArray *arr = (*it).second;
819  if (arr) {
820  if ((TGeoNavigator*)arr->Remove((TObject*)nav)) {
821  delete nav;
822  if (!arr->GetEntries()) fNavigators.erase(it);
823  if (fMultiThread) fgMutex.unlock();
824  return;
825  }
826  }
827  }
828  Error("Remove navigator", "Navigator %p not found", nav);
829  if (fMultiThread) fgMutex.unlock();
830 }
831 
832 ////////////////////////////////////////////////////////////////////////////////
833 /// Set maximum number of threads for navigation.
834 
836 {
837  if (!fClosed) {
838  Error("SetMaxThreads", "Cannot set maximum number of threads before closing the geometry");
839  return;
840  }
841  if (!fMultiThread) {
843  std::thread::id threadId = std::this_thread::get_id();
844  NavigatorsMap_t::const_iterator it = fNavigators.find(threadId);
845  if (it != fNavigators.end()) {
846  TGeoNavigatorArray *array = it->second;
847  fNavigators.erase(it);
848  fNavigators.insert(NavigatorsMap_t::value_type(threadId, array));
849  }
850  }
851  if (fMaxThreads) {
852  ClearThreadsMap();
853  ClearThreadData();
854  }
855  fMaxThreads = nthreads+1;
856  if (fMaxThreads>0) {
859  }
860 }
861 
862 ////////////////////////////////////////////////////////////////////////////////
863 
865 {
866  if (!fMaxThreads) return;
867  fgMutex.lock();
868  TIter next(fVolumes);
869  TGeoVolume *vol;
870  while ((vol=(TGeoVolume*)next())) vol->ClearThreadData();
871  fgMutex.unlock();
872 }
873 
874 ////////////////////////////////////////////////////////////////////////////////
875 /// Create thread private data for all geometry objects.
876 
878 {
879  if (!fMaxThreads) return;
880  fgMutex.lock();
881  TIter next(fVolumes);
882  TGeoVolume *vol;
883  while ((vol=(TGeoVolume*)next())) vol->CreateThreadData(fMaxThreads);
884  fgMutex.unlock();
885 }
886 
887 ////////////////////////////////////////////////////////////////////////////////
888 /// Clear the current map of threads. This will be filled again by the calling
889 /// threads via ThreadId calls.
890 
892 {
893  if (gGeoManager && !gGeoManager->IsMultiThread()) return;
894  fgMutex.lock();
895  if (!fgThreadId->empty()) fgThreadId->clear();
896  fgNumThreads = 0;
897  fgMutex.unlock();
898 }
899 
900 ////////////////////////////////////////////////////////////////////////////////
901 /// Translates the current thread id to an ordinal number. This can be used to
902 /// manage data which is specific for a given thread.
903 
905 {
906  TTHREAD_TLS(Int_t) tid = -1;
907  Int_t ttid = tid; // TTHREAD_TLS_GET(Int_t,tid);
908  if (ttid > -1) return ttid;
909  if (gGeoManager && !gGeoManager->IsMultiThread()) return 0;
910  std::thread::id threadId = std::this_thread::get_id();
911  TGeoManager::ThreadsMapIt_t it = fgThreadId->find(threadId);
912  if (it != fgThreadId->end()) return it->second;
913  // Map needs to be updated.
914  fgMutex.lock();
915  (*fgThreadId)[threadId] = fgNumThreads;
916  tid = fgNumThreads; // TTHREAD_TLS_SET(Int_t,tid,fgNumThreads);
917  ttid = fgNumThreads++;
918  fgMutex.unlock();
919  return ttid;
920 }
921 
922 ////////////////////////////////////////////////////////////////////////////////
923 /// Describe how to browse this object.
924 
926 {
927  if (!b) return;
928  if (fMaterials) b->Add(fMaterials, "Materials");
929  if (fMedia) b->Add(fMedia, "Media");
930  if (fMatrices) b->Add(fMatrices, "Local transformations");
931  if (fOverlaps) b->Add(fOverlaps, "Illegal overlaps");
932  if (fTracks) b->Add(fTracks, "Tracks");
933  if (fMasterVolume) b->Add(fMasterVolume, "Master Volume", fMasterVolume->IsVisible());
934  if (fTopVolume) b->Add(fTopVolume, "Top Volume", fTopVolume->IsVisible());
935  if (fTopNode) b->Add(fTopNode);
936  TString browserImp(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
937  TQObject::Connect(browserImp.Data(), "Checked(TObject*,Bool_t)",
938  "TGeoManager", this, "SetVisibility(TObject*,Bool_t)");
939 }
940 
941 ////////////////////////////////////////////////////////////////////////////////
942 /// Append a pad for this geometry.
943 
945  AppendPad("");
946  GetGeomPainter()->EditGeometry(option);
947 }
948 
949 ////////////////////////////////////////////////////////////////////////////////
950 /// Set visibility for a volume.
951 
953 {
954  if(obj->IsA() == TGeoVolume::Class()) {
955  TGeoVolume *vol = (TGeoVolume *) obj;
956  vol->SetVisibility(vis);
957  } else {
958  if (obj->InheritsFrom(TGeoNode::Class())) {
959  TGeoNode *node = (TGeoNode *) obj;
960  node->SetVisibility(vis);
961  } else return;
962  }
964 }
965 
966 ////////////////////////////////////////////////////////////////////////////////
967 /// Get the new 'bombed' translation vector according current exploded view mode.
968 
970 {
971  if (fPainter) fPainter->BombTranslation(tr, bombtr);
972  return;
973 }
974 
975 ////////////////////////////////////////////////////////////////////////////////
976 /// Get the new 'unbombed' translation vector according current exploded view mode.
977 
979 {
980  if (fPainter) fPainter->UnbombTranslation(tr, bombtr);
981  return;
982 }
983 
984 ////////////////////////////////////////////////////////////////////////////////
985 /// Backup the current state without affecting the cache stack.
986 
988 {
990 }
991 
992 ////////////////////////////////////////////////////////////////////////////////
993 /// Restore a backed-up state without affecting the cache stack.
994 
996 {
998 }
999 
1000 ////////////////////////////////////////////////////////////////////////////////
1001 /// Register a matrix to the list of matrices. It will be cleaned-up at the
1002 /// destruction TGeoManager.
1003 
1005 {
1006  return TGeoBuilder::Instance(this)->RegisterMatrix((TGeoMatrix*)matrix);
1007 }
1008 
1009 ////////////////////////////////////////////////////////////////////////////////
1010 /// Replaces all occurrences of VORIG with VNEW in the geometry tree. The volume VORIG
1011 /// is not replaced from the list of volumes, but all node referencing it will reference
1012 /// VNEW instead. Returns number of occurrences changed.
1013 
1015 {
1016  Int_t nref = 0;
1017  if (!vorig || !vnew) return nref;
1018  TGeoMedium *morig = vorig->GetMedium();
1019  Bool_t checkmed = kFALSE;
1020  if (morig) checkmed = kTRUE;
1021  TGeoMedium *mnew = vnew->GetMedium();
1022  // Try to limit the damage produced by incorrect usage.
1023  if (!mnew && !vnew->IsAssembly()) {
1024  Error("ReplaceVolume","Replacement volume %s has no medium and it is not an assembly",
1025  vnew->GetName());
1026  return nref;
1027  }
1028  if (mnew && checkmed) {
1029  if (mnew->GetId() != morig->GetId())
1030  Warning("ReplaceVolume","Replacement volume %s has different medium than original volume %s",
1031  vnew->GetName(), vorig->GetName());
1032  checkmed = kFALSE;
1033  }
1034 
1035  // Medium checking now performed only if replacement is an assembly and old volume a real one.
1036  // Check result is dependent on positioning.
1037  Int_t nvol = fVolumes->GetEntriesFast();
1038  Int_t i,j,nd;
1039  Int_t ierr = 0;
1040  TGeoVolume *vol;
1041  TGeoNode *node;
1042  TGeoVoxelFinder *voxels;
1043  for (i=0; i<nvol; i++) {
1044  vol = (TGeoVolume*)fVolumes->At(i);
1045  if (!vol) continue;
1046  if (vol==vorig || vol==vnew) continue;
1047  nd = vol->GetNdaughters();
1048  for (j=0; j<nd; j++) {
1049  node = vol->GetNode(j);
1050  if (node->GetVolume() == vorig) {
1051  if (checkmed) {
1052  mnew = node->GetMotherVolume()->GetMedium();
1053  if (mnew && mnew->GetId()!=morig->GetId()) ierr++;
1054  }
1055  nref++;
1056  if (node->IsOverlapping()) {
1057  node->SetOverlapping(kFALSE);
1058  Info("ReplaceVolume","%s replaced with assembly and declared NON-OVERLAPPING!",node->GetName());
1059  }
1060  node->SetVolume(vnew);
1061  voxels = node->GetMotherVolume()->GetVoxels();
1062  if (voxels) voxels->SetNeedRebuild();
1063  } else {
1064  if (node->GetMotherVolume() == vorig) {
1065  nref++;
1066  node->SetMotherVolume(vnew);
1067  if (node->IsOverlapping()) {
1068  node->SetOverlapping(kFALSE);
1069  Info("ReplaceVolume","%s inside substitute assembly %s declared NON-OVERLAPPING!",node->GetName(),vnew->GetName());
1070  }
1071  }
1072  }
1073  }
1074  }
1075  if (ierr) Warning("ReplaceVolume", "Volumes should not be replaced with assemblies if they are positioned in containers having a different medium ID.\n %i occurrences for assembly replacing volume %s",
1076  ierr, vorig->GetName());
1077  return nref;
1078 }
1079 
1080 ////////////////////////////////////////////////////////////////////////////////
1081 /// Transform all volumes named VNAME to assemblies. The volumes must be virtual.
1082 
1084 {
1085  TGeoVolume *toTransform = FindVolumeFast(vname);
1086  if (!toTransform) {
1087  Warning("TransformVolumeToAssembly", "Volume %s not found", vname);
1088  return 0;
1089  }
1090  Int_t index = fVolumes->IndexOf(toTransform);
1091  Int_t count = 0;
1092  Int_t indmax = fVolumes->GetEntries();
1093  Bool_t replace = kTRUE;
1094  TGeoVolume *transformed;
1095  while (index<indmax) {
1096  if (replace) {
1097  replace = kFALSE;
1098  transformed = TGeoVolumeAssembly::MakeAssemblyFromVolume(toTransform);
1099  if (transformed) {
1100  ReplaceVolume(toTransform, transformed);
1101  count++;
1102  } else {
1103  if (toTransform->IsAssembly())
1104  Warning("TransformVolumeToAssembly", "Volume %s already assembly", toTransform->GetName());
1105  if (!toTransform->GetNdaughters())
1106  Warning("TransformVolumeToAssembly", "Volume %s has no daughters, cannot transform", toTransform->GetName());
1107  if (toTransform->IsVolumeMulti())
1108  Warning("TransformVolumeToAssembly", "Volume %s divided, cannot transform", toTransform->GetName());
1109  }
1110  }
1111  index++;
1112  if (index >= indmax) return count;
1113  toTransform = (TGeoVolume*)fVolumes->At(index);
1114  if (!strcmp(toTransform->GetName(),vname)) replace = kTRUE;
1115  }
1116  return count;
1117 }
1118 
1119 ////////////////////////////////////////////////////////////////////////////////
1120 /// Create a new volume by dividing an existing one (GEANT3 like)
1121 ///
1122 /// Divides MOTHER into NDIV divisions called NAME
1123 /// along axis IAXIS starting at coordinate value START
1124 /// and having size STEP. The created volumes will have tracking
1125 /// media ID=NUMED (if NUMED=0 -> same media as MOTHER)
1126 /// The behavior of the division operation can be triggered using OPTION :
1127 ///
1128 /// OPTION (case insensitive) :
1129 /// - N - divide all range in NDIV cells (same effect as STEP<=0) (GSDVN in G3)
1130 /// - NX - divide range starting with START in NDIV cells (GSDVN2 in G3)
1131 /// - S - divide all range with given STEP. NDIV is computed and divisions will be centered
1132 /// in full range (same effect as NDIV<=0) (GSDVS, GSDVT in G3)
1133 /// - SX - same as DVS, but from START position. (GSDVS2, GSDVT2 in G3)
1134 
1135 TGeoVolume *TGeoManager::Division(const char *name, const char *mother, Int_t iaxis,
1136  Int_t ndiv, Double_t start, Double_t step, Int_t numed, Option_t *option)
1137 {
1138  return TGeoBuilder::Instance(this)->Division(name, mother, iaxis, ndiv, start, step, numed, option);
1139 }
1140 
1141 ////////////////////////////////////////////////////////////////////////////////
1142 /// Create rotation matrix named 'mat<index>'.
1143 ///
1144 /// - index rotation matrix number
1145 /// - theta1 polar angle for axis X
1146 /// - phi1 azimuthal angle for axis X
1147 /// - theta2 polar angle for axis Y
1148 /// - phi2 azimuthal angle for axis Y
1149 /// - theta3 polar angle for axis Z
1150 /// - phi3 azimuthal angle for axis Z
1151 ///
1152 
1153 void TGeoManager::Matrix(Int_t index, Double_t theta1, Double_t phi1,
1154  Double_t theta2, Double_t phi2,
1155  Double_t theta3, Double_t phi3)
1156 {
1157  TGeoBuilder::Instance(this)->Matrix(index, theta1, phi1, theta2, phi2, theta3, phi3);
1158 }
1159 
1160 ////////////////////////////////////////////////////////////////////////////////
1161 /// Create material with given A, Z and density, having an unique id.
1162 
1164 {
1165  return TGeoBuilder::Instance(this)->Material(name, a, z, dens, uid, radlen, intlen);
1166 
1167 }
1168 
1169 ////////////////////////////////////////////////////////////////////////////////
1170 /// Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem
1171 /// materials defined by arrays A,Z and WMAT, having an unique id.
1172 
1174  Int_t nelem, Float_t *wmat, Int_t uid)
1175 {
1176  return TGeoBuilder::Instance(this)->Mixture(name, a, z, dens, nelem, wmat, uid);
1177 }
1178 
1179 ////////////////////////////////////////////////////////////////////////////////
1180 /// Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem
1181 /// materials defined by arrays A,Z and WMAT, having an unique id.
1182 
1184  Int_t nelem, Double_t *wmat, Int_t uid)
1185 {
1186  return TGeoBuilder::Instance(this)->Mixture(name, a, z, dens, nelem, wmat, uid);
1187 }
1188 
1189 ////////////////////////////////////////////////////////////////////////////////
1190 /// Create tracking medium
1191 ///
1192 /// - numed tracking medium number assigned
1193 /// - name tracking medium name
1194 /// - nmat material number
1195 /// - isvol sensitive volume flag
1196 /// - ifield magnetic field
1197 /// - fieldm max. field value (kilogauss)
1198 /// - tmaxfd max. angle due to field (deg/step)
1199 /// - stemax max. step allowed
1200 /// - deemax max. fraction of energy lost in a step
1201 /// - epsil tracking precision (cm)
1202 /// - stmin min. step due to continuous processes (cm)
1203 ///
1204 /// - ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1205 /// - ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
1206 /// performed with g3helix; ifield = 3 if tracking performed with g3helx3.
1207 ///
1208 
1209 TGeoMedium *TGeoManager::Medium(const char *name, Int_t numed, Int_t nmat, Int_t isvol,
1210  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
1211  Double_t stemax, Double_t deemax, Double_t epsil,
1212  Double_t stmin)
1213 {
1214  return TGeoBuilder::Instance(this)->Medium(name, numed, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1215 }
1216 
1217 ////////////////////////////////////////////////////////////////////////////////
1218 /// Create a node called <name_nr> pointing to the volume called <name>
1219 /// as daughter of the volume called <mother> (gspos). The relative matrix is
1220 /// made of : a translation (x,y,z) and a rotation matrix named <matIROT>.
1221 /// In case npar>0, create the volume to be positioned in mother, according
1222 /// its actual parameters (gsposp).
1223 /// - NAME Volume name
1224 /// - NUMBER Copy number of the volume
1225 /// - MOTHER Mother volume name
1226 /// - X X coord. of the volume in mother ref. sys.
1227 /// - Y Y coord. of the volume in mother ref. sys.
1228 /// - Z Z coord. of the volume in mother ref. sys.
1229 /// - IROT Rotation matrix number w.r.t. mother ref. sys.
1230 /// - ISONLY ONLY/MANY flag
1231 
1232 void TGeoManager::Node(const char *name, Int_t nr, const char *mother,
1233  Double_t x, Double_t y, Double_t z, Int_t irot,
1234  Bool_t isOnly, Float_t *upar, Int_t npar)
1235 {
1236  TGeoBuilder::Instance(this)->Node(name, nr, mother, x, y, z, irot, isOnly, upar, npar);
1237 }
1238 
1239 ////////////////////////////////////////////////////////////////////////////////
1240 /// Create a node called <name_nr> pointing to the volume called <name>
1241 /// as daughter of the volume called <mother> (gspos). The relative matrix is
1242 /// made of : a translation (x,y,z) and a rotation matrix named <matIROT>.
1243 /// In case npar>0, create the volume to be positioned in mother, according
1244 /// its actual parameters (gsposp).
1245 /// - NAME Volume name
1246 /// - NUMBER Copy number of the volume
1247 /// - MOTHER Mother volume name
1248 /// - X X coord. of the volume in mother ref. sys.
1249 /// - Y Y coord. of the volume in mother ref. sys.
1250 /// - Z Z coord. of the volume in mother ref. sys.
1251 /// - IROT Rotation matrix number w.r.t. mother ref. sys.
1252 /// - ISONLY ONLY/MANY flag
1253 
1254 void TGeoManager::Node(const char *name, Int_t nr, const char *mother,
1255  Double_t x, Double_t y, Double_t z, Int_t irot,
1256  Bool_t isOnly, Double_t *upar, Int_t npar)
1257 {
1258  TGeoBuilder::Instance(this)->Node(name, nr, mother, x, y, z, irot, isOnly, upar, npar);
1259 
1260 }
1261 
1262 ////////////////////////////////////////////////////////////////////////////////
1263 /// Create a volume in GEANT3 style.
1264 /// - NAME Volume name
1265 /// - SHAPE Volume type
1266 /// - NMED Tracking medium number
1267 /// - NPAR Number of shape parameters
1268 /// - UPAR Vector containing shape parameters
1269 
1270 TGeoVolume *TGeoManager::Volume(const char *name, const char *shape, Int_t nmed,
1271  Float_t *upar, Int_t npar)
1272 {
1273  return TGeoBuilder::Instance(this)->Volume(name, shape, nmed, upar, npar);
1274 }
1275 
1276 ////////////////////////////////////////////////////////////////////////////////
1277 /// Create a volume in GEANT3 style.
1278 /// - NAME Volume name
1279 /// - SHAPE Volume type
1280 /// - NMED Tracking medium number
1281 /// - NPAR Number of shape parameters
1282 /// - UPAR Vector containing shape parameters
1283 
1284 TGeoVolume *TGeoManager::Volume(const char *name, const char *shape, Int_t nmed,
1285  Double_t *upar, Int_t npar)
1286 {
1287  return TGeoBuilder::Instance(this)->Volume(name, shape, nmed, upar, npar);
1288 }
1289 
1290 ////////////////////////////////////////////////////////////////////////////////
1291 /// Assigns uid's for all materials,media and matrices.
1292 
1294 {
1295  Int_t index = 1;
1296  TIter next(fMaterials);
1297  TGeoMaterial *mater;
1298  while ((mater=(TGeoMaterial*)next())) {
1299  mater->SetUniqueID(index++);
1301  }
1302  index = 1;
1303  TIter next1(fMedia);
1304  TGeoMedium *med;
1305  while ((med=(TGeoMedium*)next1())) {
1306  med->SetUniqueID(index++);
1308  }
1309  index = 1;
1310  TIter next2(fShapes);
1311  TGeoShape *shape;
1312  while ((shape=(TGeoShape*)next2())) {
1313  shape->SetUniqueID(index++);
1314  if (shape->IsComposite()) ((TGeoCompositeShape*)shape)->GetBoolNode()->RegisterMatrices();
1315  }
1316 
1317  TIter next3(fMatrices);
1318  TGeoMatrix *matrix;
1319  while ((matrix=(TGeoMatrix*)next3())) {
1320  matrix->RegisterYourself();
1321  }
1322  TIter next4(fMatrices);
1323  index = 1;
1324  while ((matrix=(TGeoMatrix*)next4())) {
1325  matrix->SetUniqueID(index++);
1327  }
1328  TIter next5(fVolumes);
1329  TGeoVolume *vol;
1330  while ((vol=(TGeoVolume*)next5())) vol->UnmarkSaved();
1331 }
1332 
1333 ////////////////////////////////////////////////////////////////////////////////
1334 /// Reset all attributes to default ones. Default attributes for visualization
1335 /// are those defined before closing the geometry.
1336 
1338 {
1339  if (gPad) delete gPad;
1340  gPad = 0;
1341  SetVisOption(0);
1342  SetVisLevel(3);
1343  SetExplodedView(0);
1344  SetBombFactors();
1345  if (!gStyle) return;
1346  TIter next(fVolumes);
1347  TGeoVolume *vol = 0;
1348  while ((vol=(TGeoVolume*)next())) {
1349  if (!vol->IsVisTouched()) continue;
1350  vol->SetVisTouched(kFALSE);
1351  }
1352 }
1353 ////////////////////////////////////////////////////////////////////////////////
1354 /// Closing geometry implies checking the geometry validity, fixing shapes
1355 /// with negative parameters (run-time shapes)building the cache manager,
1356 /// voxelizing all volumes, counting the total number of physical nodes and
1357 /// registering the manager class to the browser.
1358 
1360 {
1361  if (fClosed) {
1362  Warning("CloseGeometry", "geometry already closed");
1363  return;
1364  }
1365  if (!fMasterVolume) {
1366  Error("CloseGeometry","you MUST call SetTopVolume() first !");
1367  return;
1368  }
1369  if (!gROOT->GetListOfGeometries()->FindObject(this)) gROOT->GetListOfGeometries()->Add(this);
1370  if (!gROOT->GetListOfBrowsables()->FindObject(this)) gROOT->GetListOfBrowsables()->Add(this);
1371 // TSeqCollection *brlist = gROOT->GetListOfBrowsers();
1372 // TIter next(brlist);
1373 // TBrowser *browser = 0;
1374 // while ((browser=(TBrowser*)next())) browser->Refresh();
1375  TString opt(option);
1376  opt.ToLower();
1377 // Bool_t dummy = opt.Contains("d");
1378  Bool_t nodeid = opt.Contains("i");
1379  // Create a geometry navigator if not present
1380  TGeoNavigator *nav = 0;
1381  Int_t nnavigators = 0;
1382  // Check if the geometry is streamed from file
1383  if (fIsGeomReading) {
1384  if (fgVerboseLevel>0) Info("CloseGeometry","Geometry loaded from file...");
1386  if (!fElementTable) fElementTable = new TGeoElementTable(200);
1387  if (!fTopNode) {
1388  if (!fMasterVolume) {
1389  Error("CloseGeometry", "Master volume not streamed");
1390  return;
1391  }
1393  if (fStreamVoxels && fgVerboseLevel>0) Info("CloseGeometry","Voxelization retrieved from file");
1394  }
1395  // Create a geometry navigator if not present
1397  nnavigators = GetListOfNavigators()->GetEntriesFast();
1398  Voxelize("ALL");
1399  CountLevels();
1400  for (Int_t i=0; i<nnavigators; i++) {
1401  nav = (TGeoNavigator*)GetListOfNavigators()->At(i);
1402  nav->GetCache()->BuildInfoBranch();
1403  if (nodeid) nav->GetCache()->BuildIdArray();
1404  }
1405  if (!fHashVolumes) {
1406  Int_t nvol = fVolumes->GetEntriesFast();
1407  Int_t ngvol = fGVolumes->GetEntriesFast();
1408  fHashVolumes = new THashList(nvol+1);
1409  fHashGVolumes = new THashList(ngvol+1);
1410  Int_t i;
1411  for (i=0; i<ngvol; i++) fHashGVolumes->AddLast(fGVolumes->At(i));
1412  for (i=0; i<nvol; i++) fHashVolumes->AddLast(fVolumes->At(i));
1413  }
1414  fClosed = kTRUE;
1415  if (fParallelWorld) {
1416  if (fgVerboseLevel>0) Info("CloseGeometry","Recreating parallel world %s ...",fParallelWorld->GetName());
1418  }
1419 
1420  if (fgVerboseLevel>0) Info("CloseGeometry","%i nodes/ %i volume UID's in %s", fNNodes, fUniqueVolumes->GetEntriesFast()-1, GetTitle());
1421  if (fgVerboseLevel>0) Info("CloseGeometry","----------------modeler ready----------------");
1422  return;
1423  }
1424 
1425  // Create a geometry navigator if not present
1427  nnavigators = GetListOfNavigators()->GetEntriesFast();
1429  CheckGeometry();
1430  if (fgVerboseLevel>0) Info("CloseGeometry","Counting nodes...");
1431  fNNodes = CountNodes();
1432  fNLevel = fMasterVolume->CountNodes(1,3)+1;
1433  if (fNLevel<30) fNLevel = 100;
1434 
1435 // BuildIdArray();
1436  Voxelize("ALL");
1437  if (fgVerboseLevel>0) Info("CloseGeometry","Building cache...");
1438  CountLevels();
1439  for (Int_t i=0; i<nnavigators; i++) {
1440  nav = (TGeoNavigator*)GetListOfNavigators()->At(i);
1441  nav->GetCache()->BuildInfoBranch();
1442  if (nodeid) nav->GetCache()->BuildIdArray();
1443  }
1444  fClosed = kTRUE;
1445  if (fgVerboseLevel>0) {
1446  Info("CloseGeometry","%i nodes/ %i volume UID's in %s", fNNodes, fUniqueVolumes->GetEntriesFast()-1, GetTitle());
1447  Info("CloseGeometry","----------------modeler ready----------------");
1448  }
1449 }
1450 
1451 ////////////////////////////////////////////////////////////////////////////////
1452 /// Clear the list of overlaps.
1453 
1455 {
1456  if (fOverlaps) {
1457  fOverlaps->Delete();
1458  delete fOverlaps;
1459  }
1460  fOverlaps = new TObjArray();
1461 }
1462 
1463 ////////////////////////////////////////////////////////////////////////////////
1464 /// Remove a shape from the list of shapes.
1465 
1467 {
1468  if (fShapes->FindObject(shape)) fShapes->Remove((TGeoShape*)shape);
1469  delete shape;
1470 }
1471 
1472 ////////////////////////////////////////////////////////////////////////////////
1473 /// Clean temporary volumes and shapes from garbage collection.
1474 
1476 {
1477  if (!fGVolumes && !fGShapes) return;
1478  Int_t i,nentries;
1479  if (fGVolumes) {
1481  TGeoVolume *vol = 0;
1482  for (i=0; i<nentries; i++) {
1483  vol=(TGeoVolume*)fGVolumes->At(i);
1484  if (vol) vol->SetFinder(0);
1485  }
1486  fGVolumes->Delete();
1487  delete fGVolumes;
1488  fGVolumes = 0;
1489  }
1490  if (fGShapes) {
1491  fGShapes->Delete();
1492  delete fGShapes;
1493  fGShapes = 0;
1494  }
1495 }
1496 
1497 ////////////////////////////////////////////////////////////////////////////////
1498 /// Change current path to point to the node having this id.
1499 /// Node id has to be in range : 0 to fNNodes-1 (no check for performance reasons)
1500 
1502 {
1503  GetCurrentNavigator()->CdNode(nodeid);
1504 }
1505 
1506 ////////////////////////////////////////////////////////////////////////////////
1507 /// Get the unique ID of the current node.
1508 
1510 {
1512 }
1513 
1514 ////////////////////////////////////////////////////////////////////////////////
1515 /// Make top level node the current node. Updates the cache accordingly.
1516 /// Determine the overlapping state of current node.
1517 
1519 {
1521 }
1522 
1523 ////////////////////////////////////////////////////////////////////////////////
1524 /// Go one level up in geometry. Updates cache accordingly.
1525 /// Determine the overlapping state of current node.
1526 
1528 {
1530 }
1531 
1532 ////////////////////////////////////////////////////////////////////////////////
1533 /// Make a daughter of current node current. Can be called only with a valid
1534 /// daughter index (no check). Updates cache accordingly.
1535 
1537 {
1538  GetCurrentNavigator()->CdDown(index);
1539 }
1540 
1541 ////////////////////////////////////////////////////////////////////////////////
1542 /// Do a cd to the node found next by FindNextBoundary
1543 
1545 {
1547 }
1548 
1549 ////////////////////////////////////////////////////////////////////////////////
1550 /// Browse the tree of nodes starting from fTopNode according to pathname.
1551 /// Changes the path accordingly.
1552 
1553 Bool_t TGeoManager::cd(const char *path)
1554 {
1555  return GetCurrentNavigator()->cd(path);
1556 }
1557 
1558 ////////////////////////////////////////////////////////////////////////////////
1559 /// Check if a geometry path is valid without changing the state of the current navigator.
1560 
1561 Bool_t TGeoManager::CheckPath(const char *path) const
1562 {
1563  return GetCurrentNavigator()->CheckPath(path);
1564 }
1565 
1566 ////////////////////////////////////////////////////////////////////////////////
1567 /// Convert all reflections in geometry to normal rotations + reflected shapes.
1568 
1570 {
1571  if (!fTopNode) return;
1572  if (fgVerboseLevel>0) Info("ConvertReflections", "Converting reflections in: %s - %s ...", GetName(), GetTitle());
1573  TGeoIterator next(fTopVolume);
1574  TGeoNode *node;
1575  TGeoNodeMatrix *nodematrix;
1576  TGeoMatrix *matrix, *mclone;
1577  TGeoVolume *reflected;
1578  while ((node=next())) {
1579  matrix = node->GetMatrix();
1580  if (matrix->IsReflection()) {
1581 // printf("%s before\n", node->GetName());
1582 // matrix->Print();
1583  mclone = new TGeoCombiTrans(*matrix);
1584  mclone->RegisterYourself();
1585  // Reflect just the rotation component
1586  mclone->ReflectZ(kFALSE, kTRUE);
1587  nodematrix = (TGeoNodeMatrix*)node;
1588  nodematrix->SetMatrix(mclone);
1589 // printf("%s after\n", node->GetName());
1590 // node->GetMatrix()->Print();
1591  reflected = node->GetVolume()->MakeReflectedVolume();
1592  node->SetVolume(reflected);
1593  }
1594  }
1595  if (fgVerboseLevel>0) Info("ConvertReflections", "Done");
1596 }
1597 
1598 ////////////////////////////////////////////////////////////////////////////////
1599 /// Count maximum number of nodes per volume, maximum depth and maximum
1600 /// number of xtru vertices.
1601 
1603 {
1604  if (!fTopNode) {
1605  Error("CountLevels", "Top node not defined.");
1606  return;
1607  }
1608  TGeoIterator next(fTopVolume);
1609  Bool_t fixrefs = fIsGeomReading && (fMasterVolume->GetRefCount()==1);
1611  if (fgVerboseLevel>1 && fixrefs) Info("CountLevels", "Fixing volume reference counts");
1612  TGeoNode *node;
1613  Int_t maxlevel = 1;
1614  Int_t maxnodes = fTopVolume->GetNdaughters();
1615  Int_t maxvertices = 1;
1616  while ((node=next())) {
1617  if (fixrefs) {
1618  node->GetVolume()->Grab();
1619  for (Int_t ibit=10; ibit<14; ibit++) {
1620  node->SetBit(BIT(ibit+4), node->TestBit(BIT(ibit)));
1621 // node->ResetBit(BIT(ibit)); // cannot overwrite old crap for reproducibility
1622  }
1623  }
1624  if (node->GetVolume()->GetVoxels()) {
1625  if (node->GetNdaughters()>maxnodes) maxnodes = node->GetNdaughters();
1626  }
1627  if (next.GetLevel()>maxlevel) maxlevel = next.GetLevel();
1628  if (node->GetVolume()->GetShape()->IsA()==TGeoXtru::Class()) {
1629  TGeoXtru *xtru = (TGeoXtru*)node->GetVolume()->GetShape();
1630  if (xtru->GetNvert()>maxvertices) maxvertices = xtru->GetNvert();
1631  }
1632  }
1633  fgMaxLevel = maxlevel;
1634  fgMaxDaughters = maxnodes;
1635  fgMaxXtruVert = maxvertices;
1636  if (fgVerboseLevel>0) Info("CountLevels", "max level = %d, max placements = %d", fgMaxLevel, fgMaxDaughters);
1637 }
1638 
1639 ////////////////////////////////////////////////////////////////////////////////
1640 /// Count the total number of nodes starting from a volume, nlevels down.
1641 
1643 {
1644  TGeoVolume *top;
1645  if (!vol) {
1646  top = fTopVolume;
1647  } else {
1648  top = (TGeoVolume*)vol;
1649  }
1650  Int_t count = top->CountNodes(nlevels, option);
1651  return count;
1652 }
1653 
1654 ////////////////////////////////////////////////////////////////////////////////
1655 /// Set default angles for a given view.
1656 
1658 {
1660 }
1661 
1662 ////////////////////////////////////////////////////////////////////////////////
1663 /// Draw current point in the same view.
1664 
1666 {
1667  if (fPainter) fPainter->DrawCurrentPoint(color);
1668 }
1669 
1670 ////////////////////////////////////////////////////////////////////////////////
1671 /// Draw animation of tracks
1672 
1673 void TGeoManager::AnimateTracks(Double_t tmin, Double_t tmax, Int_t nframes, Option_t *option)
1674 {
1675  SetAnimateTracks();
1676  GetGeomPainter();
1677  if (tmin<0 || tmin>=tmax || nframes<1) return;
1679  box[0] = box[1] = box[2] = 0;
1680  box[3] = box[4] = box[5] = 100;
1681  Double_t dt = (tmax-tmin)/Double_t(nframes);
1682  Double_t delt = 2E-9;
1683  Double_t t = tmin;
1684  Int_t i, j;
1685  TString opt(option);
1686  Bool_t save = kFALSE, geomanim=kFALSE;
1687  TString fname;
1688  if (opt.Contains("/S")) save = kTRUE;
1689 
1690  if (opt.Contains("/G")) geomanim = kTRUE;
1691  SetTminTmax(0,0);
1692  DrawTracks(opt.Data());
1693  Double_t start[6], end[6];
1694  Double_t dd[6] = {0,0,0,0,0,0};
1695  Double_t dlat=0, dlong=0, dpsi=0;
1696  if (geomanim) {
1697  fPainter->EstimateCameraMove(tmin+5*dt, tmin+15*dt, start, end);
1698  for (i=0; i<3; i++) {
1699  start[i+3] = 20 + 1.3*start[i+3];
1700  end[i+3] = 20 + 0.9*end[i+3];
1701  }
1702  for (i=0; i<6; i++) {
1703  dd[i] = (end[i]-start[i])/10.;
1704  }
1705  memcpy(box, start, 6*sizeof(Double_t));
1706  fPainter->GetViewAngles(dlong,dlat,dpsi);
1707  dlong = (-206-dlong)/Double_t(nframes);
1708  dlat = (126-dlat)/Double_t(nframes);
1709  dpsi = (75-dpsi)/Double_t(nframes);
1710  fPainter->GrabFocus();
1711  }
1712 
1713  for (i=0; i<nframes; i++) {
1714  if (t-delt<0) SetTminTmax(t-delt,t);
1715  else gGeoManager->SetTminTmax(t-delt,t);
1716  if (geomanim) {
1717  for (j=0; j<6; j++) box[j]+=dd[j];
1718  fPainter->GrabFocus(1,dlong,dlat,dpsi);
1719  } else {
1720  ModifiedPad();
1721  }
1722  if (save) {
1723  fname = TString::Format("anim%04d.gif", i);
1724  gPad->Print(fname);
1725  }
1726  t += dt;
1727  }
1729 }
1730 
1731 ////////////////////////////////////////////////////////////////////////////////
1732 /// Draw tracks over the geometry, according to option. By default, only
1733 /// primaries are drawn. See TGeoTrack::Draw() for additional options.
1734 
1736 {
1737  TVirtualGeoTrack *track;
1738  //SetVisLevel(1);
1739  //SetVisOption(1);
1740  SetAnimateTracks();
1741  for (Int_t i=0; i<fNtracks; i++) {
1742  track = GetTrack(i);
1743  if (track) track->Draw(option);
1744  }
1746  ModifiedPad();
1747 }
1748 
1749 ////////////////////////////////////////////////////////////////////////////////
1750 /// Draw current path
1751 
1752 void TGeoManager::DrawPath(const char *path, Option_t *option)
1753 {
1754  if (!fTopVolume) return;
1756  GetGeomPainter()->DrawPath(path, option);
1757 }
1758 
1759 ////////////////////////////////////////////////////////////////////////////////
1760 /// Draw random points in the bounding box of a volume.
1761 
1762 void TGeoManager::RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option)
1763 {
1764  GetGeomPainter()->RandomPoints((TGeoVolume*)vol, npoints, option);
1765 }
1766 
1767 ////////////////////////////////////////////////////////////////////////////////
1768 /// Check time of finding "Where am I" for n points.
1769 
1770 void TGeoManager::Test(Int_t npoints, Option_t *option)
1771 {
1772  GetGeomPainter()->Test(npoints, option);
1773 }
1774 
1775 ////////////////////////////////////////////////////////////////////////////////
1776 /// Geometry overlap checker based on sampling.
1777 
1778 void TGeoManager::TestOverlaps(const char* path)
1779 {
1780  GetGeomPainter()->TestOverlaps(path);
1781 }
1782 
1783 ////////////////////////////////////////////////////////////////////////////////
1784 /// Fill volume names of current branch into an array.
1785 
1787 {
1789 }
1790 
1791 ////////////////////////////////////////////////////////////////////////////////
1792 /// Get name for given pdg code;
1793 
1794 const char *TGeoManager::GetPdgName(Int_t pdg) const
1795 {
1796  static char defaultname[5] = { "XXX" };
1797  if (!fPdgNames || !pdg) return defaultname;
1798  for (Int_t i=0; i<fNpdg; i++) {
1799  if (fPdgId[i]==pdg) return fPdgNames->At(i)->GetName();
1800  }
1801  return defaultname;
1802 }
1803 
1804 ////////////////////////////////////////////////////////////////////////////////
1805 /// Set a name for a particle having a given pdg.
1806 
1807 void TGeoManager::SetPdgName(Int_t pdg, const char *name)
1808 {
1809  if (!pdg) return;
1810  if (!fPdgNames) {
1811  fPdgNames = new TObjArray(1024);
1812  }
1813  if (!strcmp(name, GetPdgName(pdg))) return;
1814  // store pdg name
1815  if (fNpdg>1023) {
1816  Warning("SetPdgName", "No more than 256 different pdg codes allowed");
1817  return;
1818  }
1819  fPdgId[fNpdg] = pdg;
1820  TNamed *pdgname = new TNamed(name, "");
1821  fPdgNames->AddAtAndExpand(pdgname, fNpdg++);
1822 }
1823 
1824 ////////////////////////////////////////////////////////////////////////////////
1825 /// Get GDML matrix with a given name;
1826 
1828 {
1830 }
1831 
1832 ////////////////////////////////////////////////////////////////////////////////
1833 /// Add GDML matrix;
1835 {
1836  if (GetGDMLMatrix(mat->GetName())) {
1837  Error("AddGDMLMatrix", "Matrix %s already added to manager", mat->GetName());
1838  return;
1839  }
1840  fGDMLMatrices->Add(mat);
1841 }
1842 
1843 ////////////////////////////////////////////////////////////////////////////////
1844 /// Get optical surface with a given name;
1845 
1847 {
1849 }
1850 
1851 ////////////////////////////////////////////////////////////////////////////////
1852 /// Add optical surface;
1854 {
1855  if (GetOpticalSurface(optsurf->GetName())) {
1856  Error("AddOpticalSurface", "Surface %s already added to manager", optsurf->GetName());
1857  return;
1858  }
1859  fOpticalSurfaces->Add(optsurf);
1860 }
1861 
1862 ////////////////////////////////////////////////////////////////////////////////
1863 /// Get skin surface with a given name;
1864 
1866 {
1868 }
1869 
1870 ////////////////////////////////////////////////////////////////////////////////
1871 /// Add skin surface;
1873 {
1874  if (GetSkinSurface(surf->GetName())) {
1875  Error("AddSkinSurface", "Surface %s already added to manager", surf->GetName());
1876  return;
1877  }
1878  fSkinSurfaces->Add(surf);
1879 }
1880 
1881 ////////////////////////////////////////////////////////////////////////////////
1882 /// Get border surface with a given name;
1883 
1885 {
1887 }
1888 
1889 ////////////////////////////////////////////////////////////////////////////////
1890 /// Add border surface;
1892 {
1893  if (GetBorderSurface(surf->GetName())) {
1894  Error("AddBorderSurface", "Surface %s already added to manager", surf->GetName());
1895  return;
1896  }
1897  fBorderSurfaces->Add(surf);
1898 }
1899 
1900 ////////////////////////////////////////////////////////////////////////////////
1901 /// Fill node copy numbers of current branch into an array.
1902 
1903 void TGeoManager::GetBranchNumbers(Int_t *copyNumbers, Int_t *volumeNumbers) const
1904 {
1905  GetCurrentNavigator()->GetBranchNumbers(copyNumbers, volumeNumbers);
1906 }
1907 
1908 ////////////////////////////////////////////////////////////////////////////////
1909 /// Fill node copy numbers of current branch into an array.
1910 
1912 {
1914 }
1915 
1916 ////////////////////////////////////////////////////////////////////////////////
1917 /// Retrieve cartesian and radial bomb factors.
1918 
1919 void TGeoManager::GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const
1920 {
1921  if (fPainter) {
1922  fPainter->GetBombFactors(bombx, bomby, bombz, bombr);
1923  return;
1924  }
1925  bombx = bomby = bombz = bombr = 1.3;
1926 }
1927 
1928 ////////////////////////////////////////////////////////////////////////////////
1929 /// Return maximum number of daughters of a volume used in the geometry.
1930 
1932 {
1933  return fgMaxDaughters;
1934 }
1935 
1936 ////////////////////////////////////////////////////////////////////////////////
1937 /// Return maximum number of levels used in the geometry.
1938 
1940 {
1941  return fgMaxLevel;
1942 }
1943 
1944 ////////////////////////////////////////////////////////////////////////////////
1945 /// Return maximum number of vertices for an xtru shape used.
1946 
1948 {
1949  return fgMaxXtruVert;
1950 }
1951 
1952 ////////////////////////////////////////////////////////////////////////////////
1953 /// Returns number of threads that were set to use geometry.
1954 
1956 {
1957  return fgNumThreads;
1958 }
1959 
1960 ////////////////////////////////////////////////////////////////////////////////
1961 /// Return stored current matrix (global matrix of the next touched node).
1962 
1964 {
1965  if (!GetCurrentNavigator()) return NULL;
1966  return GetCurrentNavigator()->GetHMatrix();
1967 }
1968 
1969 ////////////////////////////////////////////////////////////////////////////////
1970 /// Returns current depth to which geometry is drawn.
1971 
1973 {
1974  return fVisLevel;
1975 }
1976 
1977 ////////////////////////////////////////////////////////////////////////////////
1978 /// Returns current depth to which geometry is drawn.
1979 
1981 {
1982  return fVisOption;
1983 }
1984 
1985 ////////////////////////////////////////////////////////////////////////////////
1986 /// Find level of virtuality of current overlapping node (number of levels
1987 /// up having the same tracking media.
1988 
1990 {
1992 }
1993 
1994 ////////////////////////////////////////////////////////////////////////////////
1995 /// Search the track hierarchy to find the track with the
1996 /// given id
1997 ///
1998 /// if 'primsFirst' is true, then:
1999 /// first tries TGeoManager::GetTrackOfId, then does a
2000 /// recursive search if that fails. this would be faster
2001 /// if the track is somehow known to be a primary
2002 
2004 {
2005  TVirtualGeoTrack* trk = 0;
2006  trk = GetTrackOfId(id);
2007  if (trk) return trk;
2008  // need recursive search
2009  TIter next(fTracks);
2010  TVirtualGeoTrack* prim;
2011  while ((prim = (TVirtualGeoTrack*)next())) {
2012  trk = prim->FindTrackWithId(id);
2013  if (trk) return trk;
2014  }
2015  return NULL;
2016 }
2017 
2018 ////////////////////////////////////////////////////////////////////////////////
2019 /// Get track with a given ID.
2020 
2022 {
2023  TVirtualGeoTrack *track;
2024  for (Int_t i=0; i<fNtracks; i++) {
2025  if ((track = (TVirtualGeoTrack *)fTracks->UncheckedAt(i))) {
2026  if (track->GetId() == id) return track;
2027  }
2028  }
2029  return 0;
2030 }
2031 
2032 ////////////////////////////////////////////////////////////////////////////////
2033 /// Get parent track with a given ID.
2034 
2036 {
2038  while ((track=track->GetMother())) {
2039  if (track->GetId()==id) return track;
2040  }
2041  return 0;
2042 }
2043 
2044 ////////////////////////////////////////////////////////////////////////////////
2045 /// Get index for track id, -1 if not found.
2046 
2048 {
2049  TVirtualGeoTrack *track;
2050  for (Int_t i=0; i<fNtracks; i++) {
2051  if ((track = (TVirtualGeoTrack *)fTracks->UncheckedAt(i))) {
2052  if (track->GetId() == id) return i;
2053  }
2054  }
2055  return -1;
2056 }
2057 
2058 ////////////////////////////////////////////////////////////////////////////////
2059 /// Go upwards the tree until a non-overlapping node
2060 
2062 {
2063  return GetCurrentNavigator()->GotoSafeLevel();
2064 }
2065 
2066 ////////////////////////////////////////////////////////////////////////////////
2067 /// Go upwards the tree until a non-overlapping node
2068 
2070 {
2071  return GetCurrentNavigator()->GetSafeLevel();
2072 }
2073 
2074 ////////////////////////////////////////////////////////////////////////////////
2075 /// Set default volume colors according to A of material
2076 
2078 {
2079  const Int_t nmax = 110;
2080  Int_t col[nmax];
2081  for (Int_t i=0;i<nmax;i++) col[i] = kGray;
2082 
2083  //here we should create a new TColor with the same rgb as in the default
2084  //ROOT colors used below
2085  col[ 3] = kYellow-10;
2086  col[ 4] = col[ 5] = kGreen-10;
2087  col[ 6] = col[ 7] = kBlue-7;
2088  col[ 8] = col[ 9] = kMagenta-3;
2089  col[10] = col[11] = kRed-10;
2090  col[12] = kGray+1;
2091  col[13] = kBlue-10;
2092  col[14] = kOrange+7;
2093  col[16] = kYellow+1;
2094  col[20] = kYellow-10;
2095  col[24] = col[25] = col[26] = kBlue-8;
2096  col[29] = kOrange+9;
2097  col[79] = kOrange-2;
2098 
2099  TGeoVolume *vol;
2100  TIter next(fVolumes);
2101  while ((vol=(TGeoVolume*)next())) {
2102  TGeoMedium *med = vol->GetMedium();
2103  if (!med) continue;
2104  TGeoMaterial *mat = med->GetMaterial();
2105  Int_t matZ = (Int_t)mat->GetZ();
2106  vol->SetLineColor(col[matZ]);
2107  if (mat->GetDensity()<0.1) vol->SetTransparency(60);
2108  }
2109 }
2110 
2111 ////////////////////////////////////////////////////////////////////////////////
2112 /// Compute safe distance from the current point. This represent the distance
2113 /// from POINT to the closest boundary.
2114 
2116 {
2117  return GetCurrentNavigator()->Safety(inside);
2118 }
2119 
2120 ////////////////////////////////////////////////////////////////////////////////
2121 /// Set volume attributes in G3 style.
2122 
2123 void TGeoManager::SetVolumeAttribute(const char *name, const char *att, Int_t val)
2124 {
2125  TGeoVolume *volume;
2126  Bool_t all = kFALSE;
2127  if (strstr(name,"*")) all=kTRUE;
2128  Int_t ivo=0;
2129  TIter next(fVolumes);
2130  TString chatt = att;
2131  chatt.ToLower();
2132  while ((volume=(TGeoVolume*)next())) {
2133  if (strcmp(volume->GetName(), name) && !all) continue;
2134  ivo++;
2135  if (chatt.Contains("colo")) volume->SetLineColor(val);
2136  if (chatt.Contains("lsty")) volume->SetLineStyle(val);
2137  if (chatt.Contains("lwid")) volume->SetLineWidth(val);
2138  if (chatt.Contains("fill")) volume->SetFillColor(val);
2139  if (chatt.Contains("seen")) volume->SetVisibility(val);
2140  }
2141  TIter next1(fGVolumes);
2142  while ((volume=(TGeoVolume*)next1())) {
2143  if (strcmp(volume->GetName(), name) && !all) continue;
2144  ivo++;
2145  if (chatt.Contains("colo")) volume->SetLineColor(val);
2146  if (chatt.Contains("lsty")) volume->SetLineStyle(val);
2147  if (chatt.Contains("lwid")) volume->SetLineWidth(val);
2148  if (chatt.Contains("fill")) volume->SetFillColor(val);
2149  if (chatt.Contains("seen")) volume->SetVisibility(val);
2150  }
2151  if (!ivo) {
2152  Warning("SetVolumeAttribute","volume: %s does not exist",name);
2153  }
2154 }
2155 
2156 ////////////////////////////////////////////////////////////////////////////////
2157 /// Set factors that will "bomb" all translations in cartesian and cylindrical coordinates.
2158 
2160 {
2161  if (fPainter) fPainter->SetBombFactors(bombx, bomby, bombz, bombr);
2162 }
2163 
2164 ////////////////////////////////////////////////////////////////////////////////
2165 /// Set a user-defined shape as clipping for ray tracing.
2166 
2168 {
2169  TVirtualGeoPainter *painter = GetGeomPainter();
2170  if (shape) {
2172  fClippingShape = shape;
2173  }
2174  painter->SetClippingShape(shape);
2175 }
2176 
2177 ////////////////////////////////////////////////////////////////////////////////
2178 /// set the maximum number of visible nodes.
2179 
2181  fMaxVisNodes = maxnodes;
2182  if (maxnodes>0 && fgVerboseLevel>0)
2183  Info("SetMaxVisNodes","Automatic visible depth for %d visible nodes", maxnodes);
2184  if (!fPainter) return;
2186  Int_t level = fPainter->GetVisLevel();
2187  if (level != fVisLevel) fVisLevel = level;
2188 }
2189 
2190 ////////////////////////////////////////////////////////////////////////////////
2191 /// make top volume visible on screen
2192 
2194  GetGeomPainter();
2195  fPainter->SetTopVisible(vis);
2196 }
2197 
2198 ////////////////////////////////////////////////////////////////////////////////
2199 /// Assign a given node to be checked for overlaps. Any other overlaps will be ignored.
2200 
2202  GetGeomPainter()->SetCheckedNode(node);
2203 }
2204 
2205 ////////////////////////////////////////////////////////////////////////////////
2206 /// Set the number of points to be generated on the shape outline when checking
2207 /// for overlaps.
2208 
2210 {
2211  GetGeomPainter()->SetNmeshPoints(npoints);
2212 }
2213 
2214 ////////////////////////////////////////////////////////////////////////////////
2215 /// set drawing mode :
2216 /// - option=0 (default) all nodes drawn down to vislevel
2217 /// - option=1 leaves and nodes at vislevel drawn
2218 /// - option=2 path is drawn
2219 /// - option=4 visibility changed
2220 
2222  if ((option>=0) && (option<3)) fVisOption=option;
2223  if (fPainter) fPainter->SetVisOption(option);
2224 }
2225 
2226 ////////////////////////////////////////////////////////////////////////////////
2227 /// Set visualization option (leaves only OR all volumes)
2228 
2230 {
2231  if (flag) SetVisOption(1);
2232  else SetVisOption(0);
2233 }
2234 
2235 ////////////////////////////////////////////////////////////////////////////////
2236 /// Set density threshold. Volumes with densities lower than this become
2237 /// transparent.
2238 
2240 {
2241  fVisDensity = density;
2242  if (fPainter) fPainter->ModifiedPad();
2243 }
2244 
2245 ////////////////////////////////////////////////////////////////////////////////
2246 /// set default level down to which visualization is performed
2247 
2249  if (level>0) {
2250  fVisLevel = level;
2251  fMaxVisNodes = 0;
2252  if (fgVerboseLevel>0)
2253  Info("SetVisLevel","Automatic visible depth disabled");
2255  } else {
2256  SetMaxVisNodes();
2257  }
2258 }
2259 
2260 ////////////////////////////////////////////////////////////////////////////////
2261 /// Sort overlaps by decreasing overlap distance. Extrusions comes first.
2262 
2264 {
2265  fOverlaps->Sort();
2266 }
2267 
2268 ////////////////////////////////////////////////////////////////////////////////
2269 /// Optimize voxelization type for all volumes. Save best choice in a macro.
2270 
2271 void TGeoManager::OptimizeVoxels(const char *filename)
2272 {
2273  if (!fTopNode) {
2274  Error("OptimizeVoxels","Geometry must be closed first");
2275  return;
2276  }
2277  std::ofstream out;
2278  TString fname = filename;
2279  if (fname.IsNull()) fname = "tgeovox.C";
2280  out.open(fname, std::ios::out);
2281  if (!out.good()) {
2282  Error("OptimizeVoxels", "cannot open file");
2283  return;
2284  }
2285  // write header
2286  TDatime t;
2287  TString sname(fname);
2288  sname.ReplaceAll(".C", "");
2289  out << sname.Data()<<"()"<<std::endl;
2290  out << "{" << std::endl;
2291  out << "//=== Macro generated by ROOT version "<< gROOT->GetVersion()<<" : "<<t.AsString()<<std::endl;
2292  out << "//=== Voxel optimization for " << GetTitle() << " geometry"<<std::endl;
2293  out << "//===== <run this macro JUST BEFORE closing the geometry>"<<std::endl;
2294  out << " TGeoVolume *vol = 0;"<<std::endl;
2295  out << " // parse all voxelized volumes"<<std::endl;
2296  TGeoVolume *vol = 0;
2297  Bool_t cyltype;
2298  TIter next(fVolumes);
2299  while ((vol=(TGeoVolume*)next())) {
2300  if (!vol->GetVoxels()) continue;
2301  out<<" vol = gGeoManager->GetVolume(\""<<vol->GetName()<<"\");"<<std::endl;
2302  cyltype = vol->OptimizeVoxels();
2303  if (cyltype) {
2304  out<<" vol->SetCylVoxels();"<<std::endl;
2305  } else {
2306  out<<" vol->SetCylVoxels(kFALSE);"<<std::endl;
2307  }
2308  }
2309  out << "}" << std::endl;
2310  out.close();
2311 }
2312 ////////////////////////////////////////////////////////////////////////////////
2313 /// Parse a string boolean expression and do a syntax check. Find top
2314 /// level boolean operator and returns its type. Fill the two
2315 /// substrings to which this operator applies. The returned integer is :
2316 /// - -1 : parse error
2317 /// - 0 : no boolean operator
2318 /// - 1 : union - represented as '+' in expression
2319 /// - 2 : difference (subtraction) - represented as '-' in expression
2320 /// - 3 : intersection - represented as '*' in expression.
2321 /// Parentheses should be used to avoid ambiguities. For instance :
2322 /// - A+B-C will be interpreted as (A+B)-C which is not the same as A+(B-C)
2323 /// eliminate not needed parentheses
2324 
2325 Int_t TGeoManager::Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3)
2326 {
2327  TString startstr(expr);
2328  Int_t len = startstr.Length();
2329  Int_t i;
2330  TString e0 = "";
2331  expr3 = "";
2332  // eliminate blanks
2333  for (i=0; i< len; i++) {
2334  if (startstr(i)==' ') continue;
2335  e0 += startstr(i, 1);
2336  }
2337  Int_t level = 0;
2338  Int_t levmin = 999;
2339  Int_t boolop = 0;
2340  Int_t indop = 0;
2341  Int_t iloop = 1;
2342  Int_t lastop = 0;
2343  Int_t lastdp = 0;
2344  Int_t lastpp = 0;
2345  Bool_t foundmat = kFALSE;
2346  // check/eliminate parentheses
2347  while (iloop==1) {
2348  iloop = 0;
2349  lastop = 0;
2350  lastdp = 0;
2351  lastpp = 0;
2352  len = e0.Length();
2353  for (i=0; i<len; i++) {
2354  if (e0(i)=='(') {
2355  if (!level) iloop++;
2356  level++;
2357  continue;
2358  }
2359  if (e0(i)==')') {
2360  level--;
2361  if (level==0) lastpp=i;
2362  continue;
2363  }
2364  if ((e0(i)=='+') || (e0(i)=='-') || (e0(i)=='*')) {
2365  lastop = i;
2366  if (level<levmin) {
2367  levmin = level;
2368  indop = i;
2369  }
2370  continue;
2371  }
2372  if ((e0(i)==':') && (level==0)) {
2373  lastdp = i;
2374  continue;
2375  }
2376  }
2377  if (level!=0) {
2378  if (gGeoManager) gGeoManager->Error("Parse","parentheses does not match");
2379  return -1;
2380  }
2381  if (iloop==1 && (e0(0)=='(') && (e0(len-1)==')')) {
2382  // eliminate extra parentheses
2383  e0=e0(1, len-2);
2384  continue;
2385  }
2386  if (foundmat) break;
2387  if (((lastop==0) && (lastdp>0)) || ((lastpp>0) && (lastdp>lastpp) && (indop<lastpp))) {
2388  expr3 = e0(lastdp+1, len-lastdp);
2389  e0=e0(0, lastdp);
2390  foundmat = kTRUE;
2391  iloop = 1;
2392  continue;
2393  } else break;
2394  }
2395  // loop expression and search parentheses/operators
2396  levmin = 999;
2397  for (i=0; i<len; i++) {
2398  if (e0(i)=='(') {
2399  level++;
2400  continue;
2401  }
2402  if (e0(i)==')') {
2403  level--;
2404  continue;
2405  }
2406  // Take LAST operator at lowest level (revision 28/07/08)
2407  if (level<=levmin) {
2408  if (e0(i)=='+') {
2409  boolop = 1; // union
2410  levmin = level;
2411  indop = i;
2412  }
2413  if (e0(i)=='-') {
2414  boolop = 2; // difference
2415  levmin = level;
2416  indop = i;
2417  }
2418  if (e0(i)=='*') {
2419  boolop = 3; // intersection
2420  levmin = level;
2421  indop = i;
2422  }
2423  }
2424  }
2425  if (indop==0) {
2426  expr1=e0;
2427  return indop;
2428  }
2429  expr1 = e0(0, indop);
2430  expr2 = e0(indop+1, len-indop);
2431  return boolop;
2432 }
2433 
2434 
2435 ////////////////////////////////////////////////////////////////////////////////
2436 /// Save current attributes in a macro
2437 
2438 void TGeoManager::SaveAttributes(const char *filename)
2439 {
2440  if (!fTopNode) {
2441  Error("SaveAttributes","geometry must be closed first\n");
2442  return;
2443  }
2444  std::ofstream out;
2445  TString fname(filename);
2446  if (fname.IsNull()) fname = "tgeoatt.C";
2447  out.open(fname, std::ios::out);
2448  if (!out.good()) {
2449  Error("SaveAttributes", "cannot open file");
2450  return;
2451  }
2452  // write header
2453  TDatime t;
2454  TString sname(fname);
2455  sname.ReplaceAll(".C", "");
2456  out << sname.Data()<<"()"<<std::endl;
2457  out << "{" << std::endl;
2458  out << "//=== Macro generated by ROOT version "<< gROOT->GetVersion()<<" : "<<t.AsString()<<std::endl;
2459  out << "//=== Attributes for " << GetTitle() << " geometry"<<std::endl;
2460  out << "//===== <run this macro AFTER loading the geometry in memory>"<<std::endl;
2461  // save current top volume
2462  out << " TGeoVolume *top = gGeoManager->GetVolume(\""<<fTopVolume->GetName()<<"\");"<<std::endl;
2463  out << " TGeoVolume *vol = 0;"<<std::endl;
2464  out << " TGeoNode *node = 0;"<<std::endl;
2465  out << " // clear all volume attributes and get painter"<<std::endl;
2466  out << " gGeoManager->ClearAttributes();"<<std::endl;
2467  out << " gGeoManager->GetGeomPainter();"<<std::endl;
2468  out << " // set visualization modes and bomb factors"<<std::endl;
2469  out << " gGeoManager->SetVisOption("<<GetVisOption()<<");"<<std::endl;
2470  out << " gGeoManager->SetVisLevel("<<GetVisLevel()<<");"<<std::endl;
2471  out << " gGeoManager->SetExplodedView("<<GetBombMode()<<");"<<std::endl;
2472  Double_t bombx, bomby, bombz, bombr;
2473  GetBombFactors(bombx, bomby, bombz, bombr);
2474  out << " gGeoManager->SetBombFactors("<<bombx<<","<<bomby<<","<<bombz<<","<<bombr<<");"<<std::endl;
2475  out << " // iterate volumes container and set new attributes"<<std::endl;
2476 // out << " TIter next(gGeoManager->GetListOfVolumes());"<<std::endl;
2477  TGeoVolume *vol = 0;
2478  fTopNode->SaveAttributes(out);
2479 
2480  TIter next(fVolumes);
2481  while ((vol=(TGeoVolume*)next())) {
2482  vol->SetVisStreamed(kFALSE);
2483  }
2484  out << " // draw top volume with new settings"<<std::endl;
2485  out << " top->Draw();"<<std::endl;
2486  out << " gPad->x3d();"<<std::endl;
2487  out << "}" << std::endl;
2488  out.close();
2489 }
2490 
2491 ////////////////////////////////////////////////////////////////////////////////
2492 /// Returns the deepest node containing fPoint, which must be set a priori.
2493 
2494 TGeoNode *TGeoManager::SearchNode(Bool_t downwards, const TGeoNode *skipnode)
2495 {
2496  return GetCurrentNavigator()->SearchNode(downwards, skipnode);
2497 }
2498 
2499 ////////////////////////////////////////////////////////////////////////////////
2500 /// Cross next boundary and locate within current node
2501 /// The current point must be on the boundary of fCurrentNode.
2502 
2504 {
2505  return GetCurrentNavigator()->CrossBoundaryAndLocate(downwards, skipnode);
2506 }
2507 
2508 ////////////////////////////////////////////////////////////////////////////////
2509 /// Compute distance to next boundary within STEPMAX. If no boundary is found,
2510 /// propagate current point along current direction with fStep=STEPMAX. Otherwise
2511 /// propagate with fStep=SNEXT (distance to boundary) and locate/return the next
2512 /// node.
2513 
2515 {
2516  return GetCurrentNavigator()->FindNextBoundaryAndStep(stepmax, compsafe);
2517 }
2518 
2519 ////////////////////////////////////////////////////////////////////////////////
2520 /// Find distance to next boundary and store it in fStep. Returns node to which this
2521 /// boundary belongs. If PATH is specified, compute only distance to the node to which
2522 /// PATH points. If STEPMAX is specified, compute distance only in case fSafety is smaller
2523 /// than this value. STEPMAX represent the step to be made imposed by other reasons than
2524 /// geometry (usually physics processes). Therefore in this case this method provides the
2525 /// answer to the question : "Is STEPMAX a safe step ?" returning a NULL node and filling
2526 /// fStep with a big number.
2527 /// In case frombdr=kTRUE, the isotropic safety is set to zero.
2528 ///
2529 /// Note : safety distance for the current point is computed ONLY in case STEPMAX is
2530 /// specified, otherwise users have to call explicitly TGeoManager::Safety() if
2531 /// they want this computed for the current point.
2532 
2533 TGeoNode *TGeoManager::FindNextBoundary(Double_t stepmax, const char *path, Bool_t frombdr)
2534 {
2535  // convert current point and direction to local reference
2536  return GetCurrentNavigator()->FindNextBoundary(stepmax,path, frombdr);
2537 }
2538 
2539 ////////////////////////////////////////////////////////////////////////////////
2540 /// Computes as fStep the distance to next daughter of the current volume.
2541 /// The point and direction must be converted in the coordinate system of the current volume.
2542 /// The proposed step limit is fStep.
2543 
2545 {
2546  return GetCurrentNavigator()->FindNextDaughterBoundary(point, dir, idaughter, compmatrix);
2547 }
2548 
2549 ////////////////////////////////////////////////////////////////////////////////
2550 /// Reset current state flags.
2551 
2553 {
2555 }
2556 
2557 ////////////////////////////////////////////////////////////////////////////////
2558 /// Returns deepest node containing current point.
2559 
2561 {
2562  return GetCurrentNavigator()->FindNode(safe_start);
2563 }
2564 
2565 ////////////////////////////////////////////////////////////////////////////////
2566 /// Returns deepest node containing current point.
2567 
2569 {
2570  return GetCurrentNavigator()->FindNode(x, y, z);
2571 }
2572 
2573 ////////////////////////////////////////////////////////////////////////////////
2574 /// Computes fast normal to next crossed boundary, assuming that the current point
2575 /// is close enough to the boundary. Works only after calling FindNextBoundary.
2576 
2578 {
2579  return GetCurrentNavigator()->FindNormalFast();
2580 }
2581 
2582 ////////////////////////////////////////////////////////////////////////////////
2583 /// Computes normal vector to the next surface that will be or was already
2584 /// crossed when propagating on a straight line from a given point/direction.
2585 /// Returns the normal vector cosines in the MASTER coordinate system. The dot
2586 /// product of the normal and the current direction is positive defined.
2587 
2589 {
2591 }
2592 
2593 ////////////////////////////////////////////////////////////////////////////////
2594 /// Checks if point (x,y,z) is still in the current node.
2595 
2597 {
2598  return GetCurrentNavigator()->IsSameLocation(x,y,z,change);
2599 }
2600 
2601 ////////////////////////////////////////////////////////////////////////////////
2602 /// Check if a new point with given coordinates is the same as the last located one.
2603 
2605 {
2606  return GetCurrentNavigator()->IsSamePoint(x,y,z);
2607 }
2608 
2609 ////////////////////////////////////////////////////////////////////////////////
2610 /// True if current node is in phi range
2611 
2613 {
2614  if (!fPhiCut) return kTRUE;
2615  const Double_t *origin;
2617  origin = ((TGeoBBox*)GetCurrentNavigator()->GetCurrentVolume()->GetShape())->GetOrigin();
2618  Double_t point[3];
2619  LocalToMaster(origin, &point[0]);
2620  Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
2621  if (phi<0) phi+=360.;
2622  if ((phi>=fPhimin) && (phi<=fPhimax)) return kFALSE;
2623  return kTRUE;
2624 }
2625 
2626 ////////////////////////////////////////////////////////////////////////////////
2627 /// Initialize current point and current direction vector (normalized)
2628 /// in MARS. Return corresponding node.
2629 
2631 {
2632  return GetCurrentNavigator()->InitTrack(point, dir);
2633 }
2634 
2635 ////////////////////////////////////////////////////////////////////////////////
2636 /// Initialize current point and current direction vector (normalized)
2637 /// in MARS. Return corresponding node.
2638 
2640 {
2641  return GetCurrentNavigator()->InitTrack(x,y,z,nx,ny,nz);
2642 }
2643 
2644 ////////////////////////////////////////////////////////////////////////////////
2645 /// Inspects path and all flags for the current state.
2646 
2648 {
2650 }
2651 
2652 ////////////////////////////////////////////////////////////////////////////////
2653 /// Get path to the current node in the form /node0/node1/...
2654 
2655 const char *TGeoManager::GetPath() const
2656 {
2657  return GetCurrentNavigator()->GetPath();
2658 }
2659 
2660 ////////////////////////////////////////////////////////////////////////////////
2661 /// Get total size of geometry in bytes.
2662 
2664 {
2665  Int_t count = 0;
2666  TIter next(fVolumes);
2667  TGeoVolume *vol;
2668  while ((vol=(TGeoVolume*)next())) count += vol->GetByteCount();
2669  TIter next1(fMatrices);
2670  TGeoMatrix *matrix;
2671  while ((matrix=(TGeoMatrix*)next1())) count += matrix->GetByteCount();
2672  TIter next2(fMaterials);
2673  TGeoMaterial *mat;
2674  while ((mat=(TGeoMaterial*)next2())) count += mat->GetByteCount();
2675  TIter next3(fMedia);
2676  TGeoMedium *med;
2677  while ((med=(TGeoMedium*)next3())) count += med->GetByteCount();
2678  if (fgVerboseLevel>0) Info("GetByteCount","Total size of logical tree : %i bytes", count);
2679  return count;
2680 }
2681 
2682 ////////////////////////////////////////////////////////////////////////////////
2683 /// Make a default painter if none present. Returns pointer to it.
2684 
2686 {
2687  if (!fPainter) {
2688  const char *kind = "root";
2689  if (gROOT->IsWebDisplay() && !gROOT->IsWebDisplayBatch()) kind = "web";
2690  if (auto h = gROOT->GetPluginManager()->FindHandler("TVirtualGeoPainter", kind)) {
2691  if (h->LoadPlugin() == -1) {
2692  Error("GetGeomPainter", "could not load plugin for %s geo_painter", kind);
2693  return nullptr;
2694  }
2695  fPainter = (TVirtualGeoPainter*)h->ExecPlugin(1,this);
2696  if (!fPainter) {
2697  Error("GetGeomPainter", "could not create %s geo_painter", kind);
2698  return nullptr;
2699  }
2700  } else {
2701  Error("GetGeomPainter", "not found plugin %s for geo_painter", kind);
2702  }
2703  }
2704  return fPainter;
2705 }
2706 
2707 ////////////////////////////////////////////////////////////////////////////////
2708 /// Search for a named volume. All trailing blanks stripped.
2709 
2711 {
2712  TString sname = name;
2713  sname = sname.Strip();
2714  TGeoVolume *vol = (TGeoVolume*)fVolumes->FindObject(sname.Data());
2715  return vol;
2716 }
2717 
2718 ////////////////////////////////////////////////////////////////////////////////
2719 /// Fast search for a named volume. All trailing blanks stripped.
2720 
2722 {
2723  if (!fHashVolumes) {
2724  Int_t nvol = fVolumes->GetEntriesFast();
2725  Int_t ngvol = fGVolumes->GetEntriesFast();
2726  fHashVolumes = new THashList(nvol+1);
2727  fHashGVolumes = new THashList(ngvol+1);
2728  Int_t i;
2729  for (i=0; i<ngvol; i++) fHashGVolumes->AddLast(fGVolumes->At(i));
2730  for (i=0; i<nvol; i++) fHashVolumes->AddLast(fVolumes->At(i));
2731  }
2732  TString sname = name;
2733  sname = sname.Strip();
2734  THashList *list = fHashVolumes;
2735  if (multi) list = fHashGVolumes;
2736  TGeoVolume *vol = (TGeoVolume*)list->FindObject(sname.Data());
2737  return vol;
2738 }
2739 
2740 ////////////////////////////////////////////////////////////////////////////////
2741 /// Retrieve unique id for a volume name. Return -1 if name not found.
2742 
2743 Int_t TGeoManager::GetUID(const char *volname) const
2744 {
2745  TGeoManager *geom = (TGeoManager*)this;
2746  TGeoVolume *vol = geom->FindVolumeFast(volname, kFALSE);
2747  if (!vol) vol = geom->FindVolumeFast(volname, kTRUE);
2748  if (!vol) return -1;
2749  return vol->GetNumber();
2750 }
2751 
2752 ////////////////////////////////////////////////////////////////////////////////
2753 /// Find if a given material duplicates an existing one.
2754 
2756 {
2757  Int_t index = fMaterials->IndexOf(mat);
2758  if (index <= 0) return 0;
2759  TGeoMaterial *other;
2760  for (Int_t i=0; i<index; i++) {
2761  other = (TGeoMaterial*)fMaterials->At(i);
2762  if (other == mat) continue;
2763  if (other->IsEq(mat)) return other;
2764  }
2765  return 0;
2766 }
2767 
2768 ////////////////////////////////////////////////////////////////////////////////
2769 /// Search for a named material. All trailing blanks stripped.
2770 
2771 TGeoMaterial *TGeoManager::GetMaterial(const char *matname) const
2772 {
2773  TString sname = matname;
2774  sname = sname.Strip();
2775  TGeoMaterial *mat = (TGeoMaterial*)fMaterials->FindObject(sname.Data());
2776  return mat;
2777 }
2778 
2779 ////////////////////////////////////////////////////////////////////////////////
2780 /// Search for a named tracking medium. All trailing blanks stripped.
2781 
2782 TGeoMedium *TGeoManager::GetMedium(const char *medium) const
2783 {
2784  TString sname = medium;
2785  sname = sname.Strip();
2786  TGeoMedium *med = (TGeoMedium*)fMedia->FindObject(sname.Data());
2787  return med;
2788 }
2789 
2790 ////////////////////////////////////////////////////////////////////////////////
2791 /// Search for a tracking medium with a given ID.
2792 
2794 {
2795  TIter next(fMedia);
2796  TGeoMedium *med;
2797  while ((med=(TGeoMedium*)next())) {
2798  if (med->GetId()==numed) return med;
2799  }
2800  return 0;
2801 }
2802 
2803 ////////////////////////////////////////////////////////////////////////////////
2804 /// Return material at position id.
2805 
2807 {
2808  if (id<0 || id >= fMaterials->GetSize()) return 0;
2809  TGeoMaterial *mat = (TGeoMaterial*)fMaterials->At(id);
2810  return mat;
2811 }
2812 
2813 ////////////////////////////////////////////////////////////////////////////////
2814 /// Return index of named material.
2815 
2816 Int_t TGeoManager::GetMaterialIndex(const char *matname) const
2817 {
2818  TIter next(fMaterials);
2819  TGeoMaterial *mat;
2820  Int_t id = 0;
2821  TString sname = matname;
2822  sname = sname.Strip();
2823  while ((mat = (TGeoMaterial*)next())) {
2824  if (!strcmp(mat->GetName(),sname.Data()))
2825  return id;
2826  id++;
2827  }
2828  return -1; // fail
2829 }
2830 
2831 ////////////////////////////////////////////////////////////////////////////////
2832 /// Randomly shoot nrays and plot intersections with surfaces for current
2833 /// top node.
2834 
2835 void TGeoManager::RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol, Bool_t check_norm)
2836 {
2837  GetGeomPainter()->RandomRays(nrays, startx, starty, startz, target_vol, check_norm);
2838 }
2839 
2840 ////////////////////////////////////////////////////////////////////////////////
2841 /// Remove material at given index.
2842 
2844 {
2845  TObject *obj = fMaterials->At(index);
2846  if (obj) fMaterials->Remove(obj);
2847 }
2848 
2849 ////////////////////////////////////////////////////////////////////////////////
2850 /// Sets all pointers TGeoVolume::fField to NULL. User data becomes decoupled
2851 /// from geometry. Deletion has to be managed by users.
2852 
2854 {
2855  TIter next(fVolumes);
2856  TGeoVolume *vol;
2857  while ((vol=(TGeoVolume*)next())) vol->SetField(0);
2858 }
2859 
2860 ////////////////////////////////////////////////////////////////////////////////
2861 /// Change raytracing mode.
2862 
2864 {
2865  fRaytraceMode = mode;
2867 }
2868 
2869 ////////////////////////////////////////////////////////////////////////////////
2870 /// Restore the master volume of the geometry.
2871 
2873 {
2874  if (fTopVolume == fMasterVolume) return;
2876 }
2877 
2878 ////////////////////////////////////////////////////////////////////////////////
2879 /// Voxelize all non-divided volumes.
2880 
2882 {
2883  TGeoVolume *vol;
2884 // TGeoVoxelFinder *vox = 0;
2885  if (!fStreamVoxels && fgVerboseLevel>0) Info("Voxelize","Voxelizing...");
2886 // Int_t nentries = fVolumes->GetSize();
2887  TIter next(fVolumes);
2888  while ((vol = (TGeoVolume*)next())) {
2889  if (!fIsGeomReading) vol->SortNodes();
2890  if (!fStreamVoxels) {
2891  vol->Voxelize(option);
2892  }
2893  if (!fIsGeomReading) vol->FindOverlaps();
2894  }
2895 }
2896 
2897 ////////////////////////////////////////////////////////////////////////////////
2898 /// Send "Modified" signal to painter.
2899 
2901 {
2902  if (!fPainter) return;
2903  fPainter->ModifiedPad();
2904 }
2905 
2906 ////////////////////////////////////////////////////////////////////////////////
2907 /// Make an TGeoArb8 volume.
2908 
2910  Double_t dz, Double_t *vertices)
2911 {
2912  return TGeoBuilder::Instance(this)->MakeArb8(name, medium, dz, vertices);
2913 }
2914 
2915 ////////////////////////////////////////////////////////////////////////////////
2916 /// Make in one step a volume pointing to a box shape with given medium.
2917 
2919  Double_t dx, Double_t dy, Double_t dz)
2920 {
2921  return TGeoBuilder::Instance(this)->MakeBox(name, medium, dx, dy, dz);
2922 }
2923 
2924 ////////////////////////////////////////////////////////////////////////////////
2925 /// Make in one step a volume pointing to a parallelepiped shape with given medium.
2926 
2928  Double_t dx, Double_t dy, Double_t dz,
2929  Double_t alpha, Double_t theta, Double_t phi)
2930 {
2931  return TGeoBuilder::Instance(this)->MakePara(name, medium, dx, dy, dz, alpha, theta, phi);
2932 }
2933 
2934 ////////////////////////////////////////////////////////////////////////////////
2935 /// Make in one step a volume pointing to a sphere shape with given medium
2936 
2938  Double_t rmin, Double_t rmax, Double_t themin, Double_t themax,
2939  Double_t phimin, Double_t phimax)
2940 {
2941  return TGeoBuilder::Instance(this)->MakeSphere(name, medium, rmin, rmax, themin, themax, phimin, phimax);
2942 }
2943 
2944 ////////////////////////////////////////////////////////////////////////////////
2945 /// Make in one step a volume pointing to a torus shape with given medium.
2946 
2948  Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi)
2949 {
2950  return TGeoBuilder::Instance(this)->MakeTorus(name, medium, r, rmin, rmax, phi1, dphi);
2951 }
2952 
2953 ////////////////////////////////////////////////////////////////////////////////
2954 /// Make in one step a volume pointing to a tube shape with given medium.
2955 
2957  Double_t rmin, Double_t rmax, Double_t dz)
2958 {
2959  return TGeoBuilder::Instance(this)->MakeTube(name, medium, rmin, rmax, dz);
2960 }
2961 
2962 ////////////////////////////////////////////////////////////////////////////////
2963 /// Make in one step a volume pointing to a tube segment shape with given medium.
2964 /// The segment will be from phiStart to phiEnd, the angles are expressed in degree
2965 
2967  Double_t rmin, Double_t rmax, Double_t dz,
2968  Double_t phiStart, Double_t phiEnd)
2969 {
2970  return TGeoBuilder::Instance(this)->MakeTubs(name, medium, rmin, rmax, dz, phiStart, phiEnd);
2971 }
2972 
2973 ////////////////////////////////////////////////////////////////////////////////
2974 /// Make in one step a volume pointing to a tube shape with given medium
2975 
2977  Double_t a, Double_t b, Double_t dz)
2978 {
2979  return TGeoBuilder::Instance(this)->MakeEltu(name, medium, a, b, dz);
2980 }
2981 
2982 ////////////////////////////////////////////////////////////////////////////////
2983 /// Make in one step a volume pointing to a tube shape with given medium
2984 
2986  Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
2987 {
2988  return TGeoBuilder::Instance(this)->MakeHype(name, medium, rin, stin, rout, stout, dz);
2989 }
2990 
2991 ////////////////////////////////////////////////////////////////////////////////
2992 /// Make in one step a volume pointing to a tube shape with given medium
2993 
2995  Double_t rlo, Double_t rhi, Double_t dz)
2996 {
2997  return TGeoBuilder::Instance(this)->MakeParaboloid(name, medium, rlo, rhi, dz);
2998 }
2999 
3000 ////////////////////////////////////////////////////////////////////////////////
3001 /// Make in one step a volume pointing to a tube segment shape with given medium
3002 
3004  Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2,
3005  Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
3006 {
3007  return TGeoBuilder::Instance(this)->MakeCtub(name, medium, rmin, rmax, dz, phi1, phi2, lx, ly, lz, tx, ty, tz);
3008 }
3009 
3010 ////////////////////////////////////////////////////////////////////////////////
3011 /// Make in one step a volume pointing to a cone shape with given medium.
3012 
3014  Double_t dz, Double_t rmin1, Double_t rmax1,
3015  Double_t rmin2, Double_t rmax2)
3016 {
3017  return TGeoBuilder::Instance(this)->MakeCone(name, medium, dz, rmin1, rmax1, rmin2, rmax2);
3018 }
3019 
3020 ////////////////////////////////////////////////////////////////////////////////
3021 /// Make in one step a volume pointing to a cone segment shape with given medium
3022 
3024  Double_t dz, Double_t rmin1, Double_t rmax1,
3025  Double_t rmin2, Double_t rmax2,
3026  Double_t phi1, Double_t phi2)
3027 {
3028  return TGeoBuilder::Instance(this)->MakeCons(name, medium, dz, rmin1, rmax1, rmin2, rmax2, phi1, phi2);
3029 }
3030 
3031 ////////////////////////////////////////////////////////////////////////////////
3032 /// Make in one step a volume pointing to a polycone shape with given medium.
3033 
3035  Double_t phi, Double_t dphi, Int_t nz)
3036 {
3037  return TGeoBuilder::Instance(this)->MakePcon(name, medium, phi, dphi, nz);
3038 }
3039 
3040 ////////////////////////////////////////////////////////////////////////////////
3041 /// Make in one step a volume pointing to a polygone shape with given medium.
3042 
3044  Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
3045 {
3046  return TGeoBuilder::Instance(this)->MakePgon(name, medium, phi, dphi, nedges, nz);
3047 }
3048 
3049 ////////////////////////////////////////////////////////////////////////////////
3050 /// Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
3051 
3053  Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
3054 {
3055  return TGeoBuilder::Instance(this)->MakeTrd1(name, medium, dx1, dx2, dy, dz);
3056 }
3057 
3058 ////////////////////////////////////////////////////////////////////////////////
3059 /// Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
3060 
3062  Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2,
3063  Double_t dz)
3064 {
3065  return TGeoBuilder::Instance(this)->MakeTrd2(name, medium, dx1, dx2, dy1, dy2, dz);
3066 }
3067 
3068 ////////////////////////////////////////////////////////////////////////////////
3069 /// Make in one step a volume pointing to a trapezoid shape with given medium.
3070 
3072  Double_t dz, Double_t theta, Double_t phi, Double_t h1,
3073  Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2,
3074  Double_t tl2, Double_t alpha2)
3075 {
3076  return TGeoBuilder::Instance(this)->MakeTrap(name, medium, dz, theta, phi, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2);
3077 }
3078 
3079 ////////////////////////////////////////////////////////////////////////////////
3080 /// Make in one step a volume pointing to a twisted trapezoid shape with given medium.
3081 
3083  Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1,
3084  Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2,
3085  Double_t tl2, Double_t alpha2)
3086 {
3087  return TGeoBuilder::Instance(this)->MakeGtra(name, medium, dz, theta, phi, twist, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2);
3088 }
3089 
3090 ////////////////////////////////////////////////////////////////////////////////
3091 /// Make a TGeoXtru-shaped volume with nz planes
3092 
3094 {
3095  return TGeoBuilder::Instance(this)->MakeXtru(name, medium, nz);
3096 }
3097 
3098 ////////////////////////////////////////////////////////////////////////////////
3099 /// Creates an alignable object with unique name corresponding to a path
3100 /// and adds it to the list of alignables. An optional unique ID can be
3101 /// provided, in which case PN entries can be searched fast by uid.
3102 
3103 TGeoPNEntry *TGeoManager::SetAlignableEntry(const char *unique_name, const char *path,
3104  Int_t uid)
3105 {
3106  if (!CheckPath(path)) return NULL;
3107  if (!fHashPNE) fHashPNE = new THashList(256,3);
3108  if (!fArrayPNE) fArrayPNE = new TObjArray(256);
3109  TGeoPNEntry *entry = GetAlignableEntry(unique_name);
3110  if (entry) {
3111  Error("SetAlignableEntry", "An alignable object with name %s already existing. NOT ADDED !", unique_name);
3112  return 0;
3113  }
3114  entry = new TGeoPNEntry(unique_name, path);
3115  Int_t ientry = fHashPNE->GetSize();
3116  fHashPNE->Add(entry);
3117  fArrayPNE->AddAtAndExpand(entry, ientry);
3118  if (uid>=0) {
3119  Bool_t added = InsertPNEId(uid, ientry);
3120  if (!added) Error("SetAlignableEntry", "A PN entry: has already uid=%i", uid);
3121  }
3122  return entry;
3123 }
3124 
3125 ////////////////////////////////////////////////////////////////////////////////
3126 /// Retrieves an existing alignable object.
3127 
3129 {
3130  if (!fHashPNE) return 0;
3131  return (TGeoPNEntry*)fHashPNE->FindObject(name);
3132 }
3133 
3134 ////////////////////////////////////////////////////////////////////////////////
3135 /// Retrieves an existing alignable object at a given index.
3136 
3138 {
3139  if (!fArrayPNE && !InitArrayPNE()) return 0;
3140  return (TGeoPNEntry*)fArrayPNE->At(index);
3141 }
3142 
3143 ////////////////////////////////////////////////////////////////////////////////
3144 /// Retrieves an existing alignable object having a preset UID.
3145 
3147 {
3148  if (!fNPNEId || (!fArrayPNE && !InitArrayPNE())) return NULL;
3149  Int_t index = TMath::BinarySearch(fNPNEId, fKeyPNEId, uid);
3150  if (index<0 || fKeyPNEId[index]!=uid) return NULL;
3151  return (TGeoPNEntry*)fArrayPNE->At(fValuePNEId[index]);
3152 }
3153 
3154 ////////////////////////////////////////////////////////////////////////////////
3155 /// Retrieves number of PN entries with or without UID.
3156 
3158 {
3159  if (!fHashPNE) return 0;
3160  if (with_uid) return fNPNEId;
3161  return fHashPNE->GetSize();
3162 }
3163 
3164 ////////////////////////////////////////////////////////////////////////////////
3165 /// Insert a PN entry in the sorted array of indexes.
3166 
3168 {
3169  if (!fSizePNEId) {
3170  // Create the arrays.
3171  fSizePNEId = 128;
3172  fKeyPNEId = new Int_t[fSizePNEId];
3173  memset(fKeyPNEId, 0, fSizePNEId*sizeof(Int_t));
3174  fValuePNEId = new Int_t[fSizePNEId];
3175  memset(fValuePNEId, 0, fSizePNEId*sizeof(Int_t));
3176  fKeyPNEId[fNPNEId] = uid;
3177  fValuePNEId[fNPNEId++] = ientry;
3178  return kTRUE;
3179  }
3180  // Search id in the existing array and return false if it already exists.
3181  Int_t index = TMath::BinarySearch(fNPNEId, fKeyPNEId, uid);
3182  if (index>0 && fKeyPNEId[index]==uid) return kFALSE;
3183  // Resize the arrays and insert the value
3184  Bool_t resize = (fNPNEId==fSizePNEId)?kTRUE:kFALSE;
3185  if (resize) {
3186  // Double the size of the array
3187  fSizePNEId *= 2;
3188  // Create new arrays of keys and values
3189  Int_t *keys = new Int_t[fSizePNEId];
3190  memset(keys, 0, fSizePNEId*sizeof(Int_t));
3191  Int_t *values = new Int_t[fSizePNEId];
3192  memset(values, 0, fSizePNEId*sizeof(Int_t));
3193  // Copy all keys<uid in the new keys array (0 to index)
3194  memcpy(keys, fKeyPNEId, (index+1)*sizeof(Int_t));
3195  memcpy(values, fValuePNEId, (index+1)*sizeof(Int_t));
3196  // Insert current key at index+1
3197  keys[index+1] = uid;
3198  values[index+1] = ientry;
3199  // Copy all remaining keys from the old to new array
3200  memcpy(&keys[index+2], &fKeyPNEId[index+1], (fNPNEId-index-1)*sizeof(Int_t));
3201  memcpy(&values[index+2], &fValuePNEId[index+1], (fNPNEId-index-1)*sizeof(Int_t));
3202  delete [] fKeyPNEId;
3203  fKeyPNEId = keys;
3204  delete [] fValuePNEId;
3205  fValuePNEId = values;
3206  fNPNEId++;
3207  return kTRUE;
3208  }
3209  // Insert the value in the existing arrays
3210  Int_t i;
3211  for (i=fNPNEId-1; i>index; i--) {
3212  fKeyPNEId[i+1] = fKeyPNEId[i];
3213  fValuePNEId[i+1] = fValuePNEId[i];
3214  }
3215  fKeyPNEId[index+1] = uid;
3216  fValuePNEId[index+1] = ientry;
3217  fNPNEId++;
3218  return kTRUE;
3219 }
3220 
3221 ////////////////////////////////////////////////////////////////////////////////
3222 /// Make a physical node from the path pointed by an alignable object with a given name.
3223 
3225 {
3227  if (!entry) {
3228  Error("MakeAlignablePN","No alignable object named %s found !", name);
3229  return 0;
3230  }
3231  return MakeAlignablePN(entry);
3232 }
3233 
3234 ////////////////////////////////////////////////////////////////////////////////
3235 /// Make a physical node from the path pointed by a given alignable object.
3236 
3238 {
3239  if (!entry) {
3240  Error("MakeAlignablePN","No alignable object specified !");
3241  return 0;
3242  }
3243  const char *path = entry->GetTitle();
3244  if (!cd(path)) {
3245  Error("MakeAlignablePN", "Alignable object %s poins to invalid path: %s",
3246  entry->GetName(), path);
3247  return 0;
3248  }
3249  TGeoPhysicalNode *node = MakePhysicalNode(path);
3250  entry->SetPhysicalNode(node);
3251  return node;
3252 }
3253 
3254 ////////////////////////////////////////////////////////////////////////////////
3255 /// Makes a physical node corresponding to a path. If PATH is not specified,
3256 /// makes physical node matching current modeller state.
3257 
3259 {
3260  TGeoPhysicalNode *node;
3261  if (path) {
3262  if (!CheckPath(path)) {
3263  Error("MakePhysicalNode", "path: %s not valid", path);
3264  return NULL;
3265  }
3266  node = new TGeoPhysicalNode(path);
3267  } else {
3268  node = new TGeoPhysicalNode(GetPath());
3269  }
3270  fPhysicalNodes->Add(node);
3271  return node;
3272 }
3273 
3274 ////////////////////////////////////////////////////////////////////////////////
3275 /// Refresh physical nodes to reflect the actual geometry paths after alignment
3276 /// was applied. Optionally locks physical nodes (default).
3277 
3279 {
3281  TGeoPhysicalNode *pn;
3282  while ((pn=(TGeoPhysicalNode*)next())) pn->Refresh();
3284  if (lock) LockGeometry();
3285 }
3286 
3287 ////////////////////////////////////////////////////////////////////////////////
3288 /// Clear the current list of physical nodes, so that we can start over with a new list.
3289 /// If MUSTDELETE is true, delete previous nodes.
3290 
3292 {
3293  if (mustdelete) fPhysicalNodes->Delete();
3294  else fPhysicalNodes->Clear();
3295 }
3296 
3297 ////////////////////////////////////////////////////////////////////////////////
3298 /// Make an assembly of volumes.
3299 
3301 {
3303 }
3304 
3305 ////////////////////////////////////////////////////////////////////////////////
3306 /// Make a TGeoVolumeMulti handling a list of volumes.
3307 
3309 {
3310  return TGeoBuilder::Instance(this)->MakeVolumeMulti(name, medium);
3311 }
3312 
3313 ////////////////////////////////////////////////////////////////////////////////
3314 /// Set type of exploding view (see TGeoPainter::SetExplodedView())
3315 
3317 {
3318  if ((ibomb>=0) && (ibomb<4)) fExplodedView = ibomb;
3319  if (fPainter) fPainter->SetExplodedView(ibomb);
3320 }
3321 
3322 ////////////////////////////////////////////////////////////////////////////////
3323 /// Set cut phi range
3324 
3326 {
3327  if ((phimin==0) && (phimax==360)) {
3328  fPhiCut = kFALSE;
3329  return;
3330  }
3331  fPhiCut = kTRUE;
3332  fPhimin = phimin;
3333  fPhimax = phimax;
3334 }
3335 
3336 ////////////////////////////////////////////////////////////////////////////////
3337 /// Set number of segments for approximating circles in drawing.
3338 
3340 {
3341  if (fNsegments==nseg) return;
3342  if (nseg>2) fNsegments = nseg;
3343  if (fPainter) fPainter->SetNsegments(nseg);
3344 }
3345 
3346 ////////////////////////////////////////////////////////////////////////////////
3347 /// Get number of segments approximating circles
3348 
3350 {
3351  return fNsegments;
3352 }
3353 
3354 ////////////////////////////////////////////////////////////////////////////////
3355 /// Now just a shortcut for GetElementTable.
3356 
3358 {
3359  GetElementTable();
3361 }
3362 
3363 ////////////////////////////////////////////////////////////////////////////////
3364 /// Returns material table. Creates it if not existing.
3365 
3367 {
3368  if (!fElementTable) fElementTable = new TGeoElementTable(200);
3369  return fElementTable;
3370 }
3371 
3372 ////////////////////////////////////////////////////////////////////////////////
3373 /// Make a rectilinear step of length fStep from current point (fPoint) on current
3374 /// direction (fDirection). If the step is imposed by geometry, is_geom flag
3375 /// must be true (default). The cross flag specifies if the boundary should be
3376 /// crossed in case of a geometry step (default true). Returns new node after step.
3377 /// Set also on boundary condition.
3378 
3380 {
3381  return GetCurrentNavigator()->Step(is_geom, cross);
3382 }
3383 
3384 ////////////////////////////////////////////////////////////////////////////////
3385 /// shoot npoints randomly in a box of 1E-5 around current point.
3386 /// return minimum distance to points outside
3387 
3389  const char* g3path)
3390 {
3391  return GetGeomPainter()->SamplePoints(npoints, dist, epsil, g3path);
3392 }
3393 
3394 ////////////////////////////////////////////////////////////////////////////////
3395 /// Set the top volume and corresponding node as starting point of the geometry.
3396 
3398 {
3399  if (fTopVolume==vol) return;
3400 
3401  TSeqCollection *brlist = gROOT->GetListOfBrowsers();
3402  TIter next(brlist);
3403  TBrowser *browser = 0;
3404 
3405  if (fTopVolume) fTopVolume->SetTitle("");
3406  fTopVolume = vol;
3407  vol->SetTitle("Top volume");
3408  if (fTopNode) {
3409  TGeoNode *topn = fTopNode;
3410  fTopNode = 0;
3411  while ((browser=(TBrowser*)next())) browser->RecursiveRemove(topn);
3412  delete topn;
3413  } else {
3414  fMasterVolume = vol;
3415  fMasterVolume->Grab();
3417  if (fgVerboseLevel>0) Info("SetTopVolume","Top volume is %s. Master volume is %s", fTopVolume->GetName(),
3418  fMasterVolume->GetName());
3419  }
3420 // fMasterVolume->FindMatrixOfDaughterVolume(vol);
3421 // fCurrentMatrix->Print();
3422  fTopNode = new TGeoNodeMatrix(vol, gGeoIdentity);
3423  fTopNode->SetName(TString::Format("%s_1",vol->GetName()));
3424  fTopNode->SetNumber(1);
3425  fTopNode->SetTitle("Top logical node");
3426  fNodes->AddAt(fTopNode, 0);
3427  if (!GetCurrentNavigator()) {
3429  return;
3430  }
3431  Int_t nnavigators = 0;
3433  if (!arr) return;
3434  nnavigators = arr->GetEntriesFast();
3435  for (Int_t i=0; i<nnavigators; i++) {
3436  TGeoNavigator *nav = (TGeoNavigator*)arr->At(i);
3437  nav->ResetAll();
3438  if (fClosed) nav->GetCache()->BuildInfoBranch();
3439  }
3440 }
3441 
3442 ////////////////////////////////////////////////////////////////////////////////
3443 /// Define different tracking media.
3444 
3446 {
3447 /*
3448  Int_t nmat = fMaterials->GetSize();
3449  if (!nmat) {printf(" No materials !\n"); return;}
3450  Int_t *media = new Int_t[nmat];
3451  memset(media, 0, nmat*sizeof(Int_t));
3452  Int_t imedia = 1;
3453  TGeoMaterial *mat, *matref;
3454  mat = (TGeoMaterial*)fMaterials->At(0);
3455  if (mat->GetMedia()) {
3456  for (Int_t i=0; i<nmat; i++) {
3457  mat = (TGeoMaterial*)fMaterials->At(i);
3458  mat->Print();
3459  }
3460  return;
3461  }
3462  mat->SetMedia(imedia);
3463  media[0] = imedia++;
3464  mat->Print();
3465  for (Int_t i=0; i<nmat; i++) {
3466  mat = (TGeoMaterial*)fMaterials->At(i);
3467  for (Int_t j=0; j<i; j++) {
3468  matref = (TGeoMaterial*)fMaterials->At(j);
3469  if (mat->IsEq(matref)) {
3470  mat->SetMedia(media[j]);
3471  break;
3472  }
3473  if (j==(i-1)) {
3474  // different material
3475  mat->SetMedia(imedia);
3476  media[i] = imedia++;
3477  mat->Print();
3478  }
3479  }
3480  }
3481 */
3482 }
3483 
3484 ////////////////////////////////////////////////////////////////////////////////
3485 /// Check pushes and pulls needed to cross the next boundary with respect to the
3486 /// position given by FindNextBoundary. If radius is not mentioned the full bounding
3487 /// box will be sampled.
3488 
3490 {
3491  GetGeomPainter()->CheckBoundaryErrors(ntracks, radius);
3492 }
3493 
3494 ////////////////////////////////////////////////////////////////////////////////
3495 /// Check the boundary errors reference file created by CheckBoundaryErrors method.
3496 /// The shape for which the crossing failed is drawn with the starting point in red
3497 /// and the extrapolated point to boundary (+/- failing push/pull) in yellow.
3498 
3500 {
3502 }
3503 
3504 ////////////////////////////////////////////////////////////////////////////////
3505 /// Classify a given point. See TGeoChecker::CheckPoint().
3506 
3508 {
3509  GetGeomPainter()->CheckPoint(x,y,z,option);
3510 }
3511 
3512 ////////////////////////////////////////////////////////////////////////////////
3513 /// Test for shape navigation methods. Summary for test numbers:
3514 /// - 1: DistFromInside/Outside. Sample points inside the shape. Generate
3515 /// directions randomly in cos(theta). Compute DistFromInside and move the
3516 /// point with bigger distance. Compute DistFromOutside back from new point.
3517 /// Plot d-(d1+d2)
3518 ///
3519 
3520 void TGeoManager::CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
3521 {
3522  GetGeomPainter()->CheckShape(shape, testNo, nsamples, option);
3523 }
3524 
3525 ////////////////////////////////////////////////////////////////////////////////
3526 /// Geometry checking.
3527 /// - if option contains 'o': Optional overlap checkings (by sampling and by mesh).
3528 /// - if option contains 'b': Optional boundary crossing check + timing per volume.
3529 ///
3530 /// STAGE 1: extensive overlap checking by sampling per volume. Stdout need to be
3531 /// checked by user to get report, then TGeoVolume::CheckOverlaps(0.01, "s") can
3532 /// be called for the suspicious volumes.
3533 ///
3534 /// STAGE 2: normal overlap checking using the shapes mesh - fills the list of
3535 /// overlaps.
3536 ///
3537 /// STAGE 3: shooting NRAYS rays from VERTEX and counting the total number of
3538 /// crossings per volume (rays propagated from boundary to boundary until
3539 /// geometry exit). Timing computed and results stored in a histo.
3540 ///
3541 /// STAGE 4: shooting 1 mil. random rays inside EACH volume and calling
3542 /// FindNextBoundary() + Safety() for each call. The timing is normalized by the
3543 /// number of crossings computed at stage 2 and presented as percentage.
3544 /// One can get a picture on which are the most "burned" volumes during
3545 /// transportation from geometry point of view. Another plot of the timing per
3546 /// volume vs. number of daughters is produced.
3547 
3549 {
3550  TString opt(option);
3551  opt.ToLower();
3552  if (!opt.Length()) {
3553  Error("CheckGeometryFull","The option string must contain a letter. See method documentation.");
3554  return;
3555  }
3556  Bool_t checkoverlaps = opt.Contains("o");
3557  Bool_t checkcrossings = opt.Contains("b");
3558  Double_t vertex[3];
3559  vertex[0] = vx;
3560  vertex[1] = vy;
3561  vertex[2] = vz;
3562  GetGeomPainter()->CheckGeometryFull(checkoverlaps,checkcrossings,ntracks,vertex);
3563 }
3564 
3565 ////////////////////////////////////////////////////////////////////////////////
3566 /// Perform last checks on the geometry
3567 
3569 {
3570  if (fgVerboseLevel>0) Info("CheckGeometry","Fixing runtime shapes...");
3571  TIter next(fShapes);
3572  TIter nextv(fVolumes);
3573  TGeoShape *shape;
3574  TGeoVolume *vol;
3575  Bool_t has_runtime = kFALSE;
3576  while ((shape = (TGeoShape*)next())) {
3577  if (shape->IsRunTimeShape()) {
3578  has_runtime = kTRUE;
3579  }
3580  if (fIsGeomReading) shape->AfterStreamer();
3582  if (!shape->TestShapeBit(TGeoShape::kGeoClosedShape)) shape->ComputeBBox();
3583  }
3584  if (has_runtime) fTopNode->CheckShapes();
3585  else if (fgVerboseLevel>0) Info("CheckGeometry","...Nothing to fix");
3586  // Compute bounding box for assemblies
3588  while ((vol = (TGeoVolume*)nextv())) {
3589  if (vol->IsAssembly()) vol->GetShape()->ComputeBBox();
3590  else if (vol->GetMedium() == dummy) {
3591  Warning("CheckGeometry", "Volume \"%s\" has no medium: assigned dummy medium and material", vol->GetName());
3592  vol->SetMedium(dummy);
3593  }
3594  }
3595 }
3596 
3597 ////////////////////////////////////////////////////////////////////////////////
3598 /// Check all geometry for illegal overlaps within a limit OVLP.
3599 
3601 {
3602  if (!fTopNode) {
3603  Error("CheckOverlaps","Top node not set");
3604  return;
3605  }
3606  fTopNode->CheckOverlaps(ovlp,option);
3607 }
3608 
3609 ////////////////////////////////////////////////////////////////////////////////
3610 /// Prints the current list of overlaps.
3611 
3613 {
3614  if (!fOverlaps) return;
3615  Int_t novlp = fOverlaps->GetEntriesFast();
3616  if (!novlp) return;
3617  TGeoManager *geom = (TGeoManager*)this;
3618  geom->GetGeomPainter()->PrintOverlaps();
3619 }
3620 
3621 ////////////////////////////////////////////////////////////////////////////////
3622 /// Estimate weight of volume VOL with a precision SIGMA(W)/W better than PRECISION.
3623 /// Option can be "v" - verbose (default)
3624 
3626 {
3627  GetGeomPainter();
3628  TString opt(option);
3629  opt.ToLower();
3630  Double_t weight;
3631  TGeoVolume *volume = fTopVolume;
3632  if (opt.Contains("v")) {
3633  if (opt.Contains("a")) {
3634  if (fgVerboseLevel>0) Info("Weight", "Computing analytically weight of %s", volume->GetName());
3635  weight = volume->WeightA();
3636  if (fgVerboseLevel>0) Info("Weight", "Computed weight: %f [kg]\n", weight);
3637  return weight;
3638  }
3639  if (fgVerboseLevel>0) {
3640  Info("Weight", "Estimating weight of %s with %g %% precision", fTopVolume->GetName(), 100.*precision);
3641  printf(" event weight err\n");
3642  printf("========================================\n");
3643  }
3644  }
3645  weight = fPainter->Weight(precision, option);
3646  return weight;
3647 }
3648 
3649 ////////////////////////////////////////////////////////////////////////////////
3650 /// computes the total size in bytes of the branch starting with node.
3651 /// The option can specify if all the branch has to be parsed or only the node
3652 
3653 ULong_t TGeoManager::SizeOf(const TGeoNode * /*node*/, Option_t * /*option*/)
3654 {
3655  return 0;
3656 }
3657 
3658 ////////////////////////////////////////////////////////////////////////////////
3659 /// Stream an object of class TGeoManager.
3660 
3661 void TGeoManager::Streamer(TBuffer &R__b)
3662 {
3663  if (R__b.IsReading()) {
3664  R__b.ReadClassBuffer(TGeoManager::Class(), this);
3666  CloseGeometry();
3669  } else {
3670  R__b.WriteClassBuffer(TGeoManager::Class(), this);
3671  }
3672 }
3673 
3674 ////////////////////////////////////////////////////////////////////////////////
3675 /// Execute mouse actions on this manager.
3676 
3678 {
3679  if (!fPainter) return;
3680  fPainter->ExecuteManagerEvent(this, event, px, py);
3681 }
3682 
3683 ////////////////////////////////////////////////////////////////////////////////
3684 /// Export this geometry to a file
3685 ///
3686 /// - Case 1: root file or root/xml file
3687 /// if filename end with ".root". The key will be named name
3688 /// By default the geometry is saved without the voxelisation info.
3689 /// Use option 'v" to save the voxelisation info.
3690 /// if filename end with ".xml" a root/xml file is produced.
3691 ///
3692 /// - Case 2: C++ script
3693 /// if filename end with ".C"
3694 ///
3695 /// - Case 3: gdml file
3696 /// if filename end with ".gdml"
3697 /// NOTE that to use this option, the PYTHONPATH must be defined like
3698 /// export PYTHONPATH=$ROOTSYS/lib:$ROOTSYS/geom/gdml
3699 ///
3700 
3701 Int_t TGeoManager::Export(const char *filename, const char *name, Option_t *option)
3702 {
3703  TString sfile(filename);
3704  if (sfile.Contains(".C")) {
3705  //Save geometry as a C++ script
3706  if (fgVerboseLevel>0) Info("Export","Exporting %s %s as C++ code", GetName(), GetTitle());
3707  fTopVolume->SaveAs(filename);
3708  return 1;
3709  }
3710  if (sfile.Contains(".gdml")) {
3711  //Save geometry as a gdml file
3712  if (fgVerboseLevel>0) Info("Export","Exporting %s %s as gdml code", GetName(), GetTitle());
3713  //C++ version
3714  TString cmd ;
3715  cmd = TString::Format("TGDMLWrite::StartGDMLWriting(gGeoManager,\"%s\",\"%s\")", filename, option);
3716  gROOT->ProcessLineFast(cmd);
3717  return 1;
3718  }
3719  if (sfile.Contains(".root") || sfile.Contains(".xml")) {
3720  //Save geometry as a root file
3721  TFile *f = TFile::Open(filename,"recreate");
3722  if (!f || f->IsZombie()) {
3723  Error("Export","Cannot open file");
3724  return 0;
3725  }
3726  TString keyname = name;
3727  if (keyname.IsNull()) keyname = GetName();
3728  TString opt = option;
3729  opt.ToLower();
3730  if (opt.Contains("v")) {
3731  fStreamVoxels = kTRUE;
3732  if (fgVerboseLevel>0) Info("Export","Exporting %s %s as root file. Optimizations streamed.", GetName(), GetTitle());
3733  } else {
3735  if (fgVerboseLevel>0) Info("Export","Exporting %s %s as root file. Optimizations not streamed.", GetName(), GetTitle());
3736  }
3737 
3738  const char *precision_dbl = TBufferText::GetDoubleFormat();
3739  const char *precision_flt = TBufferText::GetFloatFormat();
3740  TString new_format_dbl = TString::Format("%%.%dg", TGeoManager::GetExportPrecision());
3741  if (sfile.Contains(".xml")) {
3742  TBufferText::SetDoubleFormat(new_format_dbl.Data());
3743  TBufferText::SetFloatFormat(new_format_dbl.Data());
3744  }
3745  Int_t nbytes = Write(keyname);
3746  if (sfile.Contains(".xml")) {
3747  TBufferText::SetFloatFormat(precision_dbl);
3748  TBufferText::SetDoubleFormat(precision_flt);
3749  }
3750 
3752  delete f;
3753  return nbytes;
3754  }
3755  return 0;
3756 }
3757 
3758 ////////////////////////////////////////////////////////////////////////////////
3759 /// Lock current geometry so that no other geometry can be imported.
3760 
3762 {
3763  fgLock = kTRUE;
3764 }
3765 
3766 ////////////////////////////////////////////////////////////////////////////////
3767 /// Unlock current geometry.
3768 
3770 {
3771  fgLock = kFALSE;
3772 }
3773 
3774 ////////////////////////////////////////////////////////////////////////////////
3775 /// Check lock state.
3776 
3778 {
3779  return fgLock;
3780 }
3781 
3782 ////////////////////////////////////////////////////////////////////////////////
3783 /// Set verbosity level (static function).
3784 /// - 0 - suppress messages related to geom-painter visibility level
3785 /// - 1 - default value
3786 
3788 {
3789  return fgVerboseLevel;
3790 }
3791 
3792 ////////////////////////////////////////////////////////////////////////////////
3793 /// Return current verbosity level (static function).
3794 
3796 {
3797  fgVerboseLevel = vl;
3798 }
3799 
3800 ////////////////////////////////////////////////////////////////////////////////
3801 ///static function
3802 ///Import a geometry from a gdml or ROOT file
3803 ///
3804 /// - Case 1: gdml
3805 /// if filename ends with ".gdml" the foreign geometry described with gdml
3806 /// is imported executing some python scripts in $ROOTSYS/gdml.
3807 /// NOTE that to use this option, the PYTHONPATH must be defined like
3808 /// export PYTHONPATH=$ROOTSYS/lib:$ROOTSYS/gdml
3809 ///
3810 /// - Case 2: root file (.root) or root/xml file (.xml)
3811 /// Import in memory from filename the geometry with key=name.
3812 /// if name="" (default), the first TGeoManager object in the file is returned.
3813 ///
3814 /// Note that this function deletes the current gGeoManager (if one)
3815 /// before importing the new object.
3816 
3817 TGeoManager *TGeoManager::Import(const char *filename, const char *name, Option_t * /*option*/)
3818 {
3819  if (fgLock) {
3820  ::Warning("TGeoManager::Import", "TGeoMananager in lock mode. NOT IMPORTING new geometry");
3821  return NULL;
3822  }
3823  if (!filename) return 0;
3824  if (fgVerboseLevel>0) ::Info("TGeoManager::Import","Reading geometry from file: %s",filename);
3825 
3826  if (gGeoManager) delete gGeoManager;
3827  gGeoManager = 0;
3828 
3829  if (strstr(filename,".gdml")) {
3830  // import from a gdml file
3831  new TGeoManager("GDMLImport", "Geometry imported from GDML");
3832  TString cmd = TString::Format("TGDMLParse::StartGDML(\"%s\")", filename);
3833  TGeoVolume* world = (TGeoVolume*)gROOT->ProcessLineFast(cmd);
3834 
3835  if(world == 0) {
3836  ::Error("TGeoManager::Import", "Cannot open file");
3837  }
3838  else {
3839  gGeoManager->SetTopVolume(world);
3842  }
3843  } else {
3844  // import from a root file
3845  TDirectory::TContext ctxt;
3846  // in case a web file is specified, use the cacheread option to cache
3847  // this file in the cache directory
3848  TFile *f = 0;
3849  if (strstr(filename,"http")) f = TFile::Open(filename,"CACHEREAD");
3850  else f = TFile::Open(filename);
3851  if (!f || f->IsZombie()) {
3852  ::Error("TGeoManager::Import", "Cannot open file");
3853  return 0;
3854  }
3855  if (name && strlen(name) > 0) {
3856  gGeoManager = (TGeoManager*)f->Get(name);
3857  } else {
3858  TIter next(f->GetListOfKeys());
3859  TKey *key;
3860  while ((key = (TKey*)next())) {
3861  if (strcmp(key->GetClassName(),"TGeoManager") != 0) continue;
3862  gGeoManager = (TGeoManager*)key->ReadObj();
3863  break;
3864  }
3865  }
3866  delete f;
3867  }
3868  if (!gGeoManager) return 0;
3869  if (!gROOT->GetListOfGeometries()->FindObject(gGeoManager)) gROOT->GetListOfGeometries()->Add(gGeoManager);
3870  if (!gROOT->GetListOfBrowsables()->FindObject(gGeoManager)) gROOT->GetListOfBrowsables()->Add(gGeoManager);
3872  return gGeoManager;
3873 }
3874 
3875 ////////////////////////////////////////////////////////////////////////////////
3876 /// Update element flags when geometry is loaded from a file.
3877 
3879 {
3880  if (!fElementTable) return;
3881  TIter next(fMaterials);
3882  TGeoMaterial *mat;
3883  TGeoMixture *mix;
3884  TGeoElement *elem, *elem_table;
3885  Int_t i, nelem;
3886  while ((mat=(TGeoMaterial*)next())) {
3887  if (mat->IsMixture()) {
3888  mix = (TGeoMixture*)mat;
3889  nelem = mix->GetNelements();
3890  for (i=0; i<nelem; i++) {
3891  elem = mix->GetElement(i);
3892  if (!elem) continue;
3893  elem_table = fElementTable->GetElement(elem->Z());
3894  if (!elem_table) continue;
3895  if (elem != elem_table) {
3896  elem_table->SetDefined(elem->IsDefined());
3897  elem_table->SetUsed(elem->IsUsed());
3898  } else {
3899  elem_table->SetDefined();
3900  }
3901  }
3902  } else {
3903  elem = mat->GetElement();
3904  if (!elem) continue;
3905  elem_table = fElementTable->GetElement(elem->Z());
3906  if (!elem_table) continue;
3907  if (elem != elem_table) {
3908  elem_table->SetDefined(elem->IsDefined());
3909  elem_table->SetUsed(elem->IsUsed());
3910  } else {
3911  elem_table->SetUsed();
3912  }
3913  }
3914  }
3915 }
3916 
3917 ////////////////////////////////////////////////////////////////////////////////
3918 /// Initialize PNE array for fast access via index and unique-id.
3919 
3921 {
3922  if (fHashPNE) {
3923  fArrayPNE = new TObjArray(fHashPNE->GetSize());
3924  TIter next(fHashPNE);
3925  TObject *obj;
3926  while ((obj = next())) {
3927  fArrayPNE->Add(obj);
3928  }
3929  return kTRUE;
3930  }
3931  return kFALSE;
3932 }
3933 
3934 ////////////////////////////////////////////////////////////////////////////////
3935 /// Get time cut for drawing tracks.
3936 
3938 {
3939  tmin = fTmin;
3940  tmax = fTmax;
3941  return fTimeCut;
3942 }
3943 
3944 ////////////////////////////////////////////////////////////////////////////////
3945 /// Set time cut interval for drawing tracks. If called with no arguments, time
3946 /// cut will be disabled.
3947 
3949 {
3950  fTmin = tmin;
3951  fTmax = tmax;
3952  if (tmin==0 && tmax==999) fTimeCut = kFALSE;
3953  else fTimeCut = kTRUE;
3954  if (fTracks && !IsAnimatingTracks()) ModifiedPad();
3955 }
3956 
3957 ////////////////////////////////////////////////////////////////////////////////
3958 /// Convert coordinates from master volume frame to top.
3959 
3960 void TGeoManager::MasterToTop(const Double_t *master, Double_t *top) const
3961 {
3962  GetCurrentNavigator()->MasterToLocal(master, top);
3963 }
3964 
3965 ////////////////////////////////////////////////////////////////////////////////
3966 /// Convert coordinates from top volume frame to master.
3967 
3968 void TGeoManager::TopToMaster(const Double_t *top, Double_t *master) const
3969 {
3970  GetCurrentNavigator()->LocalToMaster(top, master);
3971 }
3972 
3973 ////////////////////////////////////////////////////////////////////////////////
3974 /// Create a parallel world for prioritised navigation. This can be populated
3975 /// with physical nodes and can be navigated independently using its API.
3976 /// In case the flag SetUseParallelWorldNav is set, any navigation query in the
3977 /// main geometry is checked against the parallel geometry, which gets priority
3978 /// in case of overlaps with the main geometry volumes.
3979 
3981 {
3982  fParallelWorld = new TGeoParallelWorld(name, this);
3983  return fParallelWorld;
3984 }
3985 
3986 ////////////////////////////////////////////////////////////////////////////////
3987 /// Activate/deactivate usage of parallel world navigation. Can only be done if
3988 /// there is a parallel world. Activating navigation will automatically close
3989 /// the parallel geometry.
3990 
3992 {
3993  if (!fParallelWorld) {
3994  Error("SetUseParallelWorldNav", "No parallel world geometry defined. Use CreateParallelWorld.");
3995  return;
3996  }
3997  if (!flag) {
3998  fUsePWNav = flag;
3999  return;
4000  }
4001  if (!fClosed) {
4002  Error("SetUseParallelWorldNav", "The geometry must be closed first");
4003  return;
4004  }
4005  // Closing the parallel world geometry is mandatory
4007 }
4008 
4010 {
4011  return fgDefaultUnits;
4012 }
TGeoManager::FindNormal
Double_t * FindNormal(Bool_t forward=kTRUE)
Computes normal vector to the next surface that will be or was already crossed when propagating on a ...
Definition: TGeoManager.cxx:2588
TGeoMedium::kMedSavePrimitive
@ kMedSavePrimitive
Definition: TGeoMedium.h:39
TGeoNavigator::Safety
Double_t Safety(Bool_t inside=kFALSE)
Compute safe distance from the current point.
Definition: TGeoNavigator.cxx:1693
TGeoManager::AnimateTracks
void AnimateTracks(Double_t tmin=0, Double_t tmax=5E-8, Int_t nframes=200, Option_t *option="/*")
Draw animation of tracks.
Definition: TGeoManager.cxx:1673
TGeoManager::fgDefaultUnits
static EDefaultUnits fgDefaultUnits
Precision to be used in ASCII exports.
Definition: TGeoManager.h:60
TGeoManager::UpdateElements
void UpdateElements()
Update element flags when geometry is loaded from a file.
Definition: TGeoManager.cxx:3878
vertex
REAL * vertex
Definition: triangle.c:512
TVirtualGeoPainter::DrawCurrentPoint
virtual void DrawCurrentPoint(Int_t color)=0
TBufferText::GetFloatFormat
static const char * GetFloatFormat()
return current printf format for float members, default "%e"
Definition: TBufferText.cxx:806
TGeoManager::IsAnimatingTracks
Bool_t IsAnimatingTracks() const
Definition: TGeoManager.h:410
TGeoManager::fgVerboseLevel
static Int_t fgVerboseLevel
Lock preventing a second geometry to be loaded.
Definition: TGeoManager.h:55
TGeoNavigatorArray::AddNavigator
TGeoNavigator * AddNavigator()
Add a new navigator to the array.
Definition: TGeoNavigator.cxx:2662
TGeoManager::GetExportPrecision
static UInt_t GetExportPrecision()
Definition: TGeoManager.h:479
TGeoVolume::GetRefCount
Int_t GetRefCount() const
Definition: TGeoVolume.h:134
TGeoManager::fClosed
Bool_t fClosed
Definition: TGeoManager.h:83
TGeoManager::SetTminTmax
void SetTminTmax(Double_t tmin=0, Double_t tmax=999)
Set time cut interval for drawing tracks.
Definition: TGeoManager.cxx:3948
TGeoManager::EDefaultUnits
EDefaultUnits
Definition: TGeoManager.h:47
TGeoMedium.h
TGeoBuilder::MakeHype
TGeoVolume * MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:269
TGeoManager::fHashGVolumes
THashList * fHashGVolumes
hash list of volumes providing fast search
Definition: TGeoManager.h:141
TGeoNode::SetVolume
void SetVolume(TGeoVolume *volume)
Definition: TGeoNode.h:115
TGeoMaterial::GetDensity
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:108
TGeoNavigator::FindNormal
Double_t * FindNormal(Bool_t forward=kTRUE)
Computes normal vector to the next surface that will be or was already crossed when propagating on a ...
Definition: TGeoNavigator.cxx:1650
TGeoManager::CheckPath
Bool_t CheckPath(const char *path) const
Check if a geometry path is valid without changing the state of the current navigator.
Definition: TGeoManager.cxx:1561
TBrowser
Definition: TBrowser.h:37
TGeoBuilder::MakeCtub
TGeoVolume * MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
Make in one step a volume pointing to a tube segment shape with given medium.
Definition: TGeoBuilder.cxx:303
TGeoManager::GetUID
Int_t GetUID(const char *volname) const
Retrieve unique id for a volume name. Return -1 if name not found.
Definition: TGeoManager.cxx:2743
TVirtualGeoTrack::FindTrackWithId
virtual TVirtualGeoTrack * FindTrackWithId(Int_t id) const
Recursively search through this track for a daughter particle (at any depth) with the specified id.
Definition: TVirtualGeoTrack.cxx:83
TGeoManager::fMatrices
TObjArray * fMatrices
current painter
Definition: TGeoManager.h:97
TGeoVolume::SetFinder
void SetFinder(TGeoPatternFinder *finder)
Definition: TGeoVolume.h:231
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoPhysicalNode
Definition: TGeoPhysicalNode.h:35
TVirtualGeoPainter::EstimateCameraMove
virtual void EstimateCameraMove(Double_t, Double_t, Double_t *, Double_t *)
Definition: TVirtualGeoPainter.h:84
TGeoManager::GetBranchNames
void GetBranchNames(Int_t *names) const
Fill volume names of current branch into an array.
Definition: TGeoManager.cxx:1786
TGeoManager::GetByteCount
virtual Int_t GetByteCount(Option_t *option=0)
Get total size of geometry in bytes.
Definition: TGeoManager.cxx:2663
TGeoManager::fCurrentNavigator
TGeoNavigator * fCurrentNavigator
Lock existing navigators.
Definition: TGeoManager.h:127
TGeoMatrix::ReflectZ
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
Definition: TGeoMatrix.cxx:519
TGeoManager::ClearThreadsMap
static void ClearThreadsMap()
Clear the current map of threads.
Definition: TGeoManager.cxx:891
TObjArray::Delete
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:356
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TGeoNodeCache::BuildInfoBranch
void BuildInfoBranch()
Builds info branch. Navigation is possible only after this step.
Definition: TGeoCache.cxx:142
TGeoManager::RemoveNavigator
void RemoveNavigator(const TGeoNavigator *nav)
Clear a single navigator.
Definition: TGeoManager.cxx:814
TGeoManager::fTimeCut
Bool_t fTimeCut
Definition: TGeoManager.h:89
TGeoVolume::DummyMedium
static TGeoMedium * DummyMedium()
Definition: TGeoVolume.cxx:440
TGeoManager::Node
void Node(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, Bool_t isOnly, Float_t *upar, Int_t npar=0)
Create a node called <name_nr> pointing to the volume called <name> as daughter of the volume called ...
Definition: TGeoManager.cxx:1232
TGeoManager::ClearOverlaps
void ClearOverlaps()
Clear the list of overlaps.
Definition: TGeoManager.cxx:1454
TGeoManager::CheckBoundaryErrors
void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.)
Check pushes and pulls needed to cross the next boundary with respect to the position given by FindNe...
Definition: TGeoManager.cxx:3489
TGeoManager::UnbombTranslation
void UnbombTranslation(const Double_t *tr, Double_t *bombtr)
Get the new 'unbombed' translation vector according current exploded view mode.
Definition: TGeoManager.cxx:978
TGeoNode::CheckShapes
void CheckShapes()
check for wrong parameters in shapes
Definition: TGeoNode.cxx:303
TGeoManager::AddVolume
Int_t AddVolume(TGeoVolume *volume)
Add a volume to the list. Returns index of the volume in list.
Definition: TGeoManager.cxx:672
TMath::ATan2
Double_t ATan2(Double_t y, Double_t x)
Definition: TMath.h:679
TGeoVolume::IsRunTime
Bool_t IsRunTime() const
Definition: TGeoVolume.h:114
TGeoManager::SetCheckedNode
void SetCheckedNode(TGeoNode *node)
Assign a given node to be checked for overlaps. Any other overlaps will be ignored.
Definition: TGeoManager.cxx:2201
TGeoBuilder::MakePgon
TGeoVolume * MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
Make in one step a volume pointing to a polygone shape with given medium.
Definition: TGeoBuilder.cxx:363
TGeoManager::SetUseParallelWorldNav
void SetUseParallelWorldNav(Bool_t flag)
Activate/deactivate usage of parallel world navigation.
Definition: TGeoManager.cxx:3991
gGeoIdentity
R__EXTERN TGeoIdentity * gGeoIdentity
Definition: TGeoMatrix.h:478
TGeoVolume::GetShape
TGeoShape * GetShape() const
Definition: TGeoVolume.h:188
TObjArray
Definition: TObjArray.h:37
TGeoElement::Z
Int_t Z() const
Definition: TGeoElement.h:73
TGeoManager::FindTrackWithId
TVirtualGeoTrack * FindTrackWithId(Int_t id) const
Search the track hierarchy to find the track with the given id.
Definition: TGeoManager.cxx:2003
TGeoMatrix::kGeoSavePrimitive
@ kGeoSavePrimitive
Definition: TGeoMatrix.h:51
TGeoManager::SetVisLevel
void SetVisLevel(Int_t level=3)
set default level down to which visualization is performed
Definition: TGeoManager.cxx:2248
TGeoManager::GetCurrentNavigator
TGeoNavigator * GetCurrentNavigator() const
Returns current navigator for the calling thread.
Definition: TGeoManager.cxx:737
TGeoManager::ThreadId
static Int_t ThreadId()
Translates the current thread id to an ordinal number.
Definition: TGeoManager.cxx:904
TGeoManager::LocalToMaster
void LocalToMaster(const Double_t *local, Double_t *master) const
Definition: TGeoManager.h:543
TGeoNavigator::GetBranchNames
void GetBranchNames(Int_t *names) const
Fill volume names of current branch into an array.
Definition: TGeoNavigator.cxx:517
f
#define f(i)
Definition: RSha256.hxx:122
TGeoManager::fUserPaintVolume
TGeoVolume * fUserPaintVolume
volume currently painted
Definition: TGeoManager.h:139
TGeoNavigator::GetBranchOnlys
void GetBranchOnlys(Int_t *isonly) const
Fill node copy numbers of current branch into an array.
Definition: TGeoNavigator.cxx:533
TGeoNavigator::GetHMatrix
TGeoHMatrix * GetHMatrix()
Return stored current matrix (global matrix of the next touched node).
Definition: TGeoNavigator.cxx:2589
TMath::RadToDeg
constexpr Double_t RadToDeg()
Conversion from radian to degree:
Definition: TMath.h:79
TGeoManager::MakeTrd1
TGeoVolume * MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
Definition: TGeoManager.cxx:3052
TGeoVolume::GetNdaughters
Int_t GetNdaughters() const
Definition: TGeoVolume.h:349
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
TGeoCombiTrans
Definition: TGeoMatrix.h:291
TGeoManager::MakeBox
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
Definition: TGeoManager.cxx:2918
TGeoBuilder::MakeXtru
TGeoVolume * MakeXtru(const char *name, TGeoMedium *medium, Int_t nz)
Make a TGeoXtru-shaped volume with nz planes.
Definition: TGeoBuilder.cxx:436
TGeoManager::CdNext
void CdNext()
Do a cd to the node found next by FindNextBoundary.
Definition: TGeoManager.cxx:1544
TGeoManager::fPdgNames
TObjArray * fPdgNames
Definition: TGeoManager.h:104
TGeoMaterial::GetElement
virtual TGeoElement * GetElement(Int_t i=0) const
Get a pointer to the element this material is made of.
Definition: TGeoMaterial.cxx:565
TGeoNavigator::GetCache
TGeoNodeCache * GetCache() const
Definition: TGeoNavigator.h:193
TGeoManager::MakePara
TGeoVolume * MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha, Double_t theta, Double_t phi)
Make in one step a volume pointing to a parallelepiped shape with given medium.
Definition: TGeoManager.cxx:2927
TGeoManager::fRegions
TObjArray * fRegions
Definition: TGeoManager.h:113
TString::Strip
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1106
TGeoManager::GetCurrentNode
TGeoNode * GetCurrentNode() const
Definition: TGeoManager.h:519
TGeoShape::IsComposite
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
TGeoManager::fgThreadId
static ThreadsMap_t * fgThreadId
Map between thread id's and navigator arrays.
Definition: TGeoManager.h:124
TGeoManager::IsInPhiRange
Bool_t IsInPhiRange() const
True if current node is in phi range.
Definition: TGeoManager.cxx:2612
TGeoBuilder::MakePcon
TGeoVolume * MakePcon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nz)
Make in one step a volume pointing to a polycone shape with given medium.
Definition: TGeoBuilder.cxx:352
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
TGeoManager::FindNormalFast
Double_t * FindNormalFast()
Computes fast normal to next crossed boundary, assuming that the current point is close enough to the...
Definition: TGeoManager.cxx:2577
TGeoManager::GetVisLevel
Int_t GetVisLevel() const
Returns current depth to which geometry is drawn.
Definition: TGeoManager.cxx:1972
kGreen
@ kGreen
Definition: Rtypes.h:66
TGeoManager::MakePgon
TGeoVolume * MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
Make in one step a volume pointing to a polygone shape with given medium.
Definition: TGeoManager.cxx:3043
TGeoManager::InitArrayPNE
Bool_t InitArrayPNE() const
Initialize PNE array for fast access via index and unique-id.
Definition: TGeoManager.cxx:3920
TGeoManager::fKeyPNEId
Int_t * fKeyPNEId
Definition: TGeoManager.h:146
TVirtualGeoPainter::SetNmeshPoints
virtual void SetNmeshPoints(Int_t npoints)=0
TObjArray::Sort
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
Definition: TObjArray.cxx:818
TGeoManager::fMultiThread
Bool_t fMultiThread
Max number of threads.
Definition: TGeoManager.h:149
TGeoBuilder::MakeTrd1
TGeoVolume * MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
Definition: TGeoBuilder.cxx:374
TList::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:577
TGeoManager::MasterToTop
void MasterToTop(const Double_t *master, Double_t *top) const
Convert coordinates from master volume frame to top.
Definition: TGeoManager.cxx:3960
TList::Delete
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:469
TBufferText::SetDoubleFormat
static void SetDoubleFormat(const char *fmt="%.14e")
set printf format for double members, default "%.14e" use it after SetFloatFormat,...
Definition: TBufferText.cxx:815
TString::Data
const char * Data() const
Definition: TString.h:369
TVirtualGeoPainter::TestOverlaps
virtual void TestOverlaps(const char *path)=0
ROOT::EnableThreadSafety
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
Definition: TROOT.cxx:494
TGeoManager::CountLevels
void CountLevels()
Count maximum number of nodes per volume, maximum depth and maximum number of xtru vertices.
Definition: TGeoManager.cxx:1602
TGeoRegion.h
TGeoManager::TopToMaster
void TopToMaster(const Double_t *top, Double_t *master) const
Convert coordinates from top volume frame to master.
Definition: TGeoManager.cxx:3968
TGeoVolume::Voxelize
void Voxelize(Option_t *option)
build the voxels for this volume
Definition: TGeoVolume.cxx:2301
TGeoManager::fgMaxXtruVert
static Int_t fgMaxXtruVert
Maximum number of daughters.
Definition: TGeoManager.h:58
TGeoXtru
Definition: TGeoXtru.h:22
TGeoElementTable::GetElement
TGeoElement * GetElement(Int_t z)
Definition: TGeoElement.h:410
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TObjArray::Remove
virtual TObject * Remove(TObject *obj)
Remove object from array.
Definition: TObjArray.cxx:719
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:54
TGeoManager::fElementTable
TGeoElementTable * fElementTable
clipping shape for raytracing
Definition: TGeoManager.h:135
TGeoPNEntry::SetPhysicalNode
void SetPhysicalNode(TGeoPhysicalNode *node)
Setter for the corresponding physical node.
Definition: TGeoPhysicalNode.cxx:568
TGeoManager::CreateParallelWorld
TGeoParallelWorld * CreateParallelWorld(const char *name)
Create a parallel world for prioritised navigation.
Definition: TGeoManager.cxx:3980
TGeoManager::fgNumThreads
static Int_t fgNumThreads
Thread id's map.
Definition: TGeoManager.h:125
TGeoManager::GetVisOption
Int_t GetVisOption() const
Returns current depth to which geometry is drawn.
Definition: TGeoManager.cxx:1980
TBuffer::ReadClassBuffer
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
TGeoManager::MakeArb8
TGeoVolume * MakeArb8(const char *name, TGeoMedium *medium, Double_t dz, Double_t *vertices=0)
Make an TGeoArb8 volume.
Definition: TGeoManager.cxx:2909
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGeoNavigator::IsSameLocation
Bool_t IsSameLocation(Double_t x, Double_t y, Double_t z, Bool_t change=kFALSE)
Checks if point (x,y,z) is still in the current node.
Definition: TGeoNavigator.cxx:2383
TGeoBuilder::AddShape
Int_t AddShape(TGeoShape *shape)
Add a shape to the list. Returns index of the shape in list.
Definition: TGeoBuilder.cxx:114
TGeoManager::Export
virtual Int_t Export(const char *filename, const char *name="", Option_t *option="vg")
Export this geometry to a file.
Definition: TGeoManager.cxx:3701
TGeoNavigatorArray
Definition: TGeoNavigator.h:216
TGeoManager::SetPhiRange
void SetPhiRange(Double_t phimin=0., Double_t phimax=360.)
Set cut phi range.
Definition: TGeoManager.cxx:3325
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TGeoNavigatorArray::GetCurrentNavigator
TGeoNavigator * GetCurrentNavigator() const
Definition: TGeoNavigator.h:231
TGeoManager::CloseGeometry
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
Definition: TGeoManager.cxx:1359
TGeoManager::fVolumes
TObjArray * fVolumes
Definition: TGeoManager.h:99
TGeoMaterial::IsMixture
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:129
TVirtualGeoPainter::GetBombFactors
virtual void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const =0
TGeoNavigator::CdTop
void CdTop()
Make top level node the current node.
Definition: TGeoNavigator.cxx:472
TGeoBuilder::MakeGtra
TGeoVolume * MakeGtra(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a twisted trapezoid shape with given medium.
Definition: TGeoBuilder.cxx:423
TGeoNode::GetVolume
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:97
TGeoManager::RefreshPhysicalNodes
void RefreshPhysicalNodes(Bool_t lock=kTRUE)
Refresh physical nodes to reflect the actual geometry paths after alignment was applied.
Definition: TGeoManager.cxx:3278
TGeoNavigator::CdNode
void CdNode(Int_t nodeid)
Change current path to point to the node having this id.
Definition: TGeoNavigator.cxx:390
TGeoManager::fLoopVolumes
Bool_t fLoopVolumes
flag that geometry is closed
Definition: TGeoManager.h:84
TGeoBuilder::MakeVolumeAssembly
TGeoVolumeAssembly * MakeVolumeAssembly(const char *name)
Make an assembly of volumes.
Definition: TGeoBuilder.cxx:447
TGeoManager::fGVolumes
TObjArray * fGVolumes
list of runtime shapes
Definition: TGeoManager.h:102
TGeoManager::AddTransformation
Int_t AddTransformation(const TGeoMatrix *matrix)
Add a matrix to the list. Returns index of the matrix in list.
Definition: TGeoManager.cxx:624
Float_t
float Float_t
Definition: RtypesCore.h:57
TGeoManager::AddOpticalSurface
void AddOpticalSurface(TGeoOpticalSurface *optsurf)
Add optical surface;.
Definition: TGeoManager.cxx:1853
TGeoManager::fTmax
Double_t fTmax
lower time limit for tracks drawing
Definition: TGeoManager.h:69
TObjArray::IndexOf
Int_t IndexOf(const TObject *obj) const
Definition: TObjArray.cxx:605
TGeoManager::IsLocked
static Bool_t IsLocked()
Check lock state.
Definition: TGeoManager.cxx:3777
TGeoManager::AddNavigator
TGeoNavigator * AddNavigator()
Add a navigator in the list of navigators.
Definition: TGeoManager.cxx:717
TStyle.h
TFile::Open
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3946
TGeoManager::SortOverlaps
void SortOverlaps()
Sort overlaps by decreasing overlap distance. Extrusions comes first.
Definition: TGeoManager.cxx:2263
TVirtualGeoPainter::SetTopVisible
virtual void SetTopVisible(Bool_t vis=kTRUE)=0
TObject::Fatal
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:918
TDatime::AsString
const char * AsString() const
Return the date & time as a string (ctime() format).
Definition: TDatime.cxx:102
TGeoBuilder::MakeBox
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
Definition: TGeoBuilder.cxx:151
TGeoManager::AddOverlap
Int_t AddOverlap(const TNamed *ovlp)
Add an illegal overlap/extrusion to the list.
Definition: TGeoManager.cxx:560
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoManager::GetBorderSurface
TGeoBorderSurface * GetBorderSurface(const char *name) const
Get border surface with a given name;.
Definition: TGeoManager.cxx:1884
box
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
TGeoParallelWorld
Definition: TGeoParallelWorld.h:21
TGeoNavigator::GetPath
const char * GetPath() const
Get path to the current node in the form /node0/node1/...
Definition: TGeoNavigator.cxx:2601
TGeoIterator
Definition: TGeoNode.h:244
TVirtualGeoPainter::Test
virtual void Test(Int_t npoints, Option_t *option)=0
TGeoBuilder::Medium
TGeoMedium * Medium(const char *name, Int_t numed, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, Double_t stemax, Double_t deemax, Double_t epsil, Double_t stmin)
Create tracking medium.
Definition: TGeoBuilder.cxx:579
TBrowser.h
TGeoManager::FindNextDaughterBoundary
TGeoNode * FindNextDaughterBoundary(Double_t *point, Double_t *dir, Int_t &idaughter, Bool_t compmatrix=kFALSE)
Computes as fStep the distance to next daughter of the current volume.
Definition: TGeoManager.cxx:2544
TGeoManager::CountNodes
Int_t CountNodes(const TGeoVolume *vol=0, Int_t nlevels=10000, Int_t option=0)
Count the total number of nodes starting from a volume, nlevels down.
Definition: TGeoManager.cxx:1642
TGeoManager::CheckBoundaryReference
void CheckBoundaryReference(Int_t icheck=-1)
Check the boundary errors reference file created by CheckBoundaryErrors method.
Definition: TGeoManager.cxx:3499
TVirtualGeoPainter::GetViewBox
virtual Double_t * GetViewBox()=0
TObject::AppendPad
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:107
TGeoVolume::SetLineWidth
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TGeoVolume.cxx:2051
TGeoManager::CrossBoundaryAndLocate
TGeoNode * CrossBoundaryAndLocate(Bool_t downwards, TGeoNode *skipnode)
Cross next boundary and locate within current node The current point must be on the boundary of fCurr...
Definition: TGeoManager.cxx:2503
TGeoManager::GetNsegments
Int_t GetNsegments() const
Get number of segments approximating circles.
Definition: TGeoManager.cxx:3349
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
TGeoManager::DrawCurrentPoint
void DrawCurrentPoint(Int_t color=2)
Draw current point in the same view.
Definition: TGeoManager.cxx:1665
SafeDelete
#define SafeDelete(p)
Definition: RConfig.hxx:543
TGeoManager::GetVirtualLevel
Int_t GetVirtualLevel()
Find level of virtuality of current overlapping node (number of levels up having the same tracking me...
Definition: TGeoManager.cxx:1989
TGeoManager::fTopVolume
TGeoVolume * fTopVolume
current volume
Definition: TGeoManager.h:129
TGeoManager::fShapes
TObjArray * fShapes
Definition: TGeoManager.h:98
kOrange
@ kOrange
Definition: Rtypes.h:67
TGeoVolume::SetMedium
virtual void SetMedium(TGeoMedium *medium)
Definition: TGeoVolume.h:229
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
TGeoVolume::SaveAs
void SaveAs(const char *filename, Option_t *option="") const
Save geometry having this as top volume as a C++ macro.
Definition: TGeoVolume.cxx:1366
x
Double_t x[n]
Definition: legend1.C:17
TGeoManager::fNPNEId
Int_t fNPNEId
Definition: TGeoManager.h:145
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGeoPhysicalNode.h
TGeoNavigator::GetVirtualLevel
Int_t GetVirtualLevel()
Find level of virtuality of current overlapping node (number of levels up having the same tracking me...
Definition: TGeoNavigator.cxx:2280
TGeoEltu.h
TGeoManager::RemoveMaterial
void RemoveMaterial(Int_t index)
Remove material at given index.
Definition: TGeoManager.cxx:2843
TDirectory::TContext
Definition: TDirectory.h:47
TClass.h
TGeoNavigatorArray::SetCurrentNavigator
TGeoNavigator * SetCurrentNavigator(Int_t inav)
Definition: TGeoNavigator.h:232
TGeoManager::RestoreMasterVolume
void RestoreMasterVolume()
Restore the master volume of the geometry.
Definition: TGeoManager.cxx:2872
TGeoManager::AddSkinSurface
void AddSkinSurface(TGeoSkinSurface *surf)
Add skin surface;.
Definition: TGeoManager.cxx:1872
TGeoManager::fProperties
ConstPropMap_t fProperties
Definition: TGeoManager.h:153
nentries
int nentries
Definition: THbookFile.cxx:91
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
TGeoManager::fMedia
TList * fMedia
Definition: TGeoManager.h:110
TGeoManager::UnlockGeometry
static void UnlockGeometry()
Unlock current geometry.
Definition: TGeoManager.cxx:3769
TGeoManager::Step
TGeoNode * Step(Bool_t is_geom=kTRUE, Bool_t cross=kTRUE)
Make a rectilinear step of length fStep from current point (fPoint) on current direction (fDirection)...
Definition: TGeoManager.cxx:3379
TGeoBuilder::MakeCons
TGeoVolume * MakeCons(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a cone segment shape with given medium.
Definition: TGeoBuilder.cxx:333
TGeoBuilder::Division
TGeoVolume * Division(const char *name, const char *mother, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Create a new volume by dividing an existing one (GEANT3 like)
Definition: TGeoBuilder.cxx:476
TGeoManager::MakeCtub
TGeoVolume * MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
Make in one step a volume pointing to a tube segment shape with given medium.
Definition: TGeoManager.cxx:3003
TVirtualGeoTrack::GetMother
TVirtualGeoTrack * GetMother() const
Definition: TVirtualGeoTrack.h:56
TGeoNavigator::CdDown
void CdDown(Int_t index)
Make a daughter of current node current.
Definition: TGeoNavigator.cxx:402
TGeoManager::BuildDefaultMaterials
void BuildDefaultMaterials()
Now just a shortcut for GetElementTable.
Definition: TGeoManager.cxx:3357
TBuffer
Definition: TBuffer.h:43
TGeoManager::MakeTrd2
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
Definition: TGeoManager.cxx:3061
TVirtualGeoPainter::DrawPath
virtual void DrawPath(const char *path, Option_t *option="")=0
TObjArray::UncheckedAt
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:90
TGeoPhysicalNode::Refresh
void Refresh()
Refresh this physical node.
Definition: TGeoPhysicalNode.cxx:436
TVirtualGeoPainter::CheckBoundaryErrors
virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.)=0
TVirtualGeoPainter::GetViewAngles
virtual void GetViewAngles(Double_t &, Double_t &, Double_t &)
Definition: TVirtualGeoPainter.h:95
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TGeoManager::fMaxThreads
Int_t fMaxThreads
Definition: TGeoManager.h:148
TEnv.h
TGeoManager::GetListOfPhysicalNodes
TObjArray * GetListOfPhysicalNodes()
Definition: TGeoManager.h:488
TGeoNode::SetMotherVolume
void SetMotherVolume(TGeoVolume *mother)
Definition: TGeoNode.h:123
TString
Definition: TString.h:136
TGeoManager::FindNode
TGeoNode * FindNode(Bool_t safe_start=kTRUE)
Returns deepest node containing current point.
Definition: TGeoManager.cxx:2560
TVirtualGeoPainter::SetBombFactors
virtual void SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3)=0
TGeoNavigator::GetCurrentVolume
TGeoVolume * GetCurrentVolume() const
Definition: TGeoNavigator.h:162
TGeoNode::IsOverlapping
Bool_t IsOverlapping() const
Definition: TGeoNode.h:105
TGeoAtt::IsVisTouched
Bool_t IsVisTouched() const
Definition: TGeoAtt.h:102
TGeoManager::GetMaxXtruVert
static Int_t GetMaxXtruVert()
Return maximum number of vertices for an xtru shape used.
Definition: TGeoManager.cxx:1947
TGeoNavigator::GotoSafeLevel
Bool_t GotoSafeLevel()
Go upwards the tree until a non-overlapping node.
Definition: TGeoNavigator.cxx:2303
TGeoCone.h
TGeoMixture::GetElement
virtual TGeoElement * GetElement(Int_t i=0) const
Retrieve the pointer to the element corresponding to component I.
Definition: TGeoMaterial.cxx:988
TGeoManager::SetTopVisible
void SetTopVisible(Bool_t vis=kTRUE)
make top volume visible on screen
Definition: TGeoManager.cxx:2193
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGeoNode::GetMatrix
virtual TGeoMatrix * GetMatrix() const =0
TGeoManager::MakeVolumeAssembly
TGeoVolumeAssembly * MakeVolumeAssembly(const char *name)
Make an assembly of volumes.
Definition: TGeoManager.cxx:3300
TGeoManager::ClearThreadData
void ClearThreadData() const
Definition: TGeoManager.cxx:864
TGeoMixture
Definition: TGeoMaterial.h:155
TVirtualGeoPainter::RandomRays
virtual void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol, Bool_t check_norm)=0
TGeoManager::fNpdg
Int_t fNpdg
current track
Definition: TGeoManager.h:81
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
TGeoNode
Definition: TGeoNode.h:39
b
#define b(i)
Definition: RSha256.hxx:118
TVirtualGeoPainter::IsRaytracing
virtual Bool_t IsRaytracing() const =0
TGeoNodeCache::BuildIdArray
void BuildIdArray()
Builds node id array.
Definition: TGeoCache.cxx:124
TFile.h
TGeoManager::MakeTrap
TGeoVolume * MakeTrap(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a trapezoid shape with given medium.
Definition: TGeoManager.cxx:3071
h1
TH1F * h1
Definition: legend1.C:5
TGeoManager::fVisDensity
Double_t fVisDensity
particles to be drawn
Definition: TGeoManager.h:73
TGeoMatrix::GetByteCount
virtual Int_t GetByteCount() const
Get total size in bytes of this.
Definition: TGeoMatrix.cxx:282
TGeoNavigator::SearchNode
TGeoNode * SearchNode(Bool_t downwards=kFALSE, const TGeoNode *skipnode=0)
Returns the deepest node containing fPoint, which must be set a priori.
Definition: TGeoNavigator.cxx:1896
TGeoMaterial
Definition: TGeoMaterial.h:34
bool
TGeoNode::GetMotherVolume
TGeoVolume * GetMotherVolume() const
Definition: TGeoNode.h:92
TGeoShape::TestShapeBit
Bool_t TestShapeBit(UInt_t f) const
Definition: TGeoShape.h:163
TGeoManager::fOpticalSurfaces
TObjArray * fOpticalSurfaces
Definition: TGeoManager.h:106
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGeoCompositeShape
Definition: TGeoCompositeShape.h:27
TGeoManager::DoBackupState
void DoBackupState()
Backup the current state without affecting the cache stack.
Definition: TGeoManager.cxx:987
TGeoVolume::GetMedium
TGeoMedium * GetMedium() const
Definition: TGeoVolume.h:173
TGeoManager::fUniqueVolumes
TObjArray * fUniqueVolumes
Definition: TGeoManager.h:133
TVirtualGeoPainter::Weight
virtual Double_t Weight(Double_t precision, Option_t *option="v")=0
TGeoManager::DrawTracks
void DrawTracks(Option_t *option="")
Draw tracks over the geometry, according to option.
Definition: TGeoManager.cxx:1735
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TGeoManager::ReplaceVolume
Int_t ReplaceVolume(TGeoVolume *vorig, TGeoVolume *vnew)
Replaces all occurrences of VORIG with VNEW in the geometry tree.
Definition: TGeoManager.cxx:1014
TGeoManager::Mixture
TGeoMaterial * Mixture(const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nelem, Float_t *wmat, Int_t uid)
Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem materials defined by arrays A,...
Definition: TGeoManager.cxx:1173
TGeoTrd2.h
TGeoManager::SetNsegments
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
Definition: TGeoManager.cxx:3339
TGeoVolume::SetNumber
void SetNumber(Int_t number)
Definition: TGeoVolume.h:232
TGeoManager::AddBorderSurface
void AddBorderSurface(TGeoBorderSurface *surf)
Add border surface;.
Definition: TGeoManager.cxx:1891
TGeoManager::MakePhysicalNode
TGeoPhysicalNode * MakePhysicalNode(const char *path=0)
Makes a physical node corresponding to a path.
Definition: TGeoManager.cxx:3258
id
XFontStruct * id
Definition: TGX11.cxx:109
TGeoManager::InitTrack
TGeoNode * InitTrack(const Double_t *point, const Double_t *dir)
Initialize current point and current direction vector (normalized) in MARS.
Definition: TGeoManager.cxx:2630
TGeoManager::SetExplodedView
void SetExplodedView(Int_t iopt=0)
Set type of exploding view (see TGeoPainter::SetExplodedView())
Definition: TGeoManager.cxx:3316
TGeoManager::Division
TGeoVolume * Division(const char *name, const char *mother, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Create a new volume by dividing an existing one (GEANT3 like)
Definition: TGeoManager.cxx:1135
TSeqCollection::IndexOf
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
Definition: TSeqCollection.cxx:30
TGeoBuilder::MakePara
TGeoVolume * MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha, Double_t theta, Double_t phi)
Make in one step a volume pointing to a parallelepiped shape with given medium.
Definition: TGeoBuilder.cxx:168
TGeoManager::DoRestoreState
void DoRestoreState()
Restore a backed-up state without affecting the cache stack.
Definition: TGeoManager.cxx:995
TGeoManager::GetTminTmax
Bool_t GetTminTmax(Double_t &tmin, Double_t &tmax) const
Get time cut for drawing tracks.
Definition: TGeoManager.cxx:3937
TGeoManager::CdUp
void CdUp()
Go one level up in geometry.
Definition: TGeoManager.cxx:1527
TGeoNavigator::FindNode
TGeoNode * FindNode(Bool_t safe_start=kTRUE)
Returns deepest node containing current point.
Definition: TGeoNavigator.cxx:1583
TGeoManager::GetCurrentNodeId
Int_t GetCurrentNodeId() const
Get the unique ID of the current node.
Definition: TGeoManager.cxx:1509
TGeoManager::CheckGeometry
void CheckGeometry(Option_t *option="")
Perform last checks on the geometry.
Definition: TGeoManager.cxx:3568
TGeoManager::ThreadsMap_t
std::map< std::thread::id, Int_t > ThreadsMap_t
Definition: TGeoManager.h:118
TGeoBuilder::Node
void Node(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, Bool_t isOnly, Float_t *upar, Int_t npar=0)
Create a node called <name_nr> pointing to the volume called <name> as daughter of the volume called ...
Definition: TGeoBuilder.cxx:602
TGeoManager::FindVolumeFast
TGeoVolume * FindVolumeFast(const char *name, Bool_t multi=kFALSE)
Fast search for a named volume. All trailing blanks stripped.
Definition: TGeoManager.cxx:2721
TGeoManager::IsSameLocation
Bool_t IsSameLocation() const
Definition: TGeoManager.h:415
TROOT.h
TGeoNavigator::DoBackupState
void DoBackupState()
Backup the current state without affecting the cache stack.
Definition: TGeoNavigator.cxx:2568
TGeoManager::MakeCone
TGeoVolume * MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Make in one step a volume pointing to a cone shape with given medium.
Definition: TGeoManager.cxx:3013
TGeoManager::fExplodedView
Int_t fExplodedView
Definition: TGeoManager.h:74
TGeoBuilder.h
TGeoNavigator::LocalToMaster
void LocalToMaster(const Double_t *local, Double_t *master) const
Definition: TGeoNavigator.h:185
TGeoMaterial::IsEq
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
Definition: TGeoMaterial.cxx:512
TGeoManager::fgMaxDaughters
static Int_t fgMaxDaughters
Maximum level in geometry.
Definition: TGeoManager.h:57
TGeoNavigator::DoRestoreState
void DoRestoreState()
Restore a backed-up state without affecting the cache stack.
Definition: TGeoNavigator.cxx:2576
TGeoParaboloid.h
TGeoNavigator::cd
Bool_t cd(const char *path="")
Browse the tree of nodes starting from top node according to pathname.
Definition: TGeoNavigator.cxx:306
TGeoManager::fRaytraceMode
Int_t fRaytraceMode
Flag for multi-threading.
Definition: TGeoManager.h:150
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
TGeoMaterial::kMatSavePrimitive
@ kMatSavePrimitive
Definition: TGeoMaterial.h:40
TGeoManager::fUsePWNav
Bool_t fUsePWNav
Raytrace mode: 0=normal, 1=pass through, 2=transparent.
Definition: TGeoManager.h:151
TGeoNavigator::FindNextBoundary
TGeoNode * FindNextBoundary(Double_t stepmax=TGeoShape::Big(), const char *path="", Bool_t frombdr=kFALSE)
Find distance to next boundary and store it in fStep.
Definition: TGeoNavigator.cxx:697
TGeoManager::fGDMLMatrices
TObjArray * fGDMLMatrices
Definition: TGeoManager.h:105
TGeoNavigator::InspectState
void InspectState() const
Inspects path and all flags for the current state.
Definition: TGeoNavigator.cxx:2363
TGeoManager::fMatrixTransform
Bool_t fMatrixTransform
flag that the list of physical nodes has to be drawn
Definition: TGeoManager.h:91
TGeoElement::IsUsed
Bool_t IsUsed() const
Definition: TGeoElement.h:88
TGeoVolume::SetField
void SetField(TObject *field)
Definition: TGeoVolume.h:218
TGeoManager::Weight
Double_t Weight(Double_t precision=0.01, Option_t *option="va")
Estimate weight of volume VOL with a precision SIGMA(W)/W better than PRECISION.
Definition: TGeoManager.cxx:3625
TGeoBuilder::MakeCone
TGeoVolume * MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Make in one step a volume pointing to a cone shape with given medium.
Definition: TGeoBuilder.cxx:315
ROOT::Math::gv_detail::dist
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:63
TQObject.h
TVirtualGeoPainter::DefaultAngles
virtual void DefaultAngles()=0
TGeoManager::AddMaterial
Int_t AddMaterial(const TGeoMaterial *material)
Add a material to the list. Returns index of the material in list.
Definition: TGeoManager.cxx:552
TGeoBuilder::MakeArb8
TGeoVolume * MakeArb8(const char *name, TGeoMedium *medium, Double_t dz, Double_t *vertices=0)
Make an TGeoArb8 volume.
Definition: TGeoBuilder.cxx:140
TList::At
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:356
TGeoManager::GetMaxLevels
static Int_t GetMaxLevels()
Return maximum number of levels used in the geometry.
Definition: TGeoManager.cxx:1939
TGeoManager::fBits
UChar_t * fBits
Definition: TGeoManager.h:114
TGeoManager::fArrayPNE
TObjArray * fArrayPNE
Definition: TGeoManager.h:143
TGeoElement::IsDefined
Bool_t IsDefined() const
Definition: TGeoElement.h:86
TGeoNavigator::CdUp
void CdUp()
Go one level up in geometry.
Definition: TGeoNavigator.cxx:439
TGeoManager::AddRegion
Int_t AddRegion(TGeoRegion *region)
Add a new region of volumes.
Definition: TGeoManager.cxx:569
TGeoArb8.h
TGeoManager::SetVisDensity
void SetVisDensity(Double_t dens=0.01)
Set density threshold.
Definition: TGeoManager.cxx:2239
TGeoManager::SetTopVolume
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
Definition: TGeoManager.cxx:3397
TGeoManager::GetNumThreads
static Int_t GetNumThreads()
Returns number of threads that were set to use geometry.
Definition: TGeoManager.cxx:1955
TGeoManager::fNsegments
Int_t fNsegments
Definition: TGeoManager.h:77
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGeoManager::SearchNode
TGeoNode * SearchNode(Bool_t downwards=kFALSE, const TGeoNode *skipnode=0)
Returns the deepest node containing fPoint, which must be set a priori.
Definition: TGeoManager.cxx:2494
TGeoManager::CheckGeometryFull
void CheckGeometryFull(Int_t ntracks=1000000, Double_t vx=0., Double_t vy=0., Double_t vz=0., Option_t *option="ob")
Geometry checking.
Definition: TGeoManager.cxx:3548
TGeoMedium::GetId
Int_t GetId() const
Definition: TGeoMedium.h:54
kMagenta
@ kMagenta
Definition: Rtypes.h:66
TGeoManager::Voxelize
void Voxelize(Option_t *option=0)
Voxelize all non-divided volumes.
Definition: TGeoManager.cxx:2881
TGeoManager::GetSkinSurface
TGeoSkinSurface * GetSkinSurface(const char *name) const
Get skin surface with a given name;.
Definition: TGeoManager.cxx:1865
TVirtualGeoPainter::CheckPoint
virtual void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="")=0
TVirtualGeoPainter::CountVisibleNodes
virtual Int_t CountVisibleNodes()=0
TGeoShape
Definition: TGeoShape.h:25
TGeoManager::fHashVolumes
THashList * fHashVolumes
Definition: TGeoManager.h:140
TGeoManager::ClearNavigators
void ClearNavigators()
Clear all navigators.
Definition: TGeoManager.cxx:798
TGeoManager::CdTop
void CdTop()
Make top level node the current node.
Definition: TGeoManager.cxx:1518
TGeoManager::RegisterMatrix
void RegisterMatrix(const TGeoMatrix *matrix)
Register a matrix to the list of matrices.
Definition: TGeoManager.cxx:1004
TGeoManager::SetMaxThreads
void SetMaxThreads(Int_t nthreads)
Set maximum number of threads for navigation.
Definition: TGeoManager.cxx:835
TGeoVolume::ClearThreadData
virtual void ClearThreadData() const
Definition: TGeoVolume.cxx:424
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TObject::ResetBit
void ResetBit(UInt_t f)
Definition: TObject.h:171
TGeoManager::SetAlignableEntry
TGeoPNEntry * SetAlignableEntry(const char *unique_name, const char *path, Int_t uid=-1)
Creates an alignable object with unique name corresponding to a path and adds it to the list of align...
Definition: TGeoManager.cxx:3103
TGeoManager::CheckShape
void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
Test for shape navigation methods.
Definition: TGeoManager.cxx:3520
TGeoManager::fNodes
TObjArray * fNodes
Definition: TGeoManager.h:111
TKey::GetClassName
virtual const char * GetClassName() const
Definition: TKey.h:76
TGeoManager::fgLockNavigators
static Bool_t fgLockNavigators
Number of registered threads.
Definition: TGeoManager.h:126
TGeoXtru::GetNvert
Int_t GetNvert() const
Definition: TGeoXtru.h:95
TGeoHMatrix
Definition: TGeoMatrix.h:420
TGeoNodeMatrix::SetMatrix
void SetMatrix(const TGeoMatrix *matrix)
Matrix setter.
Definition: TGeoNode.cxx:766
TGeoElement
Definition: TGeoElement.h:36
TGeoBuilder::MakeEltu
TGeoVolume * MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:252
TGeoTrd1.h
TGeoBuilder::MakeTrd2
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
Definition: TGeoBuilder.cxx:391
THashList
Definition: THashList.h:34
TGeoManager::SetCurrentNavigator
Bool_t SetCurrentNavigator(Int_t index)
Switch to another existing navigator for the calling thread.
Definition: TGeoManager.cxx:767
TGeoManager::SetVisOption
void SetVisOption(Int_t option=0)
set drawing mode :
Definition: TGeoManager.cxx:2221
TGeoManager::GetGeomPainter
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
Definition: TGeoManager.cxx:2685
TGeoManager::fDrawExtra
Bool_t fDrawExtra
Definition: TGeoManager.h:90
TGeoNode::CheckOverlaps
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="")
Check overlaps bigger than OVLP hierarchically, starting with this node.
Definition: TGeoNode.cxx:179
h
#define h(i)
Definition: RSha256.hxx:124
TGeoManager::ClearAttributes
void ClearAttributes()
Reset all attributes to default ones.
Definition: TGeoManager.cxx:1337
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TGeoShape::ComputeBBox
virtual void ComputeBBox()=0
TGeoManager::GetVolume
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
Definition: TGeoManager.cxx:2710
TGeoManager::DefaultAngles
void DefaultAngles()
Set default angles for a given view.
Definition: TGeoManager.cxx:1657
THashList::FindObject
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
TGeoElement.h
TGeoNavigator::ResetState
void ResetState()
Reset current state flags.
Definition: TGeoNavigator.cxx:1680
TGeoMatrix::IsReflection
Bool_t IsReflection() const
Definition: TGeoMatrix.h:69
TGeoManager::cd
virtual Bool_t cd(const char *path="")
Browse the tree of nodes starting from fTopNode according to pathname.
Definition: TGeoManager.cxx:1553
TGeoOpticalSurface.h
TGeoParallelWorld::RefreshPhysicalNodes
void RefreshPhysicalNodes()
Refresh the node pointers and re-voxelize.
Definition: TGeoParallelWorld.cxx:157
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
TGeoManager::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse actions on this manager.
Definition: TGeoManager.cxx:3677
TGeoShape::kGeoArb8
@ kGeoArb8
Definition: TGeoShape.h:53
TGeoMaterial::GetZ
virtual Double_t GetZ() const
Definition: TGeoMaterial.h:106
a
auto * a
Definition: textangle.C:12
TVirtualGeoTrack::GetId
Int_t GetId() const
Definition: TVirtualGeoTrack.h:53
TVirtualGeoPainter::EditGeometry
virtual void EditGeometry(Option_t *option="")=0
TGeoNavigator::CdNext
void CdNext()
Do a cd to the node found next by FindNextBoundary.
Definition: TGeoNavigator.cxx:488
TNamed
Definition: TNamed.h:29
TGeoMaterial.h
TVirtualGeoPainter::SetVisOption
virtual void SetVisOption(Int_t option=0)=0
TGeoManager::GetBranchOnlys
void GetBranchOnlys(Int_t *isonly) const
Fill node copy numbers of current branch into an array.
Definition: TGeoManager.cxx:1911
TGeoAtt::SetVisTouched
void SetVisTouched(Bool_t vis=kTRUE)
Mark visualization attributes as "modified".
Definition: TGeoAtt.cxx:131
TBuffer::WriteClassBuffer
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TGeoManager::FindNextBoundary
TGeoNode * FindNextBoundary(Double_t stepmax=TGeoShape::Big(), const char *path="", Bool_t frombdr=kFALSE)
Find distance to next boundary and store it in fStep.
Definition: TGeoManager.cxx:2533
TGeoElementTable
Definition: TGeoElement.h:369
TGeoManager::ClearPhysicalNodes
void ClearPhysicalNodes(Bool_t mustdelete=kFALSE)
Clear the current list of physical nodes, so that we can start over with a new list.
Definition: TGeoManager.cxx:3291
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGeoManager::SetVisibility
void SetVisibility(TObject *obj, Bool_t vis)
Set visibility for a volume.
Definition: TGeoManager.cxx:952
THashList::AddLast
void AddLast(TObject *obj)
Add object at the end of the list.
Definition: THashList.cxx:95
TGeoManager::SetNmeshPoints
void SetNmeshPoints(Int_t npoints=1000)
Set the number of points to be generated on the shape outline when checking for overlaps.
Definition: TGeoManager.cxx:2209
TGeoManager::GetAlignableEntry
TGeoPNEntry * GetAlignableEntry(const char *name) const
Retrieves an existing alignable object.
Definition: TGeoManager.cxx:3128
TGeoNavigator::CrossBoundaryAndLocate
TGeoNode * CrossBoundaryAndLocate(Bool_t downwards, TGeoNode *skipnode)
Cross next boundary and locate within current node The current point must be on the boundary of fCurr...
Definition: TGeoNavigator.cxx:602
TGeoHype.h
TGeoIterator::GetLevel
Int_t GetLevel() const
Definition: TGeoNode.h:276
TGeoManager::fPaintVolume
TGeoVolume * fPaintVolume
Definition: TGeoManager.h:138
TGeoManager::fTopNode
TGeoNode * fTopNode
top level volume in geometry
Definition: TGeoManager.h:130
TGeoBuilder::RegisterMatrix
void RegisterMatrix(TGeoMatrix *matrix)
Register a matrix to the list of matrices.
Definition: TGeoBuilder.cxx:129
TGeoManager::OptimizeVoxels
void OptimizeVoxels(const char *filename="tgeovox.C")
Optimize voxelization type for all volumes. Save best choice in a macro.
Definition: TGeoManager.cxx:2271
TGeoVolume::UnmarkSaved
void UnmarkSaved()
Reset SavePrimitive bits.
Definition: TGeoVolume.cxx:1592
TGeoManager::CheckPoint
void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="")
Classify a given point. See TGeoChecker::CheckPoint().
Definition: TGeoManager.cxx:3507
TVirtualGeoPainter::SetClippingShape
virtual void SetClippingShape(TGeoShape *shape)=0
TGeoManager::Test
void Test(Int_t npoints=1000000, Option_t *option="")
Check time of finding "Where am I" for n points.
Definition: TGeoManager.cxx:1770
TGeoVolume::CountNodes
Int_t CountNodes(Int_t nlevels=1000, Int_t option=0)
Count total number of subnodes starting from this volume, nlevels down.
Definition: TGeoVolume.cxx:702
TGeoManager::MakeEltu
TGeoVolume * MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoManager.cxx:2976
TGeoManager::fPhimin
Double_t fPhimin
Definition: TGeoManager.h:66
TGeoPNEntry
Definition: TGeoPhysicalNode.h:103
TGeoNodeMatrix
Definition: TGeoNode.h:152
TGeoVolume::Grab
void Grab()
Definition: TGeoVolume.h:139
TVirtualGeoPainter::AddTrack
virtual TVirtualGeoTrack * AddTrack(Int_t id, Int_t pdgcode, TObject *particle)=0
TGeoBuilder::AddMaterial
Int_t AddMaterial(TGeoMaterial *material)
Add a material to the list. Returns index of the material in list.
Definition: TGeoBuilder.cxx:88
TGeoManager::GetTrack
TVirtualGeoTrack * GetTrack(Int_t index)
Definition: TGeoManager.h:398
TGeoManager::MakeSphere
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
Definition: TGeoManager.cxx:2937
TGeoNavigator::IsSamePoint
Bool_t IsSamePoint(Double_t x, Double_t y, Double_t z) const
Check if a new point with given coordinates is the same as the last located one.
Definition: TGeoNavigator.cxx:2555
TObjArray::AddAtAndExpand
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Definition: TObjArray.cxx:235
TGeoBuilder::AddTransformation
Int_t AddTransformation(TGeoMatrix *matrix)
Add a matrix to the list. Returns index of the matrix in list.
Definition: TGeoBuilder.cxx:101
TGeoManager::fPhiCut
Bool_t fPhiCut
flag to notify that the manager is being destructed
Definition: TGeoManager.h:88
TGeoVolume::SortNodes
void SortNodes()
sort nodes by decreasing volume of the bounding box.
Definition: TGeoVolume.cxx:1953
TGeoManager::ModifiedPad
void ModifiedPad() const
Send "Modified" signal to painter.
Definition: TGeoManager.cxx:2900
TGeoManager::SetBombFactors
void SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3)
Set factors that will "bomb" all translations in cartesian and cylindrical coordinates.
Definition: TGeoManager.cxx:2159
TGeoManager::fIsGeomReading
Bool_t fIsGeomReading
Definition: TGeoManager.h:86
TVirtualGeoPainter::CheckShape
virtual void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)=0
TVirtualGeoPainter::BombTranslation
virtual void BombTranslation(const Double_t *tr, Double_t *bombtr)=0
TGeoManager::fVisLevel
Int_t fVisLevel
Definition: TGeoManager.h:76
BIT
#define BIT(n)
Definition: Rtypes.h:85
TGeoAtt::SetVisBranch
void SetVisBranch()
Set branch type visibility.
Definition: TGeoAtt.cxx:67
TGeoManager::fgLock
static Bool_t fgLock
mutex for navigator booking in MT mode
Definition: TGeoManager.h:54
TVirtualPad.h
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TVirtualGeoPainter::GrabFocus
virtual void GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0)=0
TNamed::TNamed
TNamed()
Definition: TNamed.h:42
y
Double_t y[n]
Definition: legend1.C:17
TGeoNode::SetOverlapping
void SetOverlapping(Bool_t flag=kTRUE)
Definition: TGeoNode.h:118
TGeoManager::MakeHype
TGeoVolume * MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoManager.cxx:2985
TGeoBBox
Definition: TGeoBBox.h:17
TGeoVolumeAssembly::MakeAssemblyFromVolume
static TGeoVolumeAssembly * MakeAssemblyFromVolume(TGeoVolume *vol)
Make a clone of volume VOL but which is an assembly.
Definition: TGeoVolume.cxx:2905
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGeoManager::fCurrentTrack
TVirtualGeoTrack * fCurrentTrack
Definition: TGeoManager.h:80
TGeoXtru.h
TGeoCompositeShape.h
TGeoBuilder::Material
TGeoMaterial * Material(const char *name, Double_t a, Double_t z, Double_t dens, Int_t uid, Double_t radlen=0, Double_t intlen=0)
Create material with given A, Z and density, having an unique id.
Definition: TGeoBuilder.cxx:520
TGeoManager::GetHMatrix
TGeoHMatrix * GetHMatrix()
Return stored current matrix (global matrix of the next touched node).
Definition: TGeoManager.cxx:1963
TGeoManager::MakeTorus
TGeoVolume * MakeTorus(const char *name, TGeoMedium *medium, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1=0, Double_t dphi=360)
Make in one step a volume pointing to a torus shape with given medium.
Definition: TGeoManager.cxx:2947
TGeoVoxelFinder::SetNeedRebuild
void SetNeedRebuild(Bool_t flag=kTRUE)
Definition: TGeoVoxelFinder.h:111
TGeoBuilder::MakeVolumeMulti
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Definition: TGeoBuilder.cxx:455
TGeoParallelWorld::IsClosed
Bool_t IsClosed() const
Definition: TGeoParallelWorld.h:66
TGeoManager::fActivity
Bool_t fActivity
flag for GL reflections
Definition: TGeoManager.h:93
TGeoVolume::SetTransparency
void SetTransparency(Char_t transparency=0)
Definition: TGeoVolume.h:217
TGeoNavigator::FindNextDaughterBoundary
TGeoNode * FindNextDaughterBoundary(Double_t *point, Double_t *dir, Int_t &idaughter, Bool_t compmatrix=kFALSE)
Computes as fStep the distance to next daughter of the current volume.
Definition: TGeoNavigator.cxx:1048
TGeoBuilder::MakeTubs
TGeoVolume * MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a tube segment shape with given medium.
Definition: TGeoBuilder.cxx:234
TGeoVolume::IsAssembly
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
Definition: TGeoVolume.cxx:1705
TGeoManager::SelectTrackingMedia
void SelectTrackingMedia()
Define different tracking media.
Definition: TGeoManager.cxx:3445
TGeoManager::fOverlaps
TObjArray * fOverlaps
Definition: TGeoManager.h:112
TGeoElement::SetUsed
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoElement.h:91
kRed
@ kRed
Definition: Rtypes.h:66
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TGeoVoxelFinder.h
TVirtualGeoPainter::UnbombTranslation
virtual void UnbombTranslation(const Double_t *tr, Double_t *bombtr)=0
TGeoManager::ResetState
void ResetState()
Reset current state flags.
Definition: TGeoManager.cxx:2552
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TGeoVolume::GetNumber
Int_t GetNumber() const
Definition: TGeoVolume.h:182
TGeoManager::GetMaterial
TGeoMaterial * GetMaterial(const char *matname) const
Search for a named material. All trailing blanks stripped.
Definition: TGeoManager.cxx:2771
TGeoVolume::FindOverlaps
void FindOverlaps() const
loop all nodes marked as overlaps and find overlapping brothers
Definition: TGeoVolume.cxx:2089
TFile
Definition: TFile.h:54
TGeoManager::fParallelWorld
TGeoParallelWorld * fParallelWorld
Definition: TGeoManager.h:152
TVirtualGeoPainter::PrintOverlaps
virtual void PrintOverlaps() const =0
TGeoManager::Edit
virtual void Edit(Option_t *option="")
Append a pad for this geometry.
Definition: TGeoManager.cxx:944
TGeoNode::SaveAttributes
void SaveAttributes(std::ostream &out)
save attributes for this node
Definition: TGeoNode.cxx:404
TGeoVolume::CreateDummyMedium
static void CreateDummyMedium()
Create a dummy medium.
Definition: TGeoVolume.cxx:412
TGeoManager::fVisOption
Int_t fVisOption
Definition: TGeoManager.h:75
TGeoMatrix.h
TGeoManager::fSizePNEId
Int_t fSizePNEId
array of physical node entries
Definition: TGeoManager.h:144
TGeoManager::fMasterVolume
TGeoVolume * fMasterVolume
top physical node
Definition: TGeoManager.h:131
TGDMLMatrix
Definition: TGDMLMatrix.h:34
TGeoManager::SaveAttributes
void SaveAttributes(const char *filename="tgeoatt.C")
Save current attributes in a macro.
Definition: TGeoManager.cxx:2438
TGeoNode::SetVisibility
void SetVisibility(Bool_t vis=kTRUE)
Set visibility of the node (obsolete).
Definition: TGeoNode.cxx:663
TGeoBuilder::MakeSphere
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
Definition: TGeoBuilder.cxx:191
TGeoShape::IsRunTimeShape
Bool_t IsRunTimeShape() const
Definition: TGeoShape.h:139
TGeoManager::fBorderSurfaces
TObjArray * fBorderSurfaces
Definition: TGeoManager.h:108
TGeoManager::RandomRays
void RandomRays(Int_t nrays=1000, Double_t startx=0, Double_t starty=0, Double_t startz=0, const char *target_vol=0, Bool_t check_norm=kFALSE)
Randomly shoot nrays and plot intersections with surfaces for current top node.
Definition: TGeoManager.cxx:2835
TMath::BinarySearch
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Definition: TMathBase.h:278
THashList.h
TGeoManager::Matrix
void Matrix(Int_t index, Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3)
Create rotation matrix named 'mat<index>'.
Definition: TGeoManager.cxx:1153
TGeoManager::Safety
Double_t Safety(Bool_t inside=kFALSE)
Compute safe distance from the current point.
Definition: TGeoManager.cxx:2115
TGeoManager::fgExportPrecision
static UInt_t fgExportPrecision
Maximum number of Xtru vertices.
Definition: TGeoManager.h:59
THashList::Delete
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: THashList.cxx:207
TGeoManager::fSkinSurfaces
TObjArray * fSkinSurfaces
Definition: TGeoManager.h:107
TGeoParallelWorld::CloseGeometry
Bool_t CloseGeometry()
The main geometry must be closed.
Definition: TGeoParallelWorld.cxx:132
TKey
Definition: TKey.h:28
TGeoNavigator::CheckPath
Bool_t CheckPath(const char *path) const
Check if a geometry path is valid without changing the state of the navigator.
Definition: TGeoNavigator.cxx:349
TGeoManager.h
TVirtualGeoPainter::SamplePoints
virtual TGeoNode * SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path)=0
TKey::ReadObj
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition: TKey.cxx:750
TSeqCollection
Definition: TSeqCollection.h:28
TGeoManager::CdDown
void CdDown(Int_t index)
Make a daughter of current node current.
Definition: TGeoManager.cxx:1536
TGeoManager::PrintOverlaps
void PrintOverlaps() const
Prints the current list of overlaps.
Definition: TGeoManager.cxx:3612
TGeoVolume::SetLineStyle
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TGeoVolume.cxx:2043
TGeoBuilder::MakeParaboloid
TGeoVolume * MakeParaboloid(const char *name, TGeoMedium *medium, Double_t rlo, Double_t rhi, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:286
TVirtualGeoPainter::SetCheckedNode
virtual void SetCheckedNode(TGeoNode *node)=0
TObjArray::AddAt
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
Definition: TObjArray.cxx:254
TGeoManager::TransformVolumeToAssembly
Int_t TransformVolumeToAssembly(const char *vname)
Transform all volumes named VNAME to assemblies. The volumes must be virtual.
Definition: TGeoManager.cxx:1083
TGeoManager::AddGDMLMatrix
void AddGDMLMatrix(TGDMLMatrix *mat)
Add GDML matrix;.
Definition: TGeoManager.cxx:1834
TGeoVolume::WeightA
Double_t WeightA() const
Analytical computation of the weight.
Definition: TGeoVolume.cxx:2347
gGeoManager
TGeoManager * gGeoManager
Definition: TGeoManager.cxx:289
TGeoManager::fGLMatrix
TGeoHMatrix * fGLMatrix
Definition: TGeoManager.h:132
TGeoManager::FindNextBoundaryAndStep
TGeoNode * FindNextBoundaryAndStep(Double_t stepmax=TGeoShape::Big(), Bool_t compsafe=kFALSE)
Compute distance to next boundary within STEPMAX.
Definition: TGeoManager.cxx:2514
TGeoManager::kG4Units
@ kG4Units
Definition: TGeoManager.h:48
TGeoNavigator::MasterToLocal
void MasterToLocal(const Double_t *master, Double_t *local) const
Definition: TGeoNavigator.h:188
TObjArray::Clear
virtual void Clear(Option_t *option="")
Remove all objects from the array.
Definition: TObjArray.cxx:321
TGeoManager::fHashPNE
THashList * fHashPNE
hash list of group volumes providing fast search
Definition: TGeoManager.h:142
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
TGeoManager::SetAnimateTracks
void SetAnimateTracks(Bool_t flag=kTRUE)
Definition: TGeoManager.h:580
TGeoMedium::GetByteCount
virtual Int_t GetByteCount() const
Definition: TGeoMedium.h:53
TGeoManager::GetDefaultUnits
static EDefaultUnits GetDefaultUnits()
Definition: TGeoManager.cxx:4009
TGeoManager::GetPath
const char * GetPath() const
Get path to the current node in the form /node0/node1/...
Definition: TGeoManager.cxx:2655
TGeoManager::SetNavigatorsLock
static void SetNavigatorsLock(Bool_t flag)
Set the lock for navigators.
Definition: TGeoManager.cxx:790
TGeoManager::fgMaxLevel
static Int_t fgMaxLevel
Verbosity level for Info messages (no IO).
Definition: TGeoManager.h:56
TObject::Draw
virtual void Draw(Option_t *option="")
Def