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