|
||||
File indexing completed on 2025-01-18 09:58:32
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 // 0028 // class G4ITNavigator1 Inline implementation 0029 // 0030 // G4ITNavigator1 is a duplicate version of G4Navigator started from Geant4.9.5 0031 // initially written by Paul Kent and colleagues. 0032 // The only difference resides in the way the information is saved and managed 0033 // 0034 // ******************************************************************** 0035 0036 // ******************************************************************** 0037 // GetCurrentLocalCoordinate 0038 // 0039 // Returns the local coordinate of the current track 0040 // ******************************************************************** 0041 // 0042 inline 0043 G4ThreeVector G4ITNavigator1::GetCurrentLocalCoordinate() const 0044 { 0045 return fLastLocatedPointLocal; 0046 } 0047 0048 // ******************************************************************** 0049 // ComputeLocalAxis 0050 // 0051 // Returns local direction of vector direction in world coord system 0052 // ******************************************************************** 0053 // 0054 inline 0055 G4ThreeVector G4ITNavigator1::ComputeLocalAxis(const G4ThreeVector& pVec) const 0056 { 0057 return (fHistory.GetTopTransform().IsRotated()) 0058 ? fHistory.GetTopTransform().TransformAxis(pVec) : pVec ; 0059 } 0060 0061 // ******************************************************************** 0062 // ComputeLocalPoint 0063 // 0064 // Returns local coordinates of a point in the world coord system 0065 // ******************************************************************** 0066 // 0067 inline 0068 G4ThreeVector 0069 G4ITNavigator1::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const 0070 { 0071 return ( fHistory.GetTopTransform().TransformPoint(pGlobalPoint) ) ; 0072 } 0073 0074 // ******************************************************************** 0075 // GetWorldVolume 0076 // 0077 // Returns the current world (`topmost') volume 0078 // ******************************************************************** 0079 // 0080 inline 0081 G4VPhysicalVolume* G4ITNavigator1::GetWorldVolume() const 0082 { 0083 return fTopPhysical; 0084 } 0085 0086 // ******************************************************************** 0087 // SetWorldVolume 0088 // 0089 // Sets the world (`topmost') volume 0090 // ******************************************************************** 0091 // 0092 inline 0093 void G4ITNavigator1::SetWorldVolume(G4VPhysicalVolume* pWorld) 0094 { 0095 if ( !(pWorld->GetTranslation()==G4ThreeVector(0,0,0)) ) 0096 { 0097 G4Exception ("G4ITNavigator1::SetWorldVolume()", "GeomNav0002", 0098 FatalException, "Volume must be centered on the origin."); 0099 } 0100 const G4RotationMatrix* rm = pWorld->GetRotation(); 0101 if ( (rm != nullptr) && (!rm->isIdentity()) ) 0102 { 0103 G4Exception ("G4ITNavigator1::SetWorldVolume()", "GeomNav0002", 0104 FatalException, "Volume must not be rotated."); 0105 } 0106 fTopPhysical = pWorld; 0107 fHistory.SetFirstEntry(pWorld); 0108 } 0109 0110 // ******************************************************************** 0111 // SetGeometrycallyLimitedStep 0112 // 0113 // Informs the navigator that the previous Step calculated 0114 // by the geometry was taken in its entirety 0115 // ******************************************************************** 0116 // 0117 inline 0118 void G4ITNavigator1::SetGeometricallyLimitedStep() 0119 { 0120 fWasLimitedByGeometry=true; 0121 } 0122 0123 // ******************************************************************** 0124 // ResetStackAndState 0125 // 0126 // Resets stack and minimum of navigator state `machine' 0127 // ******************************************************************** 0128 // 0129 inline 0130 void G4ITNavigator1::ResetStackAndState() 0131 { 0132 fHistory.Reset(); 0133 ResetState(); 0134 } 0135 0136 // ******************************************************************** 0137 // VolumeType 0138 // ******************************************************************** 0139 // 0140 inline 0141 EVolume G4ITNavigator1::VolumeType(const G4VPhysicalVolume *pVol) const 0142 { 0143 return pVol->VolumeType(); 0144 } 0145 0146 // ******************************************************************** 0147 // CharacteriseDaughters 0148 // ******************************************************************** 0149 // 0150 inline 0151 EVolume G4ITNavigator1::CharacteriseDaughters(const G4LogicalVolume *pLog) const 0152 { 0153 return pLog->CharacteriseDaughters(); 0154 } 0155 0156 // ******************************************************************** 0157 // GetDaughtersRegularStructureId 0158 // ******************************************************************** 0159 // 0160 inline 0161 G4int G4ITNavigator1:: 0162 GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const 0163 { 0164 G4int regId = 0; 0165 G4VPhysicalVolume *pVol; 0166 0167 if ( pLog->GetNoDaughters()==1 ) 0168 { 0169 pVol = pLog->GetDaughter(0); 0170 regId = pVol->GetRegularStructureId(); 0171 } 0172 return regId; 0173 } 0174 0175 // ******************************************************************** 0176 // GetGlobalToLocalTransform 0177 // 0178 // Returns local to global transformation. 0179 // I.e. transformation that will take point or axis in world coord system 0180 // and return one in the local coord system 0181 // ******************************************************************** 0182 // 0183 inline 0184 const G4AffineTransform& G4ITNavigator1::GetGlobalToLocalTransform() const 0185 { 0186 return fHistory.GetTopTransform(); 0187 } 0188 0189 // ******************************************************************** 0190 // GetLocalToGlobalTransform 0191 // 0192 // Returns global to local transformation 0193 // ******************************************************************** 0194 // 0195 inline 0196 const G4AffineTransform G4ITNavigator1::GetLocalToGlobalTransform() const 0197 { 0198 G4AffineTransform tempTransform; 0199 tempTransform = fHistory.GetTopTransform().Inverse(); 0200 return tempTransform; 0201 } 0202 0203 // ******************************************************************** 0204 // NetTranslation 0205 // 0206 // Computes+returns the local->global translation of current volume 0207 // ******************************************************************** 0208 // 0209 inline 0210 G4ThreeVector G4ITNavigator1::NetTranslation() const 0211 { 0212 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); 0213 return tf.NetTranslation(); 0214 } 0215 0216 // ******************************************************************** 0217 // NetRotation 0218 // 0219 // Computes+returns the local->global rotation of current volume 0220 // ******************************************************************** 0221 // 0222 inline 0223 G4RotationMatrix G4ITNavigator1::NetRotation() const 0224 { 0225 G4AffineTransform tf(fHistory.GetTopTransform().Inverse()); 0226 return tf.NetRotation(); 0227 } 0228 0229 // ******************************************************************** 0230 // CreateTouchableHistory 0231 // 0232 // `Touchable' creation method: caller has deletion responsibility 0233 // ******************************************************************** 0234 // 0235 inline 0236 G4TouchableHistory* G4ITNavigator1::CreateTouchableHistory() const 0237 { 0238 return new G4TouchableHistory(fHistory); 0239 } 0240 0241 // ******************************************************************** 0242 // CreateTouchableHistory(history) 0243 // 0244 // `Touchable' creation method: caller has deletion responsibility 0245 // ******************************************************************** 0246 // 0247 inline 0248 G4TouchableHistory* 0249 G4ITNavigator1::CreateTouchableHistory(const G4NavigationHistory* history) const 0250 { 0251 return new G4TouchableHistory(*history); 0252 } 0253 0254 // ******************************************************************** 0255 // LocateGlobalPointAndUpdateTouchableHandle 0256 // ******************************************************************** 0257 // 0258 inline 0259 void G4ITNavigator1::LocateGlobalPointAndUpdateTouchableHandle( 0260 const G4ThreeVector& position, 0261 const G4ThreeVector& direction, 0262 G4TouchableHandle& oldTouchableToUpdate, 0263 const G4bool RelativeSearch ) 0264 { 0265 G4VPhysicalVolume* pPhysVol; 0266 pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch ); 0267 if( fEnteredDaughter || fExitedMother ) 0268 { 0269 oldTouchableToUpdate = CreateTouchableHistory(); 0270 if( pPhysVol == nullptr ) 0271 { 0272 // We want to ensure that the touchable is correct in this case. 0273 // The method below should do this and recalculate a lot more .... 0274 // 0275 oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 0276 } 0277 } 0278 return; 0279 } 0280 0281 // ******************************************************************** 0282 // LocateGlobalPointAndUpdateTouchable 0283 // 0284 // Use direction 0285 // ******************************************************************** 0286 // 0287 inline 0288 void G4ITNavigator1::LocateGlobalPointAndUpdateTouchable( 0289 const G4ThreeVector& position, 0290 const G4ThreeVector& direction, 0291 G4VTouchable* touchableToUpdate, 0292 const G4bool RelativeSearch ) 0293 { 0294 G4VPhysicalVolume* pPhysVol; 0295 pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch); 0296 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 0297 } 0298 0299 // ******************************************************************** 0300 // LocateGlobalPointAndUpdateTouchable 0301 // ******************************************************************** 0302 // 0303 inline 0304 void G4ITNavigator1::LocateGlobalPointAndUpdateTouchable( 0305 const G4ThreeVector& position, 0306 G4VTouchable* touchableToUpdate, 0307 const G4bool RelativeSearch ) 0308 { 0309 G4VPhysicalVolume* pPhysVol; 0310 pPhysVol = LocateGlobalPointAndSetup( position, nullptr, RelativeSearch); 0311 touchableToUpdate->UpdateYourself( pPhysVol, &fHistory ); 0312 } 0313 0314 // ******************************************************************** 0315 // GetVerboseLevel 0316 // ******************************************************************** 0317 // 0318 inline 0319 G4int G4ITNavigator1::GetVerboseLevel() const 0320 { 0321 return fVerbose; 0322 } 0323 0324 // ******************************************************************** 0325 // SetVerboseLevel 0326 // ******************************************************************** 0327 // 0328 inline 0329 void G4ITNavigator1::SetVerboseLevel(G4int level) 0330 { 0331 fVerbose = level; 0332 fnormalNav.SetVerboseLevel(level); 0333 fvoxelNav.SetVerboseLevel(level); 0334 fparamNav.SetVerboseLevel(level); 0335 freplicaNav.SetVerboseLevel(level); 0336 fregularNav.SetVerboseLevel(level); 0337 } 0338 0339 // ******************************************************************** 0340 // IsActive 0341 // ******************************************************************** 0342 // 0343 inline 0344 G4bool G4ITNavigator1::IsActive() const 0345 { 0346 return fActive; 0347 } 0348 0349 // ******************************************************************** 0350 // Activate 0351 // ******************************************************************** 0352 // 0353 inline 0354 void G4ITNavigator1::Activate(G4bool flag) 0355 { 0356 fActive = flag; 0357 } 0358 0359 // ******************************************************************** 0360 // EnteredDaughterVolume 0361 // 0362 // To inform the caller if the track is entering a daughter volume 0363 // ******************************************************************** 0364 // 0365 inline 0366 G4bool G4ITNavigator1::EnteredDaughterVolume() const 0367 { 0368 return fEnteredDaughter; 0369 } 0370 0371 // ******************************************************************** 0372 // ExitedMotherVolume 0373 // ******************************************************************** 0374 // 0375 inline 0376 G4bool G4ITNavigator1::ExitedMotherVolume() const 0377 { 0378 return fExitedMother; 0379 } 0380 0381 // ******************************************************************** 0382 // CheckMode 0383 // ******************************************************************** 0384 // 0385 inline 0386 void G4ITNavigator1::CheckMode(G4bool mode) 0387 { 0388 fCheck = mode; 0389 fnormalNav.CheckMode(mode); 0390 fvoxelNav.CheckMode(mode); 0391 fparamNav.CheckMode(mode); 0392 freplicaNav.CheckMode(mode); 0393 fregularNav.CheckMode(mode); 0394 } 0395 0396 // ******************************************************************** 0397 // IsCheckModeActive 0398 // ******************************************************************** 0399 // 0400 inline 0401 G4bool G4ITNavigator1::IsCheckModeActive() const 0402 { 0403 return fCheck; 0404 } 0405 0406 // ******************************************************************** 0407 // SetPushVerbosity 0408 // ******************************************************************** 0409 // 0410 inline 0411 void G4ITNavigator1::SetPushVerbosity(G4bool mode) 0412 { 0413 fWarnPush = mode; 0414 } 0415 0416 // ******************************************************************** 0417 // SeverityOfZeroStepping 0418 // 0419 // Reports on severity of error in case Navigator is stuck 0420 // and is returning zero steps 0421 // ******************************************************************** 0422 // 0423 inline 0424 G4int G4ITNavigator1::SeverityOfZeroStepping( G4int* noZeroSteps ) const 0425 { 0426 G4int severity=0, noZeros= fNumberZeroSteps; 0427 if( noZeroSteps != nullptr) *noZeroSteps = fNumberZeroSteps; 0428 0429 if( noZeros >= fAbandonThreshold_NoZeroSteps ) 0430 { 0431 severity = 10; 0432 } 0433 if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps ) 0434 { 0435 severity = 5 * noZeros / fActionThreshold_NoZeroSteps; 0436 } 0437 else if( noZeros == fActionThreshold_NoZeroSteps ) 0438 { 0439 severity = 5; 0440 } 0441 else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 ) 0442 { 0443 severity = 9; 0444 } 0445 else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 ) 0446 { 0447 severity = 5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps) 0448 / fActionThreshold_NoZeroSteps; 0449 } 0450 return severity; 0451 } 0452 0453 // ******************************************************************** 0454 // EnableBestSafety 0455 // ******************************************************************** 0456 // 0457 inline void G4ITNavigator1::EnableBestSafety( G4bool value ) 0458 { 0459 fvoxelNav.EnableBestSafety( value ); 0460 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |