source: trunk/source/geometry/navigation/include/G4TransportationManager.hh @ 1350

Last change on this file since 1350 was 1347, checked in by garnier, 14 years ago

geant4 tag 9.4

File size: 5.9 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4TransportationManager.hh,v 1.12 2007/04/20 15:28:37 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30// class G4TransportationManager
31//
32// Class description:
33//
34// A singleton class which stores the (volume) navigator used by
35// the transportation process to do the geometrical tracking.
36// It also stores a pointer to the propagator used in a (magnetic)
37// field and to the field manager.
38// The class instance is created before main() is called, and
39// in turn creates the navigator and the rest.
40
41// Created:  10 March 1997, J. Apostolakis
42// Reviewed: 26 April 2006, G. Cosmo
43// --------------------------------------------------------------------
44
45#ifndef  G4TransportationManager_hh
46#define  G4TransportationManager_hh
47
48#include "G4Navigator.hh"
49#include "G4SafetyHelper.hh"
50
51#include <vector>
52
53class G4PropagatorInField;
54class G4GeometryMessenger;
55class G4FieldManager;
56class G4VPhysicalVolume;
57
58class G4TransportationManager 
59{
60  public:  // with description
61
62     static G4TransportationManager* GetTransportationManager();
63       // Retrieve the static instance
64
65     inline G4PropagatorInField* GetPropagatorInField() const;
66     inline void SetPropagatorInField( G4PropagatorInField* newFieldPropagator );
67     inline G4FieldManager* GetFieldManager() const;
68     void SetFieldManager( G4FieldManager* newFieldManager );
69       // Accessors for field handling
70
71     inline G4Navigator* GetNavigatorForTracking() const;
72     inline void SetNavigatorForTracking( G4Navigator* newNavigator );
73       // Accessors for the navigator for tracking
74
75     inline void SetWorldForTracking(G4VPhysicalVolume* theWorld);
76       // Set the world volume for tracking
77       // This method is to be invoked by G4RunManagerKernel.
78
79     inline size_t GetNoActiveNavigators() const;
80     inline std::vector<G4Navigator*>::iterator GetActiveNavigatorsIterator();
81       // Return an iterator to the list of active navigators
82
83     inline size_t GetNoWorlds() const;
84     inline std::vector<G4VPhysicalVolume*>::iterator GetWorldsIterator();
85       // Return an iterator to the list of registered worlds
86
87     inline G4SafetyHelper* GetSafetyHelper() const;
88       // Return the pointer to the navigation safety helper instance
89
90     G4VPhysicalVolume* GetParallelWorld ( const G4String& worldName );
91       // Return an exact copy of the tracking world volume. If already
92       // existing just return the pointer
93
94     G4VPhysicalVolume* IsWorldExisting ( const G4String& worldName );
95       // Verify existance or not of an istance of the world volume with
96       // same name in the collection
97
98     G4Navigator* GetNavigator ( const G4String& worldName );
99     G4Navigator* GetNavigator ( G4VPhysicalVolume* aWorld );
100       // Return a navigator associated to either the world volume name
101       // or the pointer to world physical volume. If not existing already
102       // create it and register it in the collection
103
104     void DeRegisterNavigator( G4Navigator* aNavigator );
105     G4int  ActivateNavigator( G4Navigator* aNavigator );
106     void DeActivateNavigator( G4Navigator* aNavigator );
107     void InactivateAll();
108       // Methods for handling navigators. Navigator for tracking is always the
109       // first, i.e. position 0 in the collection and cannot be de-registered
110
111  protected:
112
113     G4TransportationManager();
114     ~G4TransportationManager(); 
115       // Singleton. Protected constructor and destructor
116
117  private:
118
119     void ClearNavigators();
120       // Clear collection of navigators and delete allocated objects
121     G4bool RegisterWorld( G4VPhysicalVolume* aWorld );
122     void DeRegisterWorld( G4VPhysicalVolume* aWorld );
123       // Register/de-register an already allocated world volume.
124       // The pointed object is not deleted.
125 
126  private:
127
128     std::vector<G4Navigator*> fNavigators;
129       // The collection of all navigators registered
130     std::vector<G4Navigator*> fActiveNavigators;
131       // The collection of only active navigators
132     std::vector<G4VPhysicalVolume*> fWorlds;
133       // The collection of worlds associated to the registered navigators
134
135     G4PropagatorInField*    fPropagatorInField;
136     G4FieldManager*         fFieldManager;
137     G4GeometryMessenger*    fGeomMessenger;
138     G4SafetyHelper*         fSafetyHelper;
139
140     static G4TransportationManager*  fTransportationManager;
141};
142
143#include "G4TransportationManager.icc"
144
145#endif
Note: See TracBrowser for help on using the repository browser.