Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGeoParallelWorld.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
3  * All rights reserved. *
4  * *
5  * For the licensing terms see $ROOTSYS/LICENSE. *
6  * For the list of contributors see $ROOTSYS/README/CREDITS. *
7  *************************************************************************/
8 
9 // Author: Andrei Gheata 30/06/14
10 
11 #ifndef ROOT_TGeoParallelWorld
12 #define ROOT_TGeoParallelWorld
13 
14 
15 #include "TGeoVolume.h"
16 
17 // forward declarations
18 class TGeoManager;
19 class TGeoPhysicalNode;
20 class TGeoVolume;
21 
22 class TGeoParallelWorld : public TNamed
23 {
24 protected :
25  TGeoManager *fGeoManager; // base geometry
26  TObjArray *fPaths; // array of paths
27  Bool_t fUseOverlaps; // Activated if user defined overlapping candidates
28  Bool_t fIsClosed; //! Closed flag
29  TGeoVolume *fVolume; //! helper volume
30  TGeoPhysicalNode *fLastState; //! Last PN touched
31  TObjArray *fPhysical; //! array of physical nodes
32 
33  TGeoParallelWorld(const TGeoParallelWorld&);
34  TGeoParallelWorld& operator=(const TGeoParallelWorld&);
35 
36 public:
37  // constructors
38  TGeoParallelWorld() : TNamed(),fGeoManager(0),fPaths(0),fUseOverlaps(kFALSE),fIsClosed(kFALSE),fVolume(0),fLastState(0),fPhysical(0) {}
39  TGeoParallelWorld(const char *name, TGeoManager *mgr);
40 
41  // destructor
42  virtual ~TGeoParallelWorld();
43  // API for adding components nodes
44  void AddNode(const char *path);
45  // Activate/deactivate overlap usage
46  void SetUseOverlaps(Bool_t flag) {fUseOverlaps = flag;}
47  Bool_t IsUsingOverlaps() const {return fUseOverlaps;}
48  void ResetOverlaps() const;
49  // Adding overlap candidates can highly improve performance.
50  void AddOverlap(TGeoVolume *vol, Bool_t activate=kTRUE);
51  void AddOverlap(const char *volname, Bool_t activate=kTRUE);
52  // The normal PW mode (without declaring overlaps) does detect them
53  Int_t PrintDetectedOverlaps() const;
54 
55  // Closing a parallel geometry is mandatory
56  Bool_t CloseGeometry();
57  // Refresh structures in case of re-alignment
58  void RefreshPhysicalNodes();
59 
60  // Navigation interface
61  TGeoPhysicalNode *FindNode(Double_t point[3]);
62  TGeoPhysicalNode *FindNextBoundary(Double_t point[3], Double_t dir[3], Double_t &step, Double_t stepmax=1.E30);
63  Double_t Safety(Double_t point[3], Double_t safmax=1.E30);
64 
65  // Getters
66  TGeoManager *GetGeometry() const {return fGeoManager;}
67  Bool_t IsClosed() const {return fIsClosed;}
68  TGeoVolume *GetVolume() const {return fVolume;}
69 
70  // Utilities
71  void CheckOverlaps(Double_t ovlp=0.001); // default 10 microns
72  void Draw(Option_t *option);
73 
74  ClassDef(TGeoParallelWorld, 3) // parallel world base class
75 };
76 
77 #endif
78