Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ErrorPropagationNavigator.cc
Go to the documentation of this file.
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: G4ErrorPropagationNavigator.cc 66356 2012-12-18 09:02:32Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class implementation file
32 // --------------------------------------------------------------------
33 
35 
36 #include "globals.hh"
37 #include "G4ThreeVector.hh"
38 #include "G4ErrorPropagatorData.hh"
39 #include "G4ErrorSurfaceTarget.hh"
40 
41 //-------------------------------------------------------------------
42 
44  : G4Navigator()
45 {
46 }
47 
48 //-------------------------------------------------------------------
49 
51 {
52 }
53 
54 //-------------------------------------------------------------------
55 
57 ComputeStep ( const G4ThreeVector &pGlobalPoint,
58  const G4ThreeVector &pDirection,
59  const G4double pCurrentProposedStepLength,
60  G4double &pNewSafety )
61 {
62  G4double Step = G4Navigator::ComputeStep(pGlobalPoint, pDirection,
63  pCurrentProposedStepLength,
64  pNewSafety);
65 
66  G4ErrorPropagatorData * g4edata
68 
69  if (g4edata !=0)
70  {
71  const G4ErrorTarget* target = g4edata->GetTarget();
72  if( target != 0 )
73  {
74  G4double StepPlane= target->GetDistanceFromPoint(pGlobalPoint,pDirection);
75 
76  if( StepPlane < 0. ) // Negative means target is crossed, will not be found
77  {
78  StepPlane = DBL_MAX;
79  }
80 #ifdef G4VERBOSE
82  {
83  G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
84  << " Target step: " << StepPlane
85  << ", Transportation step: " << Step << G4endl;
86  target->Dump( "G4ErrorPropagationNavigator::ComputeStep Target " );
87  }
88 #endif
89 
90  if(StepPlane<Step)
91  {
92 #ifdef G4VERBOSE
94  {
95  G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
96  << " TargetCloserThanBoundary: " << StepPlane << " < "
97  << Step << G4endl;
98  }
99 #endif
100  Step = StepPlane;
102  }
103  else
104  {
106  }
107  }
108  }
109  pNewSafety = ComputeSafety(pGlobalPoint, pCurrentProposedStepLength);
110 
111 #ifdef G4VERBOSE
112  if( G4ErrorPropagatorData::verbose() >= 3 )
113  {
114  G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
115  << " Step: " << Step << ", ComputeSafety: " << pNewSafety
116  << G4endl;
117  }
118 #endif
119 
120  return Step;
121 }
122 
123 //-------------------------------------------------------------------
124 
126 ComputeSafety( const G4ThreeVector &pGlobalpoint,
127  const G4double pMaxLength,
128  const G4bool keepState )
129 {
130  G4double newSafety = G4Navigator::ComputeSafety(pGlobalpoint,
131  pMaxLength, keepState);
132 
133  G4ErrorPropagatorData *g4edata
135 
136  if (g4edata !=0)
137  {
138  const G4ErrorTarget* target = g4edata->GetTarget();
139  if( target != 0 )
140  {
141  G4double distance = target->GetDistanceFromPoint(pGlobalpoint);
142 
143  if(distance<newSafety)
144  {
145  newSafety = distance;
146  }
147  }
148  }
149  return newSafety;
150 }
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
Definition: G4Navigator.cc:701
const XML_Char * target
virtual void Dump(const G4String &msg) const =0
void SetState(G4ErrorState sta)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
Definition: Step.hh:41
virtual G4double GetDistanceFromPoint(const G4ThreeVector &, const G4ThreeVector &) const
const G4ErrorTarget * GetTarget(G4bool mustExist=0) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static G4ErrorPropagatorData * GetErrorPropagatorData()
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
#define DBL_MAX
Definition: templates.hh:83