source: trunk/source/geometry/navigation/include/G4SafetyHelper.hh@ 1302

Last change on this file since 1302 was 1228, checked in by garnier, 16 years ago

update geant4.9.3 tag

File size: 4.5 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: G4SafetyHelper.hh,v 1.7 2007/05/02 15:32:13 japost Exp $
28// GEANT4 tag $Name: geant4-09-03 $
29//
30//
31// class G4SafetyHelper
32//
33// Class description:
34//
35// This class is a helper for physics processes which require
36// knowledge of the safety, and the step size for the 'mass' geometry
37
38// First version: J. Apostolakis, July 5th, 2006
39// Modified:
40// 10.04.07 V.Ivanchenko Use unique G4SafetyHelper
41// --------------------------------------------------------------------
42
43#ifndef G4SAFETYHELPER_HH
44#define G4SAFETYHELPER_HH 1
45
46#include <vector>
47
48#include "G4Types.hh"
49#include "G4ThreeVector.hh"
50#include "G4Navigator.hh"
51
52class G4PathFinder;
53
54class G4SafetyHelper
55{
56public: // with description
57
58 G4SafetyHelper();
59 ~G4SafetyHelper();
60 //
61 // Constructor and destructor
62
63 G4double CheckNextStep( const G4ThreeVector& position,
64 const G4ThreeVector& direction,
65 const G4double currentMaxStep,
66 G4double& newSafety );
67 //
68 // Return linear step for mass geometry
69
70 G4double ComputeSafety( const G4ThreeVector& pGlobalPoint );
71 //
72 // Return safety for all geometries
73
74 void Locate(const G4ThreeVector& pGlobalPoint,
75 const G4ThreeVector& direction);
76 //
77 // Locate the point for all geometries
78
79 void ReLocateWithinVolume(const G4ThreeVector& pGlobalPoint );
80 //
81 // Relocate the point in the volume of interest
82
83 inline void EnableParallelNavigation(G4bool parallel);
84 //
85 // To have parallel worlds considered, must be true.
86 // Alternative is to use single (mass) Navigator directly
87
88 void InitialiseNavigator();
89 //
90 // Check for new navigator for tracking, and reinitialise pointer
91
92 inline G4VPhysicalVolume* GetWorldVolume();
93 inline void SetCurrentSafety(G4double val, const G4ThreeVector& pos);
94
95public: // without description
96
97 void InitialiseHelper();
98
99private:
100
101 G4PathFinder* fpPathFinder;
102 G4Navigator* fpMassNavigator;
103 G4int fMassNavigatorId;
104
105 G4bool fUseParallelGeometries;
106 // Flag whether to use PathFinder or single (mass) Navigator directly
107 G4bool fFirstCall;
108 // Flag of first call
109
110 // State used during tracking -- for optimisation
111 G4ThreeVector fLastSafetyPosition;
112 G4double fLastSafety;
113 const G4double fRecomputeFactor;
114 // parameter for further optimisation:
115 // if ( move < fact*safety ) do fast recomputation of safety
116 // End State (tracking)
117};
118
119// Inline definitions
120
121inline
122void G4SafetyHelper::EnableParallelNavigation(G4bool parallel)
123{
124 fUseParallelGeometries = parallel;
125}
126
127inline
128G4VPhysicalVolume* G4SafetyHelper::GetWorldVolume()
129{
130 return fpMassNavigator->GetWorldVolume();
131}
132
133inline
134void G4SafetyHelper::SetCurrentSafety(G4double val, const G4ThreeVector& pos)
135{
136 fLastSafety = val;
137 fLastSafetyPosition = pos;
138}
139
140#endif
Note: See TracBrowser for help on using the repository browser.