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