Warning, file /include/Geant4/G4Navigator.icc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 inline
0037 G4ThreeVector G4Navigator::GetCurrentLocalCoordinate() const
0038 {
0039 return fLastLocatedPointLocal;
0040 }
0041
0042
0043
0044
0045
0046
0047
0048 inline
0049 G4ThreeVector G4Navigator::ComputeLocalAxis(const G4ThreeVector& pVec) const
0050 {
0051 return fHistory.GetTopTransform().TransformAxis(pVec);
0052 }
0053
0054
0055
0056
0057
0058
0059
0060 inline
0061 G4ThreeVector
0062 G4Navigator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const
0063 {
0064 return fHistory.GetTopTransform().TransformPoint(pGlobalPoint);
0065 }
0066
0067
0068
0069
0070
0071
0072
0073 inline
0074 G4VPhysicalVolume* G4Navigator::GetWorldVolume() const
0075 {
0076 return fTopPhysical;
0077 }
0078
0079
0080
0081
0082
0083
0084
0085 inline
0086 void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
0087 {
0088 if ( !(pWorld->GetTranslation() == G4ThreeVector(0,0,0)) )
0089 {
0090 G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
0091 FatalException, "Volume must be centered on the origin.");
0092 }
0093 const G4RotationMatrix* rm = pWorld->GetRotation();
0094 if ( (rm != nullptr) && (!rm->isIdentity()) )
0095 {
0096 G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
0097 FatalException, "Volume must not be rotated.");
0098 }
0099 fTopPhysical = pWorld;
0100 fHistory.SetFirstEntry(pWorld);
0101 }
0102
0103
0104
0105
0106
0107
0108
0109
0110 inline
0111 void G4Navigator::SetGeometricallyLimitedStep()
0112 {
0113 fWasLimitedByGeometry = true;
0114 }
0115
0116
0117
0118
0119
0120
0121
0122 inline
0123 void G4Navigator::ResetStackAndState()
0124 {
0125 fHistory.Reset();
0126 ResetState();
0127 }
0128
0129
0130
0131
0132
0133 inline
0134 EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const
0135 {
0136 return pVol->VolumeType();
0137 }
0138
0139
0140
0141
0142
0143 inline
0144 EVolume G4Navigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const
0145 {
0146 return pLog->CharacteriseDaughters();
0147 }
0148
0149
0150
0151
0152
0153 inline
0154 G4int G4Navigator::
0155 GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
0156 {
0157 G4int regId = 0;
0158 G4VPhysicalVolume *pVol;
0159
0160 if ( pLog->GetNoDaughters() == 1 )
0161 {
0162 pVol = pLog->GetDaughter(0);
0163 regId = pVol->GetRegularStructureId();
0164 }
0165 return regId;
0166 }
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176 inline
0177 const G4AffineTransform& G4Navigator::GetGlobalToLocalTransform() const
0178 {
0179 return fHistory.GetTopTransform();
0180 }
0181
0182
0183
0184
0185
0186
0187
0188 inline
0189 const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const
0190 {
0191 return fHistory.GetTopTransform().Inverse();
0192 }
0193
0194
0195
0196
0197
0198
0199
0200 inline
0201 G4ThreeVector G4Navigator::NetTranslation() const
0202 {
0203 return fHistory.GetTopTransform().InverseNetTranslation();
0204 }
0205
0206
0207
0208
0209
0210
0211
0212 inline
0213 G4RotationMatrix G4Navigator::NetRotation() const
0214 {
0215 return fHistory.GetTopTransform().InverseNetRotation();
0216 }
0217
0218
0219
0220
0221
0222
0223
0224 inline
0225 G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
0226 {
0227 return new G4TouchableHistory(fHistory);
0228 }
0229
0230
0231
0232
0233
0234
0235
0236 inline
0237 G4TouchableHistory*
0238 G4Navigator::CreateTouchableHistory(const G4NavigationHistory* history) const
0239 {
0240 return new G4TouchableHistory(*history);
0241 }
0242
0243
0244
0245
0246
0247 inline
0248 void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
0249 const G4ThreeVector& position,
0250 const G4ThreeVector& direction,
0251 G4TouchableHandle& oldTouchableToUpdate,
0252 const G4bool RelativeSearch )
0253 {
0254 G4VPhysicalVolume* pPhysVol;
0255 pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
0256 if( fEnteredDaughter || fExitedMother )
0257 {
0258 oldTouchableToUpdate = CreateTouchableHistory();
0259 if( pPhysVol == nullptr )
0260 {
0261
0262
0263
0264 oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
0265 }
0266 }
0267 return;
0268 }
0269
0270
0271
0272
0273
0274
0275
0276 inline
0277 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
0278 const G4ThreeVector& position,
0279 const G4ThreeVector& direction,
0280 G4VTouchable* touchableToUpdate,
0281 const G4bool RelativeSearch )
0282 {
0283 G4VPhysicalVolume* pPhysVol;
0284 pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch);
0285 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
0286 }
0287
0288
0289
0290
0291
0292 inline
0293 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
0294 const G4ThreeVector& position,
0295 G4VTouchable* touchableToUpdate,
0296 const G4bool RelativeSearch )
0297 {
0298 G4VPhysicalVolume* pPhysVol;
0299 pPhysVol = LocateGlobalPointAndSetup( position, nullptr, RelativeSearch);
0300 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
0301 }
0302
0303
0304
0305
0306
0307 inline
0308 G4int G4Navigator::GetVerboseLevel() const
0309 {
0310 return fVerbose;
0311 }
0312
0313
0314
0315
0316
0317 inline
0318 void G4Navigator::SetVerboseLevel(G4int level)
0319 {
0320 fVerbose = level;
0321 fnormalNav.SetVerboseLevel(level);
0322 GetVoxelNavigator().SetVerboseLevel(level);
0323 fparamNav.SetVerboseLevel(level);
0324 freplicaNav.SetVerboseLevel(level);
0325 fregularNav.SetVerboseLevel(level);
0326 if (fpExternalNav != nullptr) { fpExternalNav->SetVerboseLevel(level); }
0327 }
0328
0329
0330
0331
0332
0333 inline
0334 G4bool G4Navigator::IsActive() const
0335 {
0336 return fActive;
0337 }
0338
0339
0340
0341
0342
0343 inline
0344 void G4Navigator::Activate(G4bool flag)
0345 {
0346 fActive = flag;
0347 }
0348
0349
0350
0351
0352
0353
0354
0355 inline
0356 G4bool G4Navigator::EnteredDaughterVolume() const
0357 {
0358 return fEnteredDaughter;
0359 }
0360
0361
0362
0363
0364
0365 inline
0366 G4bool G4Navigator::ExitedMotherVolume() const
0367 {
0368 return fExitedMother;
0369 }
0370
0371
0372
0373
0374
0375 inline
0376 void G4Navigator::CheckMode(G4bool mode)
0377 {
0378 fCheck = mode;
0379 fnormalNav.CheckMode(mode);
0380 GetVoxelNavigator().CheckMode(mode);
0381 fparamNav.CheckMode(mode);
0382 freplicaNav.CheckMode(mode);
0383 fregularNav.CheckMode(mode);
0384 if (fpExternalNav != nullptr) { fpExternalNav->CheckMode(mode); }
0385 }
0386
0387
0388
0389
0390
0391 inline
0392 G4bool G4Navigator::IsCheckModeActive() const
0393 {
0394 return fCheck;
0395 }
0396
0397
0398
0399
0400
0401 inline
0402 void G4Navigator::SetPushVerbosity(G4bool mode)
0403 {
0404 fWarnPush = mode;
0405 }
0406
0407
0408
0409
0410
0411
0412
0413
0414 inline
0415 G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const
0416 {
0417 G4int severity = 0, noZeros = fNumberZeroSteps;
0418 if( noZeroSteps != nullptr )
0419 {
0420 *noZeroSteps = fNumberZeroSteps;
0421 }
0422 if( noZeros >= fAbandonThreshold_NoZeroSteps )
0423 {
0424 severity = 10;
0425 }
0426 if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps )
0427 {
0428 severity = 5 * noZeros / fActionThreshold_NoZeroSteps;
0429 }
0430 else if( noZeros == fActionThreshold_NoZeroSteps )
0431 {
0432 severity = 5;
0433 }
0434 else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 )
0435 {
0436 severity = 9;
0437 }
0438 else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 )
0439 {
0440 severity = 5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps)
0441 / fActionThreshold_NoZeroSteps;
0442 }
0443 return severity;
0444 }
0445
0446
0447
0448
0449
0450 inline
0451 G4VoxelNavigation& G4Navigator::GetVoxelNavigator()
0452 {
0453 return *fpvoxelNav;
0454 }
0455
0456
0457
0458
0459
0460 inline void G4Navigator::EnableBestSafety( G4bool value )
0461 {
0462 GetVoxelNavigator().EnableBestSafety( value );
0463 }
0464
0465
0466
0467
0468
0469 inline
0470 G4VExternalNavigation* G4Navigator::GetExternalNavigation() const
0471 {
0472 return fpExternalNav;
0473 }
0474
0475
0476
0477
0478
0479 inline
0480 G4Navigator* G4Navigator::Clone() const
0481 {
0482 auto clone_nav = new G4Navigator();
0483 clone_nav->SetWorldVolume(fTopPhysical);
0484 if( fpExternalNav != nullptr )
0485 {
0486 clone_nav->SetExternalNavigation(fpExternalNav->Clone());
0487 }
0488 return clone_nav;
0489 }