Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4Navigator class Inline implementation << 27 // 26 // 28 // ------------------------------------------- << 27 // $Id: G4Navigator.icc,v 1.18 2010-12-15 13:46:39 gcosmo Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-01 $ >> 29 // >> 30 // >> 31 // class G4Navigator Inline implementation >> 32 // >> 33 // ******************************************************************** 29 34 30 // ******************************************* 35 // ******************************************************************** 31 // GetCurrentLocalCoordinate 36 // GetCurrentLocalCoordinate 32 // 37 // 33 // Returns the local coordinate of the current 38 // Returns the local coordinate of the current track 34 // ******************************************* 39 // ******************************************************************** 35 // 40 // 36 inline 41 inline 37 G4ThreeVector G4Navigator::GetCurrentLocalCoor 42 G4ThreeVector G4Navigator::GetCurrentLocalCoordinate() const 38 { 43 { 39 return fLastLocatedPointLocal; 44 return fLastLocatedPointLocal; 40 } 45 } 41 46 42 // ******************************************* 47 // ******************************************************************** 43 // ComputeLocalAxis 48 // ComputeLocalAxis 44 // 49 // 45 // Returns local direction of vector direction 50 // Returns local direction of vector direction in world coord system 46 // ******************************************* 51 // ******************************************************************** 47 // 52 // 48 inline 53 inline 49 G4ThreeVector G4Navigator::ComputeLocalAxis(co 54 G4ThreeVector G4Navigator::ComputeLocalAxis(const G4ThreeVector& pVec) const 50 { 55 { 51 return fHistory.GetTopTransform().TransformA << 56 return (fHistory.GetTopTransform().IsRotated()) >> 57 ? fHistory.GetTopTransform().TransformAxis(pVec) : pVec ; 52 } 58 } 53 59 54 // ******************************************* 60 // ******************************************************************** 55 // ComputeLocalPoint 61 // ComputeLocalPoint 56 // 62 // 57 // Returns local coordinates of a point in the 63 // Returns local coordinates of a point in the world coord system 58 // ******************************************* 64 // ******************************************************************** 59 // 65 // 60 inline 66 inline 61 G4ThreeVector 67 G4ThreeVector 62 G4Navigator::ComputeLocalPoint(const G4ThreeVe 68 G4Navigator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const 63 { 69 { 64 return fHistory.GetTopTransform().TransformP << 70 return ( fHistory.GetTopTransform().TransformPoint(pGlobalPoint) ) ; 65 } 71 } 66 72 67 // ******************************************* 73 // ******************************************************************** 68 // GetWorldVolume 74 // GetWorldVolume 69 // 75 // 70 // Returns the current world (`topmost') volu 76 // Returns the current world (`topmost') volume 71 // ******************************************* 77 // ******************************************************************** 72 // 78 // 73 inline 79 inline 74 G4VPhysicalVolume* G4Navigator::GetWorldVolume 80 G4VPhysicalVolume* G4Navigator::GetWorldVolume() const 75 { 81 { 76 return fTopPhysical; 82 return fTopPhysical; 77 } 83 } 78 84 79 // ******************************************* 85 // ******************************************************************** 80 // SetWorldVolume 86 // SetWorldVolume 81 // 87 // 82 // Sets the world (`topmost') volume 88 // Sets the world (`topmost') volume 83 // ******************************************* 89 // ******************************************************************** 84 // 90 // 85 inline 91 inline 86 void G4Navigator::SetWorldVolume(G4VPhysicalVo 92 void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld) 87 { 93 { 88 if ( !(pWorld->GetTranslation() == G4ThreeVe << 94 if ( !(pWorld->GetTranslation()==G4ThreeVector(0,0,0)) ) 89 { 95 { 90 G4Exception ("G4Navigator::SetWorldVolume( << 96 G4Exception ("G4Navigator::SetWorldVolume()", "InvalidSetup", 91 FatalException, "Volume must 97 FatalException, "Volume must be centered on the origin."); 92 } 98 } 93 const G4RotationMatrix* rm = pWorld->GetRota 99 const G4RotationMatrix* rm = pWorld->GetRotation(); 94 if ( (rm != nullptr) && (!rm->isIdentity()) << 100 if ( rm && (!rm->isIdentity()) ) 95 { 101 { 96 G4Exception ("G4Navigator::SetWorldVolume( << 102 G4Exception ("G4Navigator::SetWorldVolume()", "InvalidSetup", 97 FatalException, "Volume must 103 FatalException, "Volume must not be rotated."); 98 } 104 } 99 fTopPhysical = pWorld; 105 fTopPhysical = pWorld; 100 fHistory.SetFirstEntry(pWorld); 106 fHistory.SetFirstEntry(pWorld); 101 } 107 } 102 108 103 // ******************************************* 109 // ******************************************************************** 104 // SetGeometrycallyLimitedStep 110 // SetGeometrycallyLimitedStep 105 // 111 // 106 // Informs the navigator that the previous Ste 112 // Informs the navigator that the previous Step calculated 107 // by the geometry was taken in its entirety 113 // by the geometry was taken in its entirety 108 // ******************************************* 114 // ******************************************************************** 109 // 115 // 110 inline 116 inline 111 void G4Navigator::SetGeometricallyLimitedStep( 117 void G4Navigator::SetGeometricallyLimitedStep() 112 { 118 { 113 fWasLimitedByGeometry = true; << 119 fWasLimitedByGeometry=true; 114 } 120 } 115 121 116 // ******************************************* 122 // ******************************************************************** 117 // ResetStackAndState 123 // ResetStackAndState 118 // 124 // 119 // Resets stack and minimum of navigator state 125 // Resets stack and minimum of navigator state `machine' 120 // ******************************************* 126 // ******************************************************************** 121 // 127 // 122 inline 128 inline 123 void G4Navigator::ResetStackAndState() 129 void G4Navigator::ResetStackAndState() 124 { 130 { 125 fHistory.Reset(); 131 fHistory.Reset(); 126 ResetState(); 132 ResetState(); 127 } 133 } 128 134 129 // ******************************************* 135 // ******************************************************************** 130 // VolumeType 136 // VolumeType 131 // ******************************************* 137 // ******************************************************************** 132 // 138 // 133 inline 139 inline 134 EVolume G4Navigator::VolumeType(const G4VPhysi 140 EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const 135 { 141 { 136 return pVol->VolumeType(); << 142 EVolume type; >> 143 EAxis axis; >> 144 G4int nReplicas; >> 145 G4double width,offset; >> 146 G4bool consuming; >> 147 if ( pVol->IsReplicated() ) >> 148 { >> 149 pVol->GetReplicationData(axis,nReplicas,width,offset,consuming); >> 150 type = (consuming) ? kReplica : kParameterised; >> 151 } >> 152 else >> 153 { >> 154 type = kNormal; >> 155 } >> 156 return type; 137 } 157 } 138 158 139 // ******************************************* 159 // ******************************************************************** 140 // CharacteriseDaughters 160 // CharacteriseDaughters 141 // ******************************************* 161 // ******************************************************************** 142 // 162 // 143 inline 163 inline 144 EVolume G4Navigator::CharacteriseDaughters(con 164 EVolume G4Navigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const 145 { 165 { 146 return pLog->CharacteriseDaughters(); << 166 EVolume type; >> 167 EAxis axis; >> 168 G4int nReplicas; >> 169 G4double width,offset; >> 170 G4bool consuming; >> 171 G4VPhysicalVolume *pVol; >> 172 >> 173 if ( pLog->GetNoDaughters()==1 ) >> 174 { >> 175 pVol = pLog->GetDaughter(0); >> 176 if (pVol->IsReplicated()) >> 177 { >> 178 pVol->GetReplicationData(axis,nReplicas,width,offset,consuming); >> 179 type = (consuming) ? kReplica : kParameterised; >> 180 } >> 181 else >> 182 { >> 183 type = kNormal; >> 184 } >> 185 } >> 186 else >> 187 { >> 188 type = kNormal; >> 189 } >> 190 return type; 147 } 191 } 148 192 >> 193 149 // ******************************************* 194 // ******************************************************************** 150 // GetDaughtersRegularStructureId 195 // GetDaughtersRegularStructureId 151 // ******************************************* 196 // ******************************************************************** 152 // 197 // 153 inline 198 inline 154 G4int G4Navigator:: 199 G4int G4Navigator:: 155 GetDaughtersRegularStructureId(const G4Logical 200 GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const 156 { 201 { 157 G4int regId = 0; 202 G4int regId = 0; 158 G4VPhysicalVolume *pVol; 203 G4VPhysicalVolume *pVol; 159 204 160 if ( pLog->GetNoDaughters() == 1 ) << 205 if ( pLog->GetNoDaughters()==1 ) 161 { 206 { 162 pVol = pLog->GetDaughter(0); 207 pVol = pLog->GetDaughter(0); 163 regId = pVol->GetRegularStructureId(); 208 regId = pVol->GetRegularStructureId(); 164 } 209 } 165 return regId; 210 return regId; 166 } 211 } 167 212 168 // ******************************************* 213 // ******************************************************************** 169 // GetGlobalToLocalTransform 214 // GetGlobalToLocalTransform 170 // 215 // 171 // Returns local to global transformation. 216 // Returns local to global transformation. 172 // I.e. transformation that will take point or 217 // I.e. transformation that will take point or axis in world coord system 173 // and return one in the local coord system 218 // and return one in the local coord system 174 // ******************************************* 219 // ******************************************************************** 175 // 220 // 176 inline 221 inline 177 const G4AffineTransform& G4Navigator::GetGloba 222 const G4AffineTransform& G4Navigator::GetGlobalToLocalTransform() const 178 { 223 { 179 return fHistory.GetTopTransform(); 224 return fHistory.GetTopTransform(); 180 } 225 } 181 226 182 // ******************************************* 227 // ******************************************************************** 183 // GetLocalToGlobalTransform 228 // GetLocalToGlobalTransform 184 // 229 // 185 // Returns global to local transformation 230 // Returns global to local transformation 186 // ******************************************* 231 // ******************************************************************** 187 // 232 // 188 inline 233 inline 189 const G4AffineTransform G4Navigator::GetLocalT 234 const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const 190 { 235 { 191 return fHistory.GetTopTransform().Inverse(); << 236 G4AffineTransform tempTransform; >> 237 tempTransform = fHistory.GetTopTransform().Inverse(); >> 238 return tempTransform; 192 } 239 } 193 240 194 // ******************************************* 241 // ******************************************************************** 195 // NetTranslation 242 // NetTranslation 196 // 243 // 197 // Computes+returns the local->global translat 244 // Computes+returns the local->global translation of current volume 198 // ******************************************* 245 // ******************************************************************** 199 // 246 // 200 inline 247 inline 201 G4ThreeVector G4Navigator::NetTranslation() co 248 G4ThreeVector G4Navigator::NetTranslation() const 202 { 249 { 203 return fHistory.GetTopTransform().InverseNet << 250 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); >> 251 return tf.NetTranslation(); 204 } 252 } 205 253 206 // ******************************************* 254 // ******************************************************************** 207 // NetRotation 255 // NetRotation 208 // 256 // 209 // Computes+returns the local->global rotation 257 // Computes+returns the local->global rotation of current volume 210 // ******************************************* 258 // ******************************************************************** 211 // 259 // 212 inline 260 inline 213 G4RotationMatrix G4Navigator::NetRotation() co 261 G4RotationMatrix G4Navigator::NetRotation() const 214 { 262 { 215 return fHistory.GetTopTransform().InverseNet << 263 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); >> 264 return tf.NetRotation(); >> 265 } >> 266 >> 267 // ******************************************************************** >> 268 // CreateGRSVolume >> 269 // >> 270 // `Touchable' creation method: caller has deletion responsibility >> 271 // ******************************************************************** >> 272 // >> 273 inline >> 274 G4GRSVolume* G4Navigator::CreateGRSVolume() const >> 275 { >> 276 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); >> 277 return new G4GRSVolume(fHistory.GetTopVolume(), >> 278 tf.NetRotation(), >> 279 tf.NetTranslation()); >> 280 } >> 281 >> 282 // ******************************************************************** >> 283 // CreateGRSSolid >> 284 // >> 285 // `Touchable' creation method: caller has deletion responsibility >> 286 // ******************************************************************** >> 287 // >> 288 inline >> 289 G4GRSSolid* G4Navigator::CreateGRSSolid() const >> 290 { >> 291 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); >> 292 return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(), >> 293 tf.NetRotation(), >> 294 tf.NetTranslation()); 216 } 295 } 217 296 218 // ******************************************* 297 // ******************************************************************** 219 // CreateTouchableHistory 298 // CreateTouchableHistory 220 // 299 // 221 // `Touchable' creation method: caller has del 300 // `Touchable' creation method: caller has deletion responsibility 222 // ******************************************* 301 // ******************************************************************** 223 // 302 // 224 inline 303 inline 225 G4TouchableHistory* G4Navigator::CreateTouchab 304 G4TouchableHistory* G4Navigator::CreateTouchableHistory() const 226 { 305 { 227 return new G4TouchableHistory(fHistory); 306 return new G4TouchableHistory(fHistory); 228 } 307 } 229 308 230 // ******************************************* 309 // ******************************************************************** 231 // CreateTouchableHistory(history) 310 // CreateTouchableHistory(history) 232 // 311 // 233 // `Touchable' creation method: caller has del 312 // `Touchable' creation method: caller has deletion responsibility 234 // ******************************************* 313 // ******************************************************************** 235 // 314 // 236 inline 315 inline 237 G4TouchableHistory* 316 G4TouchableHistory* 238 G4Navigator::CreateTouchableHistory(const G4Na 317 G4Navigator::CreateTouchableHistory(const G4NavigationHistory* history) const 239 { 318 { 240 return new G4TouchableHistory(*history); 319 return new G4TouchableHistory(*history); 241 } 320 } 242 321 243 // ******************************************* 322 // ******************************************************************** 244 // LocateGlobalPointAndUpdateTouchableHandle 323 // LocateGlobalPointAndUpdateTouchableHandle 245 // ******************************************* 324 // ******************************************************************** 246 // 325 // 247 inline 326 inline 248 void G4Navigator::LocateGlobalPointAndUpdateTo 327 void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle( 249 const G4ThreeVe 328 const G4ThreeVector& position, 250 const G4ThreeVe 329 const G4ThreeVector& direction, 251 G4Touchab 330 G4TouchableHandle& oldTouchableToUpdate, 252 const G4bool 331 const G4bool RelativeSearch ) 253 { 332 { 254 G4VPhysicalVolume* pPhysVol; 333 G4VPhysicalVolume* pPhysVol; 255 pPhysVol = LocateGlobalPointAndSetup( positi 334 pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch ); 256 if( fEnteredDaughter || fExitedMother ) 335 if( fEnteredDaughter || fExitedMother ) 257 { 336 { 258 oldTouchableToUpdate = CreateTouchableHis 337 oldTouchableToUpdate = CreateTouchableHistory(); 259 if( pPhysVol == nullptr ) << 338 if( pPhysVol == 0 ) 260 { 339 { 261 // We want to ensure that the touchable 340 // We want to ensure that the touchable is correct in this case. 262 // The method below should do this and << 341 // The method below should do this and recalculate a lot more .... 263 // 342 // 264 oldTouchableToUpdate->UpdateYourself( p 343 oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 265 } 344 } 266 } 345 } 267 return; 346 return; 268 } 347 } 269 348 270 // ******************************************* 349 // ******************************************************************** 271 // LocateGlobalPointAndUpdateTouchable 350 // LocateGlobalPointAndUpdateTouchable 272 // 351 // 273 // Use direction 352 // Use direction 274 // ******************************************* 353 // ******************************************************************** 275 // 354 // 276 inline 355 inline 277 void G4Navigator::LocateGlobalPointAndUpdateTo 356 void G4Navigator::LocateGlobalPointAndUpdateTouchable( 278 const G4ThreeVector 357 const G4ThreeVector& position, 279 const G4ThreeVector 358 const G4ThreeVector& direction, 280 G4VTouchable* 359 G4VTouchable* touchableToUpdate, 281 const G4bool 360 const G4bool RelativeSearch ) 282 { 361 { 283 G4VPhysicalVolume* pPhysVol; 362 G4VPhysicalVolume* pPhysVol; 284 pPhysVol = LocateGlobalPointAndSetup( positi 363 pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch); 285 touchableToUpdate->UpdateYourself( pPhysVol, 364 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 286 } 365 } 287 366 288 // ******************************************* 367 // ******************************************************************** 289 // LocateGlobalPointAndUpdateTouchable 368 // LocateGlobalPointAndUpdateTouchable 290 // ******************************************* 369 // ******************************************************************** 291 // 370 // 292 inline 371 inline 293 void G4Navigator::LocateGlobalPointAndUpdateTo 372 void G4Navigator::LocateGlobalPointAndUpdateTouchable( 294 const G4ThreeVector 373 const G4ThreeVector& position, 295 G4VTouchable* 374 G4VTouchable* touchableToUpdate, 296 const G4bool 375 const G4bool RelativeSearch ) 297 { 376 { 298 G4VPhysicalVolume* pPhysVol; 377 G4VPhysicalVolume* pPhysVol; 299 pPhysVol = LocateGlobalPointAndSetup( positi << 378 pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch); 300 touchableToUpdate->UpdateYourself( pPhysVol, 379 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 301 } 380 } 302 381 303 // ******************************************* 382 // ******************************************************************** 304 // GetVerboseLevel 383 // GetVerboseLevel 305 // ******************************************* 384 // ******************************************************************** 306 // 385 // 307 inline 386 inline 308 G4int G4Navigator::GetVerboseLevel() const 387 G4int G4Navigator::GetVerboseLevel() const 309 { 388 { 310 return fVerbose; 389 return fVerbose; 311 } 390 } 312 391 313 // ******************************************* 392 // ******************************************************************** 314 // SetVerboseLevel 393 // SetVerboseLevel 315 // ******************************************* 394 // ******************************************************************** 316 // 395 // 317 inline 396 inline 318 void G4Navigator::SetVerboseLevel(G4int level) 397 void G4Navigator::SetVerboseLevel(G4int level) 319 { 398 { 320 fVerbose = level; 399 fVerbose = level; 321 fnormalNav.SetVerboseLevel(level); 400 fnormalNav.SetVerboseLevel(level); 322 GetVoxelNavigator().SetVerboseLevel(level); << 401 fvoxelNav.SetVerboseLevel(level); 323 fparamNav.SetVerboseLevel(level); 402 fparamNav.SetVerboseLevel(level); 324 freplicaNav.SetVerboseLevel(level); 403 freplicaNav.SetVerboseLevel(level); 325 fregularNav.SetVerboseLevel(level); 404 fregularNav.SetVerboseLevel(level); 326 if (fpExternalNav != nullptr) { fpExternalNa << 327 } 405 } 328 406 329 // ******************************************* 407 // ******************************************************************** 330 // IsActive 408 // IsActive 331 // ******************************************* 409 // ******************************************************************** 332 // 410 // 333 inline 411 inline 334 G4bool G4Navigator::IsActive() const 412 G4bool G4Navigator::IsActive() const 335 { 413 { 336 return fActive; 414 return fActive; 337 } 415 } 338 416 339 // ******************************************* 417 // ******************************************************************** 340 // Activate 418 // Activate 341 // ******************************************* 419 // ******************************************************************** 342 // 420 // 343 inline 421 inline 344 void G4Navigator::Activate(G4bool flag) 422 void G4Navigator::Activate(G4bool flag) 345 { 423 { 346 fActive = flag; 424 fActive = flag; 347 } 425 } 348 426 349 // ******************************************* 427 // ******************************************************************** 350 // EnteredDaughterVolume 428 // EnteredDaughterVolume 351 // 429 // 352 // To inform the caller if the track is enteri 430 // To inform the caller if the track is entering a daughter volume 353 // ******************************************* 431 // ******************************************************************** 354 // 432 // 355 inline 433 inline 356 G4bool G4Navigator::EnteredDaughterVolume() co 434 G4bool G4Navigator::EnteredDaughterVolume() const 357 { 435 { 358 return fEnteredDaughter; 436 return fEnteredDaughter; 359 } 437 } 360 438 361 // ******************************************* 439 // ******************************************************************** 362 // ExitedMotherVolume 440 // ExitedMotherVolume 363 // ******************************************* 441 // ******************************************************************** 364 // 442 // 365 inline 443 inline 366 G4bool G4Navigator::ExitedMotherVolume() const 444 G4bool G4Navigator::ExitedMotherVolume() const 367 { 445 { 368 return fExitedMother; 446 return fExitedMother; 369 } 447 } 370 448 371 // ******************************************* 449 // ******************************************************************** 372 // CheckMode 450 // CheckMode 373 // ******************************************* 451 // ******************************************************************** 374 // 452 // 375 inline 453 inline 376 void G4Navigator::CheckMode(G4bool mode) 454 void G4Navigator::CheckMode(G4bool mode) 377 { 455 { 378 fCheck = mode; 456 fCheck = mode; 379 fnormalNav.CheckMode(mode); 457 fnormalNav.CheckMode(mode); 380 GetVoxelNavigator().CheckMode(mode); << 458 fvoxelNav.CheckMode(mode); 381 fparamNav.CheckMode(mode); 459 fparamNav.CheckMode(mode); 382 freplicaNav.CheckMode(mode); 460 freplicaNav.CheckMode(mode); 383 fregularNav.CheckMode(mode); 461 fregularNav.CheckMode(mode); 384 if (fpExternalNav != nullptr) { fpExternalNa << 385 } 462 } 386 463 387 // ******************************************* 464 // ******************************************************************** 388 // IsCheckModeActive 465 // IsCheckModeActive 389 // ******************************************* 466 // ******************************************************************** 390 // 467 // 391 inline 468 inline 392 G4bool G4Navigator::IsCheckModeActive() const 469 G4bool G4Navigator::IsCheckModeActive() const 393 { 470 { 394 return fCheck; 471 return fCheck; 395 } 472 } 396 473 397 // ******************************************* 474 // ******************************************************************** 398 // SetPushVerbosity 475 // SetPushVerbosity 399 // ******************************************* 476 // ******************************************************************** 400 // 477 // 401 inline 478 inline 402 void G4Navigator::SetPushVerbosity(G4bool mode 479 void G4Navigator::SetPushVerbosity(G4bool mode) 403 { 480 { 404 fWarnPush = mode; 481 fWarnPush = mode; 405 } 482 } 406 483 407 // ******************************************* 484 // ******************************************************************** 408 // SeverityOfZeroStepping 485 // SeverityOfZeroStepping 409 // 486 // 410 // Reports on severity of error in case Naviga 487 // Reports on severity of error in case Navigator is stuck 411 // and is returning zero steps 488 // and is returning zero steps 412 // ******************************************* 489 // ******************************************************************** 413 // 490 // 414 inline 491 inline 415 G4int G4Navigator::SeverityOfZeroStepping( G4i 492 G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const 416 { 493 { 417 G4int severity = 0, noZeros = fNumberZeroSte << 494 G4int severity=0, noZeros= fNumberZeroSteps; 418 if( noZeroSteps != nullptr ) << 495 if( noZeroSteps) *noZeroSteps = fNumberZeroSteps; 419 { << 496 420 *noZeroSteps = fNumberZeroSteps; << 421 } << 422 if( noZeros >= fAbandonThreshold_NoZeroSteps 497 if( noZeros >= fAbandonThreshold_NoZeroSteps ) 423 { 498 { 424 severity = 10; 499 severity = 10; 425 } 500 } 426 if( noZeros > 0 && noZeros < fActionThreshol 501 if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps ) 427 { 502 { 428 severity = 5 * noZeros / fActionThreshold 503 severity = 5 * noZeros / fActionThreshold_NoZeroSteps; 429 } 504 } 430 else if( noZeros == fActionThreshold_NoZeroS 505 else if( noZeros == fActionThreshold_NoZeroSteps ) 431 { 506 { 432 severity = 5; 507 severity = 5; 433 } 508 } 434 else if( noZeros >= fAbandonThreshold_NoZero 509 else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 ) 435 { 510 { 436 severity = 9; 511 severity = 9; 437 } 512 } 438 else if( noZeros < fAbandonThreshold_NoZeroS 513 else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 ) 439 { 514 { 440 severity = 5 + 4 * (noZeros-fAbandonThres 515 severity = 5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps) 441 / fActionThreshold_NoZer 516 / fActionThreshold_NoZeroSteps; 442 } 517 } 443 return severity; 518 return severity; 444 } 519 } 445 520 446 // ******************************************* 521 // ******************************************************************** 447 // GetVoxelNavigator << 448 // ******************************************* << 449 // << 450 inline << 451 G4VoxelNavigation& G4Navigator::GetVoxelNaviga << 452 { << 453 return *fpvoxelNav; << 454 } << 455 << 456 // ******************************************* << 457 // EnableBestSafety 522 // EnableBestSafety 458 // ******************************************* 523 // ******************************************************************** 459 // 524 // 460 inline void G4Navigator::EnableBestSafety( G4b 525 inline void G4Navigator::EnableBestSafety( G4bool value ) 461 { 526 { 462 GetVoxelNavigator().EnableBestSafety( value << 527 fvoxelNav.EnableBestSafety( value ); 463 } << 464 << 465 // ******************************************* << 466 // SetExternalNavigation << 467 // ******************************************* << 468 // << 469 inline << 470 G4VExternalNavigation* G4Navigator::GetExterna << 471 { << 472 return fpExternalNav; << 473 } << 474 << 475 // ******************************************* << 476 // Clone << 477 // ******************************************* << 478 // << 479 inline << 480 G4Navigator* G4Navigator::Clone() const << 481 { << 482 auto clone_nav = new G4Navigator(); << 483 clone_nav->SetWorldVolume(fTopPhysical); << 484 if( fpExternalNav != nullptr ) << 485 { << 486 clone_nav->SetExternalNavigation(fpExterna << 487 } << 488 return clone_nav; << 489 } 528 } 490 529