Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NormalNavigation Class Reference

#include <G4NormalNavigation.hh>

Public Member Functions

 G4NormalNavigation ()
 
 ~G4NormalNavigation ()
 
G4bool LevelLocate (G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
 
G4double ComputeStep (const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
 
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX)
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
void CheckMode (G4bool mode)
 

Detailed Description

Definition at line 53 of file G4NormalNavigation.hh.

Constructor & Destructor Documentation

G4NormalNavigation::G4NormalNavigation ( )

Definition at line 43 of file G4NormalNavigation.cc.

44  : fCheck(false)
45 {
46  fLogger = new G4NavigationLogger("G4NormalNavigation");
47 }
G4NormalNavigation::~G4NormalNavigation ( )

Definition at line 53 of file G4NormalNavigation.cc.

54 {
55  delete fLogger;
56 }

Member Function Documentation

void G4NormalNavigation::CheckMode ( G4bool  mode)
inline
G4double G4NormalNavigation::ComputeSafety ( const G4ThreeVector globalpoint,
const G4NavigationHistory history,
const G4double  pMaxLength = DBL_MAX 
)

Definition at line 229 of file G4NormalNavigation.cc.

References G4NavigationLogger::ComputeSafetyLog(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopVolume(), G4VPhysicalVolume::GetTranslation(), and G4AffineTransform::Invert().

Referenced by G4RegularNavigation::ComputeSafety(), G4Navigator::ComputeSafety(), and G4ITNavigator::ComputeSafety().

232 {
233  G4VPhysicalVolume *motherPhysical, *samplePhysical;
234  G4LogicalVolume *motherLogical;
235  G4VSolid *motherSolid;
236  G4double motherSafety, ourSafety;
237  G4int localNoDaughters, sampleNo;
238 
239  motherPhysical = history.GetTopVolume();
240  motherLogical = motherPhysical->GetLogicalVolume();
241  motherSolid = motherLogical->GetSolid();
242 
243  // Compute mother safety
244  //
245  motherSafety = motherSolid->DistanceToOut(localPoint);
246  ourSafety = motherSafety; // Working isotropic safety
247 
248 #ifdef G4VERBOSE
249  if( fCheck )
250  {
251  fLogger->ComputeSafetyLog(motherSolid, localPoint, motherSafety, true);
252  }
253 #endif
254 
255  // Compute daughter safeties
256  //
257  localNoDaughters = motherLogical->GetNoDaughters();
258  for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo-- )
259  {
260  samplePhysical = motherLogical->GetDaughter(sampleNo);
261  G4AffineTransform sampleTf(samplePhysical->GetRotation(),
262  samplePhysical->GetTranslation());
263  sampleTf.Invert();
264  const G4ThreeVector samplePoint =
265  sampleTf.TransformPoint(localPoint);
266  const G4VSolid *sampleSolid =
267  samplePhysical->GetLogicalVolume()->GetSolid();
268  const G4double sampleSafety =
269  sampleSolid->DistanceToIn(samplePoint);
270  if ( sampleSafety<ourSafety )
271  {
272  ourSafety = sampleSafety;
273  }
274 #ifdef G4VERBOSE
275  if(fCheck)
276  {
277  fLogger->ComputeSafetyLog(sampleSolid, samplePoint, sampleSafety, false);
278  }
279 #endif
280  }
281  return ourSafety;
282 }
G4VPhysicalVolume * GetTopVolume() const
const G4ThreeVector & GetTranslation() const
void ComputeSafetyLog(const G4VSolid *solid, const G4ThreeVector &point, G4double safety, G4bool banner) const
G4VPhysicalVolume * GetDaughter(const G4int i) const
int G4int
Definition: G4Types.hh:78
G4AffineTransform & Invert()
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4int GetNoDaughters() const
G4LogicalVolume * GetLogicalVolume() const
const G4RotationMatrix * GetRotation() const
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4VSolid * GetSolid() const
G4double G4NormalNavigation::ComputeStep ( const G4ThreeVector localPoint,
const G4ThreeVector localDirection,
const G4double  currentProposedStepLength,
G4double newSafety,
G4NavigationHistory history,
G4bool validExitNormal,
G4ThreeVector exitNormal,
G4bool exiting,
G4bool entering,
G4VPhysicalVolume **  pBlockedPhysical,
G4int blockedReplicaNo 
)

Definition at line 63 of file G4NormalNavigation.cc.

References G4NavigationLogger::AlongComputeStepLog(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), CLHEP::Hep3Vector::dot(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopVolume(), G4VPhysicalVolume::GetTranslation(), CLHEP::HepRotation::inverse(), G4AffineTransform::Invert(), G4NavigationLogger::PostComputeStepLog(), G4NavigationLogger::PreComputeStepLog(), and G4NavigationLogger::PrintDaughterLog().

Referenced by G4RegularNavigation::ComputeStep(), G4Navigator::ComputeStep(), G4ITNavigator::ComputeStep(), and G4RegularNavigation::ComputeStepSkippingEqualMaterials().

74 {
75  G4VPhysicalVolume *motherPhysical, *samplePhysical, *blockedExitedVol=0;
76  G4LogicalVolume *motherLogical;
77  G4VSolid *motherSolid;
78  G4ThreeVector sampleDirection;
79  G4double ourStep=currentProposedStepLength, motherSafety, ourSafety;
80  G4int localNoDaughters, sampleNo;
81 
82  motherPhysical = history.GetTopVolume();
83  motherLogical = motherPhysical->GetLogicalVolume();
84  motherSolid = motherLogical->GetSolid();
85 
86  // Compute mother safety
87  //
88  motherSafety = motherSolid->DistanceToOut(localPoint);
89  ourSafety = motherSafety; // Working isotropic safety
90 
91 #ifdef G4VERBOSE
92  if ( fCheck )
93  {
94  fLogger->PreComputeStepLog(motherPhysical, motherSafety, localPoint);
95  }
96 #endif
97 
98  //
99  // Compute daughter safeties & intersections
100  //
101 
102  // Exiting normal optimisation
103  //
104  if ( exiting&&validExitNormal )
105  {
106  if ( localDirection.dot(exitNormal)>=kMinExitingNormalCosine )
107  {
108  // Block exited daughter volume
109  //
110  blockedExitedVol =* pBlockedPhysical;
111  ourSafety = 0;
112  }
113  }
114  exiting = false;
115  entering = false;
116 
117  localNoDaughters = motherLogical->GetNoDaughters();
118  for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo--)
119  {
120  samplePhysical = motherLogical->GetDaughter(sampleNo);
121  if ( samplePhysical!=blockedExitedVol )
122  {
123  G4AffineTransform sampleTf(samplePhysical->GetRotation(),
124  samplePhysical->GetTranslation());
125  sampleTf.Invert();
126  const G4ThreeVector samplePoint =
127  sampleTf.TransformPoint(localPoint);
128  const G4VSolid *sampleSolid =
129  samplePhysical->GetLogicalVolume()->GetSolid();
130  const G4double sampleSafety =
131  sampleSolid->DistanceToIn(samplePoint);
132 #ifdef G4VERBOSE
133  if( fCheck )
134  {
135  fLogger->PrintDaughterLog(sampleSolid, samplePoint, sampleSafety, 0);
136  }
137 #endif
138  if ( sampleSafety<ourSafety )
139  {
140  ourSafety=sampleSafety;
141  }
142  if ( sampleSafety<=ourStep )
143  {
144  sampleDirection = sampleTf.TransformAxis(localDirection);
145  const G4double sampleStep =
146  sampleSolid->DistanceToIn(samplePoint,sampleDirection);
147 
148 #ifdef G4VERBOSE
149  if( fCheck )
150  {
151  fLogger->PrintDaughterLog(sampleSolid, samplePoint,
152  sampleSafety, sampleStep);
153  }
154 #endif
155  if ( sampleStep<=ourStep )
156  {
157  ourStep = sampleStep;
158  entering = true;
159  exiting = false;
160  *pBlockedPhysical = samplePhysical;
161  blockedReplicaNo = -1;
162 #ifdef G4VERBOSE
163  if( fCheck )
164  {
165  fLogger->AlongComputeStepLog(sampleSolid, samplePoint,
166  sampleDirection, localDirection, sampleSafety, sampleStep);
167  }
168 #endif
169  }
170  }
171  }
172  }
173  if ( currentProposedStepLength<ourSafety )
174  {
175  // Guaranteed physics limited
176  //
177  entering = false;
178  exiting = false;
179  *pBlockedPhysical = 0;
180  ourStep = kInfinity;
181  }
182  else
183  {
184  // Compute mother intersection if required
185  //
186  if ( motherSafety<=ourStep )
187  {
188  G4double motherStep = motherSolid->DistanceToOut(localPoint,
189  localDirection,
190  true,
191  &validExitNormal,
192  &exitNormal);
193 #ifdef G4VERBOSE
194  if ( fCheck )
195  {
196  fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection,
197  motherStep, motherSafety);
198  }
199 #endif
200 
201  if ( motherStep<=ourStep )
202  {
203  ourStep = motherStep;
204  exiting = true;
205  entering = false;
206  if ( validExitNormal )
207  {
208  const G4RotationMatrix *rot = motherPhysical->GetRotation();
209  if (rot)
210  {
211  exitNormal *= rot->inverse();
212  }
213  }
214  }
215  else
216  {
217  validExitNormal = false;
218  }
219  }
220  }
221  newSafety = ourSafety;
222  return ourStep;
223 }
void AlongComputeStepLog(const G4VSolid *sampleSolid, const G4ThreeVector &samplePoint, const G4ThreeVector &sampleDirection, const G4ThreeVector &localDirection, G4double sampleSafety, G4double sampleStep) const
G4VPhysicalVolume * GetTopVolume() const
const G4ThreeVector & GetTranslation() const
double dot(const Hep3Vector &) const
void PrintDaughterLog(const G4VSolid *sampleSolid, const G4ThreeVector &samplePoint, G4double sampleSafety, G4double sampleStep) const
G4VPhysicalVolume * GetDaughter(const G4int i) const
int G4int
Definition: G4Types.hh:78
HepRotation inverse() const
G4AffineTransform & Invert()
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4int GetNoDaughters() const
G4LogicalVolume * GetLogicalVolume() const
void PreComputeStepLog(const G4VPhysicalVolume *motherPhysical, G4double motherSafety, const G4ThreeVector &localPoint) const
const G4RotationMatrix * GetRotation() const
void PostComputeStepLog(const G4VSolid *motherSolid, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, G4double motherStep, G4double motherSafety) const
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4VSolid * GetSolid() const
G4int G4NormalNavigation::GetVerboseLevel ( ) const
inline
G4bool G4NormalNavigation::LevelLocate ( G4NavigationHistory history,
const G4VPhysicalVolume blockedVol,
const G4int  blockedNum,
const G4ThreeVector globalPoint,
const G4ThreeVector globalDirection,
const G4bool  pLocatedOnEdge,
G4ThreeVector localPoint 
)
void G4NormalNavigation::SetVerboseLevel ( G4int  level)
inline

The documentation for this class was generated from the following files: