00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 inline
00041 G4ThreeVector G4Navigator::GetCurrentLocalCoordinate() const
00042 {
00043 return fLastLocatedPointLocal;
00044 }
00045
00046
00047
00048
00049
00050
00051
00052 inline
00053 G4ThreeVector G4Navigator::ComputeLocalAxis(const G4ThreeVector& pVec) const
00054 {
00055 return (fHistory.GetTopTransform().IsRotated())
00056 ? fHistory.GetTopTransform().TransformAxis(pVec) : pVec ;
00057 }
00058
00059
00060
00061
00062
00063
00064
00065 inline
00066 G4ThreeVector
00067 G4Navigator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const
00068 {
00069 return ( fHistory.GetTopTransform().TransformPoint(pGlobalPoint) ) ;
00070 }
00071
00072
00073
00074
00075
00076
00077
00078 inline
00079 G4VPhysicalVolume* G4Navigator::GetWorldVolume() const
00080 {
00081 return fTopPhysical;
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 inline
00091 void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
00092 {
00093 if ( !(pWorld->GetTranslation()==G4ThreeVector(0,0,0)) )
00094 {
00095 G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
00096 FatalException, "Volume must be centered on the origin.");
00097 }
00098 const G4RotationMatrix* rm = pWorld->GetRotation();
00099 if ( rm && (!rm->isIdentity()) )
00100 {
00101 G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
00102 FatalException, "Volume must not be rotated.");
00103 }
00104 fTopPhysical = pWorld;
00105 fHistory.SetFirstEntry(pWorld);
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115 inline
00116 void G4Navigator::SetGeometricallyLimitedStep()
00117 {
00118 fWasLimitedByGeometry=true;
00119 }
00120
00121
00122
00123
00124
00125
00126
00127 inline
00128 void G4Navigator::ResetStackAndState()
00129 {
00130 fHistory.Reset();
00131 ResetState();
00132 }
00133
00134
00135
00136
00137
00138 inline
00139 EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const
00140 {
00141 EVolume type;
00142 EAxis axis;
00143 G4int nReplicas;
00144 G4double width,offset;
00145 G4bool consuming;
00146 if ( pVol->IsReplicated() )
00147 {
00148 pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
00149 type = (consuming) ? kReplica : kParameterised;
00150 }
00151 else
00152 {
00153 type = kNormal;
00154 }
00155 return type;
00156 }
00157
00158
00159
00160
00161
00162 inline
00163 EVolume G4Navigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const
00164 {
00165 EVolume type;
00166 EAxis axis;
00167 G4int nReplicas;
00168 G4double width,offset;
00169 G4bool consuming;
00170 G4VPhysicalVolume *pVol;
00171
00172 if ( pLog->GetNoDaughters()==1 )
00173 {
00174 pVol = pLog->GetDaughter(0);
00175 if (pVol->IsReplicated())
00176 {
00177 pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
00178 type = (consuming) ? kReplica : kParameterised;
00179 }
00180 else
00181 {
00182 type = kNormal;
00183 }
00184 }
00185 else
00186 {
00187 type = kNormal;
00188 }
00189 return type;
00190 }
00191
00192
00193
00194
00195
00196 inline
00197 G4int G4Navigator::
00198 GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
00199 {
00200 G4int regId = 0;
00201 G4VPhysicalVolume *pVol;
00202
00203 if ( pLog->GetNoDaughters()==1 )
00204 {
00205 pVol = pLog->GetDaughter(0);
00206 regId = pVol->GetRegularStructureId();
00207 }
00208 return regId;
00209 }
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 inline
00220 const G4AffineTransform& G4Navigator::GetGlobalToLocalTransform() const
00221 {
00222 return fHistory.GetTopTransform();
00223 }
00224
00225
00226
00227
00228
00229
00230
00231 inline
00232 const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const
00233 {
00234 G4AffineTransform tempTransform;
00235 tempTransform = fHistory.GetTopTransform().Inverse();
00236 return tempTransform;
00237 }
00238
00239
00240
00241
00242
00243
00244
00245 inline
00246 G4ThreeVector G4Navigator::NetTranslation() const
00247 {
00248 G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
00249 return tf.NetTranslation();
00250 }
00251
00252
00253
00254
00255
00256
00257
00258 inline
00259 G4RotationMatrix G4Navigator::NetRotation() const
00260 {
00261 G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
00262 return tf.NetRotation();
00263 }
00264
00265
00266
00267
00268
00269
00270
00271 inline
00272 G4GRSVolume* G4Navigator::CreateGRSVolume() const
00273 {
00274 G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
00275 return new G4GRSVolume(fHistory.GetTopVolume(),
00276 tf.NetRotation(),
00277 tf.NetTranslation());
00278 }
00279
00280
00281
00282
00283
00284
00285
00286 inline
00287 G4GRSSolid* G4Navigator::CreateGRSSolid() const
00288 {
00289 G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
00290 return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
00291 tf.NetRotation(),
00292 tf.NetTranslation());
00293 }
00294
00295
00296
00297
00298
00299
00300
00301 inline
00302 G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
00303 {
00304 return new G4TouchableHistory(fHistory);
00305 }
00306
00307
00308
00309
00310
00311
00312
00313 inline
00314 G4TouchableHistory*
00315 G4Navigator::CreateTouchableHistory(const G4NavigationHistory* history) const
00316 {
00317 return new G4TouchableHistory(*history);
00318 }
00319
00320
00321
00322
00323
00324 inline
00325 void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
00326 const G4ThreeVector& position,
00327 const G4ThreeVector& direction,
00328 G4TouchableHandle& oldTouchableToUpdate,
00329 const G4bool RelativeSearch )
00330 {
00331 G4VPhysicalVolume* pPhysVol;
00332 pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
00333 if( fEnteredDaughter || fExitedMother )
00334 {
00335 oldTouchableToUpdate = CreateTouchableHistory();
00336 if( pPhysVol == 0 )
00337 {
00338
00339
00340
00341 oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
00342 }
00343 }
00344 return;
00345 }
00346
00347
00348
00349
00350
00351
00352
00353 inline
00354 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
00355 const G4ThreeVector& position,
00356 const G4ThreeVector& direction,
00357 G4VTouchable* touchableToUpdate,
00358 const G4bool RelativeSearch )
00359 {
00360 G4VPhysicalVolume* pPhysVol;
00361 pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch);
00362 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
00363 }
00364
00365
00366
00367
00368
00369 inline
00370 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
00371 const G4ThreeVector& position,
00372 G4VTouchable* touchableToUpdate,
00373 const G4bool RelativeSearch )
00374 {
00375 G4VPhysicalVolume* pPhysVol;
00376 pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);
00377 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
00378 }
00379
00380
00381
00382
00383
00384 inline
00385 G4int G4Navigator::GetVerboseLevel() const
00386 {
00387 return fVerbose;
00388 }
00389
00390
00391
00392
00393
00394 inline
00395 void G4Navigator::SetVerboseLevel(G4int level)
00396 {
00397 fVerbose = level;
00398 fnormalNav.SetVerboseLevel(level);
00399 fvoxelNav.SetVerboseLevel(level);
00400 fparamNav.SetVerboseLevel(level);
00401 freplicaNav.SetVerboseLevel(level);
00402 fregularNav.SetVerboseLevel(level);
00403 }
00404
00405
00406
00407
00408
00409 inline
00410 G4bool G4Navigator::IsActive() const
00411 {
00412 return fActive;
00413 }
00414
00415
00416
00417
00418
00419 inline
00420 void G4Navigator::Activate(G4bool flag)
00421 {
00422 fActive = flag;
00423 }
00424
00425
00426
00427
00428
00429
00430
00431 inline
00432 G4bool G4Navigator::EnteredDaughterVolume() const
00433 {
00434 return fEnteredDaughter;
00435 }
00436
00437
00438
00439
00440
00441 inline
00442 G4bool G4Navigator::ExitedMotherVolume() const
00443 {
00444 return fExitedMother;
00445 }
00446
00447
00448
00449
00450
00451 inline
00452 void G4Navigator::CheckMode(G4bool mode)
00453 {
00454 fCheck = mode;
00455 fnormalNav.CheckMode(mode);
00456 fvoxelNav.CheckMode(mode);
00457 fparamNav.CheckMode(mode);
00458 freplicaNav.CheckMode(mode);
00459 fregularNav.CheckMode(mode);
00460 }
00461
00462
00463
00464
00465
00466 inline
00467 G4bool G4Navigator::IsCheckModeActive() const
00468 {
00469 return fCheck;
00470 }
00471
00472
00473
00474
00475
00476 inline
00477 void G4Navigator::SetPushVerbosity(G4bool mode)
00478 {
00479 fWarnPush = mode;
00480 }
00481
00482
00483
00484
00485
00486
00487
00488
00489 inline
00490 G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const
00491 {
00492 G4int severity=0, noZeros= fNumberZeroSteps;
00493 if( noZeroSteps) *noZeroSteps = fNumberZeroSteps;
00494
00495 if( noZeros >= fAbandonThreshold_NoZeroSteps )
00496 {
00497 severity = 10;
00498 }
00499 if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps )
00500 {
00501 severity = 5 * noZeros / fActionThreshold_NoZeroSteps;
00502 }
00503 else if( noZeros == fActionThreshold_NoZeroSteps )
00504 {
00505 severity = 5;
00506 }
00507 else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 )
00508 {
00509 severity = 9;
00510 }
00511 else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 )
00512 {
00513 severity = 5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps)
00514 / fActionThreshold_NoZeroSteps;
00515 }
00516 return severity;
00517 }
00518
00519
00520
00521
00522
00523 inline void G4Navigator::EnableBestSafety( G4bool value )
00524 {
00525 fvoxelNav.EnableBestSafety( value );
00526 }