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