Changeset 1347 for trunk/source/geometry/navigation/src
- Timestamp:
- Dec 22, 2010, 3:52:27 PM (15 years ago)
- Location:
- trunk/source/geometry/navigation/src
- Files:
-
- 27 edited
-
G4AuxiliaryNavServices.cc (modified) (1 diff)
-
G4BrentLocator.cc (modified) (7 diffs)
-
G4DrawVoxels.cc (modified) (1 diff)
-
G4ErrorPropagationNavigator.cc (modified) (1 diff)
-
G4GeomTestErrorList.cc (modified) (1 diff)
-
G4GeomTestOverlapList.cc (modified) (1 diff)
-
G4GeomTestOvershootList.cc (modified) (1 diff)
-
G4GeomTestPoint.cc (modified) (1 diff)
-
G4GeomTestSegment.cc (modified) (8 diffs)
-
G4GeomTestStreamLogger.cc (modified) (1 diff)
-
G4GeomTestVolPoint.cc (modified) (1 diff)
-
G4GeomTestVolume.cc (modified) (1 diff)
-
G4GeometryMessenger.cc (modified) (4 diffs)
-
G4MultiLevelLocator.cc (modified) (8 diffs)
-
G4MultiNavigator.cc (modified) (8 diffs)
-
G4Navigator.cc (modified) (19 diffs)
-
G4NormalNavigation.cc (modified) (11 diffs)
-
G4ParameterisedNavigation.cc (modified) (2 diffs)
-
G4PathFinder.cc (modified) (3 diffs)
-
G4PhantomParameterisation.cc (modified) (2 diffs)
-
G4PropagatorInField.cc (modified) (4 diffs)
-
G4RegularNavigation.cc (modified) (6 diffs)
-
G4ReplicaNavigation.cc (modified) (2 diffs)
-
G4SimpleLocator.cc (modified) (8 diffs)
-
G4TransportationManager.cc (modified) (5 diffs)
-
G4VIntersectionLocator.cc (modified) (5 diffs)
-
G4VoxelNavigation.cc (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/navigation/src/G4AuxiliaryNavServices.cc
r1337 r1347 25 25 // 26 26 // $Id: G4AuxiliaryNavServices.cc,v 1.3 2006/06/29 18:36:32 gunter Exp $ 27 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 28 28 // 29 29 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4BrentLocator.cc
r1337 r1347 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4BrentLocator.cc,v 1. 8 2009/05/15 12:55:48 tnikitinExp $27 // GEANT4 tag $Name: geant4-09-04- beta-01$26 // $Id: G4BrentLocator.cc,v 1.9 2010/07/13 15:59:42 gcosmo Exp $ 27 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 28 28 // 29 29 // Class G4BrentLocator implementation … … 142 142 G4bool restoredFullEndpoint = false; 143 143 144 G4int oldprc; // cout, cerr precision 144 145 G4int substep_no = 0; 145 146 … … 505 506 << GetEpsilonStepFor() << G4endl; 506 507 } 507 G4cerr.precision(20);508 oldprc = G4cerr.precision(20); 508 509 G4cerr << " Point A (Curve start) is " << CurveStartPointVelocity 509 510 << G4endl; … … 529 530 << GetEpsilonStepFor() <<" DeltaInters= " 530 531 << GetDeltaIntersectionFor() << G4endl; 532 G4cerr.precision( oldprc ); 531 533 532 534 G4Exception("G4BrentLocator::EstimateIntersectionPoint()", … … 728 730 -1.0, NewSafety, substep_no); 729 731 G4cout << G4endl; 730 G4cout.precision( 10 );732 oldprc = G4cout.precision( 10 ); 731 733 G4double done_len = CurrentA_PointVelocity.GetCurveLength(); 732 734 G4double full_len = CurveEndPointVelocity.GetCurveLength(); … … 736 738 << " out of " << full_len << " required." << G4endl; 737 739 G4cout << " Remaining length = " << full_len - done_len << G4endl; 740 G4cout.precision( oldprc ); 738 741 739 742 G4Exception("G4BrentLocator::EstimateIntersectionPoint()", … … 743 746 else if( substep_no >= warn_substeps ) 744 747 { 745 G4intoldprc= G4cout.precision( 10 );748 oldprc= G4cout.precision( 10 ); 746 749 G4cout << "WARNING - G4BrentLocator::EstimateIntersectionPoint()" 747 750 << G4endl -
trunk/source/geometry/navigation/src/G4DrawVoxels.cc
r1337 r1347 26 26 // 27 27 // $Id: G4DrawVoxels.cc,v 1.4 2006/06/29 18:36:34 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -
trunk/source/geometry/navigation/src/G4ErrorPropagationNavigator.cc
r1337 r1347 26 26 // 27 27 // $Id: G4ErrorPropagationNavigator.cc,v 1.2 2008/10/24 14:00:03 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -
trunk/source/geometry/navigation/src/G4GeomTestErrorList.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestErrorList.cc,v 1.3 2006/06/29 18:36:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestOverlapList.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestOverlapList.cc,v 1.3 2006/06/29 18:36:39 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestOvershootList.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestOvershootList.cc,v 1.3 2006/06/29 18:36:41 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestPoint.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestPoint.cc,v 1.3 2006/06/29 18:36:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestSegment.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4GeomTestSegment.cc,v 1.1 1 2007/11/16 09:39:14 gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4GeomTestSegment.cc,v 1.13 2010/08/20 09:03:54 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- … … 275 275 G4bool entering; 276 276 G4double vSurfN; 277 // G4cout<<"Entering Find Some Points vSearch="<<vSearch<<" p="<<p<<G4endl; 278 // 277 279 278 // Look for nearest intersection point in the specified 280 279 // direction and return if there isn't one … … 283 282 switch(solid->Inside(p)) { 284 283 case kInside: 285 dist = solid->DistanceToOut(p,vSearch); 286 // G4cout<<"Inside DistToOut="<<dist<<G4endl; 284 dist = solid->DistanceToOut(p,vSearch); 287 285 if (dist >= kInfinity) { 288 286 logger->SolidProblem( solid, … … 290 288 return; 291 289 } 292 293 290 s += sign*dist; 294 291 entering = false; … … 296 293 case kOutside: 297 294 dist = solid->DistanceToIn(p,vSearch); 298 //G4cout<<"Outside DistToIn="<<dist<<G4endl;299 295 if (dist >= kInfinity) return; 300 301 296 s += sign*dist; 302 297 entering = true; 303 298 break; 304 299 case kSurface: 305 vSurfN=v Search.dot(solid->SurfaceNormal(p));306 if(std:: abs(vSurfN)<kCarTolerance)vSurfN=0;300 vSurfN=v.dot(solid->SurfaceNormal(p)); 301 if(std::fabs(vSurfN)<kCarTolerance)vSurfN=0; 307 302 entering = (vSurfN < 0); 308 //G4cout<<"Surface SurfN="<<solid->SurfaceNormal(p)<<" v.dotN="<<vSurfN<<" entering="<<entering<<G4endl;309 303 break; 310 304 default: … … 361 355 // 362 356 points.push_back( G4GeomTestPoint( p, s, entering==forward ) ); 363 //G4cout<<"Add point p"<<p<<" s="<<s<<" entering="<<entering<<G4endl;357 364 358 } 365 359 … … 369 363 if (entering) { 370 364 dist = solid->DistanceToOut(p,vSearch); 371 //G4cout<<"if entering distToOut="<<dist<<G4endl;372 365 if (dist >= kInfinity) { 373 366 logger->SolidProblem( solid, … … 389 382 return; 390 383 } 391 392 if(std::abs(dist)<=kCarTolerance){ 393 G4double push = 1E-6; 394 s += sign*push; 395 p = p0 + s*v; 396 EInside inside = solid->Inside(p); 397 if (inside == kOutside) { 398 entering = false; 399 break; 400 } 401 } 402 403 384 404 385 entering = false; 405 386 } 406 387 else { 407 388 dist = solid->DistanceToIn(p,vSearch); 408 //G4cout<<"if exiting distToIn="<<dist<<G4endl;409 389 if (dist >= kInfinity) return; 410 390 -
trunk/source/geometry/navigation/src/G4GeomTestStreamLogger.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestStreamLogger.cc,v 1.3 2006/06/29 18:36:49 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestVolPoint.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestVolPoint.cc,v 1.3 2006/06/29 18:36:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeomTestVolume.cc
r1337 r1347 26 26 // 27 27 // $Id: G4GeomTestVolume.cc,v 1.6 2007/11/16 09:39:14 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04- beta-01$28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/navigation/src/G4GeometryMessenger.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4GeometryMessenger.cc,v 1. 5 2006/06/29 18:36:57 gunterExp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4GeometryMessenger.cc,v 1.6 2010/11/10 14:06:40 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // -------------------------------------------------------------------- … … 106 106 chkCmd->AvailableForStates(G4State_Idle); 107 107 108 pchkCmd = new G4UIcmdWithABool( "/geometry/navigator/push_notify", this ); 109 pchkCmd->SetGuidance( "Set navigator verbosity push notifications." ); 110 pchkCmd->SetGuidance( "This allows to disable/re-enable verbosity in" ); 111 pchkCmd->SetGuidance( "navigation, when tracks may get stuck and require" ); 112 pchkCmd->SetGuidance( "one artificial push along the direction by the" ); 113 pchkCmd->SetGuidance( "navigator. Notification is active by default." ); 114 pchkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" ); 115 pchkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" ); 116 pchkCmd->SetParameterName("pushFlag",true); 117 pchkCmd->SetDefaultValue(true); 118 pchkCmd->AvailableForStates(G4State_Idle); 119 108 120 // 109 121 // Geometry verification test commands … … 244 256 delete cyzCmd; delete cfzCmd; delete cfrCmd; delete cylCmd; 245 257 delete tolCmd; 246 delete resCmd; delete verbCmd; delete chkCmd;258 delete resCmd; delete verbCmd; delete pchkCmd; delete chkCmd; 247 259 delete geodir; delete navdir; delete testdir; 248 260 delete tvolume; delete tlogger; … … 423 435 G4Navigator* navigator = tmanager->GetNavigatorForTracking(); 424 436 navigator->CheckMode(mode); 437 } 438 439 // 440 // Set navigator verbosity for push notifications 441 // 442 void 443 G4GeometryMessenger::SetPushFlag(G4String input) 444 { 445 G4bool mode = pchkCmd->GetNewBoolValue(input); 446 G4Navigator* navigator = tmanager->GetNavigatorForTracking(); 447 navigator->SetPushVerbosity(mode); 425 448 } 426 449 -
trunk/source/geometry/navigation/src/G4MultiLevelLocator.cc
r1337 r1347 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MultiLevelLocator.cc,v 1. 5 2008/12/11 10:01:02 tnikitinExp $27 // GEANT4 tag $Name: geant4-09-04- beta-01$26 // $Id: G4MultiLevelLocator.cc,v 1.6 2010/07/13 15:59:42 gcosmo Exp $ 27 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 28 28 // 29 29 // Class G4MultiLevelLocator implementation … … 120 120 121 121 G4int substep_no = 0; 122 122 123 G4int oldprc; // cout/cerr precision settings 124 123 125 // Limits for substep number 124 126 // … … 156 158 157 159 #ifdef G4DEBUG_FIELD 158 static G4double tolerance= 1.0e-8;160 static const G4double tolerance = 1.0e-8 * mm; 159 161 G4ThreeVector StartPosition= CurveStartPointVelocity.GetPosition(); 160 if( (TrialPoint - StartPosition).mag() < tolerance * mm)162 if( (TrialPoint - StartPosition).mag() < tolerance) 161 163 { 162 164 G4cerr << "WARNING - G4MultiLevelLocator::EstimateIntersectionPoint()" … … 455 457 << GetEpsilonStepFor() << G4endl; 456 458 } 457 G4cerr.precision(20);459 oldprc = G4cerr.precision(20); 458 460 G4cerr << " Point A (Curve start) is " << CurveStartPointVelocity 459 461 << G4endl; … … 474 476 G4cerr << " Substep depth no= "<< substep_no_p << " Depth= " 475 477 << depth << G4endl; 478 G4cerr.precision(oldprc); 476 479 477 480 G4Exception("G4MultiLevelLocator::EstimateIntersectionPoint()", … … 691 694 #endif 692 695 693 G4cout.precision( 10 );696 oldprc = G4cout.precision( 10 ); 694 697 G4double done_len = CurrentA_PointVelocity.GetCurveLength(); 695 698 G4double full_len = CurveEndPointVelocity.GetCurveLength(); … … 699 702 << " out of " << full_len << " required." << G4endl; 700 703 G4cout << " Remaining length = " << full_len - done_len << G4endl; 704 G4cout.precision( oldprc ); 701 705 702 706 G4Exception("G4MultiLevelLocator::EstimateIntersectionPoint()", … … 706 710 else if( substep_no >= warn_substeps ) 707 711 { 708 G4int oldprc= G4cout.precision( 10 );712 oldprc = G4cout.precision( 10 ); 709 713 G4cout << "WARNING - G4MultiLevelLocator::EstimateIntersectionPoint()" 710 714 << G4endl -
trunk/source/geometry/navigation/src/G4MultiNavigator.cc
r921 r1347 25 25 // 26 26 // 27 // $Id: G4MultiNavigator.cc,v 1. 8 2008/10/24 14:00:03gcosmo Exp $27 // $Id: G4MultiNavigator.cc,v 1.11 2010/09/06 09:49:15 gcosmo Exp $ 28 28 // GEANT4 tag $ Name: $ 29 29 // … … 48 48 // 49 49 G4MultiNavigator::G4MultiNavigator() 50 : G4Navigator() 50 : G4Navigator(), fLastMassWorld(0) 51 51 { 52 52 fNoActiveNavigators= 0; 53 G4ThreeVector Big3Vector( DBL_MAX, DBL_MAX, DBL_MAX);53 G4ThreeVector Big3Vector( kInfinity, kInfinity, kInfinity ); 54 54 fLastLocatedPosition = Big3Vector; 55 55 fSafetyLocation = Big3Vector; … … 58 58 fMinSafety_PreStepPt= -1.0; 59 59 fMinSafety_atSafLocation= -1.0; 60 fMinSafety= - DBL_MAX;61 f MinStep= -DBL_MAX;62 63 for(register int num=0; num< =fMaxNav; ++num )60 fMinSafety= -kInfinity; 61 fTrueMinStep= fMinStep= -kInfinity; 62 63 for(register int num=0; num< fMaxNav; ++num ) 64 64 { 65 65 fpNavigator[num] = 0; 66 66 fLimitTruth[num] = false; 67 67 fLimitedStep[num] = kUndefLimited; 68 fCurrentStepSize[num] = -1.0;68 fCurrentStepSize[num] = fNewSafety[num] = -1.0; 69 69 fLocatedVolume[num] = 0; 70 70 } … … 94 94 { 95 95 G4double safety= 0.0, step=0.0; 96 G4double minSafety= DBL_MAX, minStep= DBL_MAX;96 G4double minSafety= kInfinity, minStep= kInfinity; 97 97 98 98 #ifdef G4DEBUG_NAVIGATION … … 115 115 for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) 116 116 { 117 safety= DBL_MAX;117 safety= kInfinity; 118 118 119 119 step= (*pNavigatorIter)->ComputeStep( initialPosition, … … 189 189 ELimited &limitedStep) 190 190 { 191 G4int navigatorNo=-1; 192 193 if( navigatorId <= fNoActiveNavigators ) 194 { 195 navigatorNo= navigatorId; 196 } 197 else 191 if( navigatorId > fNoActiveNavigators ) 198 192 { 199 193 G4cerr << "ERROR - G4MultiNavigator::ObtainFinalStep()" … … 206 200 207 201 // Prepare the information to return 208 pNewSafety = fNewSafety[ navigatorNo ]; 209 limitedStep = fLimitedStep[ navigatorNo ]; 202 // 203 pNewSafety = fNewSafety[ navigatorId ]; 204 limitedStep = fLimitedStep[ navigatorId ]; 210 205 minStep= fMinStep; 211 206 212 // if( (minStep==kInfinity) || (fVerbose > 1) ){ 213 #ifdef G4DEBUG_NAVIGATION 214 if( fVerbose > 1 ){ 215 G4cout << " G4MultiNavigator::ComputeStep returns " << fCurrentStepSize[ navigatorNo ] 216 << " for Navigator " << navigatorNo << " Limited step = " << limitedStep 207 #ifdef G4DEBUG_NAVIGATION 208 if( fVerbose > 1 ) 209 { 210 G4cout << " G4MultiNavigator::ComputeStep returns " 211 << fCurrentStepSize[ navigatorId ] 212 << " for Navigator " << navigatorId 213 << " Limited step = " << limitedStep 217 214 << " Safety(mm) = " << pNewSafety / mm << G4endl; 218 215 } 219 216 #endif 220 217 221 return fCurrentStepSize[ navigator No];218 return fCurrentStepSize[ navigatorId ]; 222 219 } 223 220 … … 428 425 // Recompute safety for the relevant point 429 426 430 G4double minSafety = DBL_MAX, safety = DBL_MAX;427 G4double minSafety = kInfinity, safety = kInfinity; 431 428 432 429 std::vector<G4Navigator*>::iterator pNavigatorIter; -
trunk/source/geometry/navigation/src/G4Navigator.cc
r1058 r1347 25 25 // 26 26 // 27 // $Id: G4Navigator.cc,v 1. 39 2009/05/08 06:47:32 tnikitinExp $27 // $Id: G4Navigator.cc,v 1.46 2010/11/15 14:03:27 gcosmo Exp $ 28 28 // GEANT4 tag $ Name: $ 29 29 // … … 47 47 G4Navigator::G4Navigator() 48 48 : fWasLimitedByGeometry(false), fVerbose(0), 49 fTopPhysical(0), fCheck(false), fPushed(false) 49 fTopPhysical(0), fCheck(false), fPushed(false), fWarnPush(true) 50 50 { 51 51 fActive= false; … … 128 128 129 129 #ifdef G4VERBOSE 130 G4int oldcoutPrec = G4cout.precision(8);131 130 if( fVerbose > 2 ) 132 131 { 132 G4int oldcoutPrec = G4cout.precision(8); 133 133 G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl; 134 134 G4cout << " Called with arguments: " << G4endl … … 140 140 PrintState(); 141 141 } 142 G4cout.precision(oldcoutPrec); 142 143 } 143 144 #endif … … 195 196 break; 196 197 case kParameterised: 197 if( fBlockedPhysicalVolume->GetRegularStructureId() != 1)198 if( fBlockedPhysicalVolume->GetRegularStructureId() == 0 ) 198 199 { 199 200 G4VSolid *pSolid; … … 360 361 // 361 362 targetPhysical = fHistory.GetTopVolume(); 363 if (!targetPhysical) { break; } 362 364 targetLogical = targetPhysical->GetLogicalVolume(); 363 365 switch( CharacteriseDaughters(targetLogical) ) … … 452 454 if( fVerbose == 4 ) 453 455 { 454 G4 cout.precision(6);456 G4int oldcoutPrec = G4cout.precision(8); 455 457 G4String curPhysVol_Name("None"); 456 if (targetPhysical!=0) 457 { 458 curPhysVol_Name = targetPhysical->GetName(); 459 } 458 if (targetPhysical) { curPhysVol_Name = targetPhysical->GetName(); } 460 459 G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl; 461 460 G4cout << " ----- Upon exiting:" << G4endl; … … 465 464 G4cout << " History = " << G4endl << fHistory << G4endl << G4endl; 466 465 #endif 467 }468 G4cout.precision(oldcoutPrec);466 G4cout.precision(oldcoutPrec); 467 } 469 468 #endif 470 469 … … 627 626 { 628 627 G4ThreeVector localDirection = ComputeLocalAxis(pDirection); 629 G4double Step = DBL_MAX;628 G4double Step = kInfinity; 630 629 G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume(); 631 630 G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume(); … … 635 634 636 635 #ifdef G4VERBOSE 637 G4int oldcoutPrec= G4cout.precision(8);638 G4int oldcerrPrec= G4cerr.precision(10);639 636 if( fVerbose > 0 ) 640 637 { … … 654 651 #endif 655 652 } 656 657 static G4double fAccuracyForWarning = kCarTolerance,658 fAccuracyForException = 1000*kCarTolerance;659 653 #endif 660 654 … … 670 664 { 671 665 #ifdef G4VERBOSE 672 // The following checks only make sense if the move is larger 673 // than the tolerance. 674 // 675 G4ThreeVector OriginalGlobalpoint = 676 fHistory.GetTopTransform().Inverse(). 677 TransformPoint(fLastLocatedPointLocal); 678 679 G4double shiftOriginSafSq = (fPreviousSftOrigin-pGlobalpoint).mag2(); 680 681 // Check that the starting point of this step is 682 // within the isotropic safety sphere of the last point 683 // to a accuracy/precision given by fAccuracyForWarning. 684 // If so give warning. 685 // If it fails by more than fAccuracyForException exit with error. 686 // 687 if( shiftOriginSafSq >= sqr(fPreviousSafety) ) 688 { 689 G4double shiftOrigin = std::sqrt(shiftOriginSafSq); 690 G4double diffShiftSaf = shiftOrigin - fPreviousSafety; 691 692 if( diffShiftSaf > fAccuracyForWarning ) 693 { 694 G4Exception("G4Navigator::ComputeStep()", 695 "UnexpectedPositionShift", JustWarning, 696 "Accuracy ERROR or slightly inaccurate position shift."); 697 G4cerr << " The Step's starting point has moved " 698 << std::sqrt(moveLenSq)/mm << " mm " << G4endl 699 << " since the last call to a Locate method." << G4endl; 700 G4cerr << " This has resulted in moving " 701 << shiftOrigin/mm << " mm " 702 << " from the last point at which the safety " 703 << " was calculated " << G4endl; 704 G4cerr << " which is more than the computed safety= " 705 << fPreviousSafety/mm << " mm at that point." << G4endl; 706 G4cerr << " This difference is " 707 << diffShiftSaf/mm << " mm." << G4endl 708 << " The tolerated accuracy is " 709 << fAccuracyForException/mm << " mm." << G4endl; 710 711 static G4int warnNow = 0; 712 if( ((++warnNow % 100) == 1) ) 713 { 714 G4cerr << " This problem can be due to either " << G4endl; 715 G4cerr << " - a process that has proposed a displacement" 716 << " larger than the current safety , or" << G4endl; 717 G4cerr << " - inaccuracy in the computation of the safety" 718 << G4endl; 719 G4cerr << " We suggest that you " << G4endl 720 << " - find i) what particle is being tracked, and " 721 << " ii) through what part of your geometry " << G4endl 722 << " for example by re-running this event with " 723 << G4endl 724 << " /tracking/verbose 1 " << G4endl 725 << " - check which processes you declare for" 726 << " this particle (and look at non-standard ones)" 727 << G4endl 728 << " - in case, create a detailed logfile" 729 << " of this event using:" << G4endl 730 << " /tracking/verbose 6 " 731 << G4endl; 732 } 733 } 734 #ifdef G4DEBUG_NAVIGATION 735 else 736 { 737 G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl 738 << " The Step's starting point has moved " 739 << std::sqrt(moveLenSq) << "," << G4endl 740 << " which has taken it to the limit of" 741 << " the current safety. " << G4endl; 742 } 743 #endif 744 } 745 G4double safetyPlus = fPreviousSafety + fAccuracyForException; 746 if ( shiftOriginSafSq > sqr(safetyPlus) ) 747 { 748 G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl 749 << " Position has shifted considerably without" 750 << " notifying the navigator !" << G4endl 751 << " Tolerated safety: " << safetyPlus << G4endl 752 << " Computed shift : " << shiftOriginSafSq << G4endl; 753 G4Exception("G4Navigator::ComputeStep()", 754 "SignificantPositionShift", JustWarning, 755 "May lead to a crash or unreliable results."); 756 } 757 #endif // end G4VERBOSE 758 666 ComputeStepLog(pGlobalpoint, moveLenSq); 667 #endif 759 668 // Relocate the point within the same volume 760 669 // … … 784 693 else 785 694 { 786 if( motherPhysical->GetRegularStructureId() != 1)695 if( motherPhysical->GetRegularStructureId() == 0 ) 787 696 { 788 697 Step = fnormalNav.ComputeStep(fLastLocatedPointLocal, … … 811 720 // reset the history topvolume to world. 812 721 // 813 if(fHistory.GetTopVolume()->GetRegularStructureId() != 1)722 if(fHistory.GetTopVolume()->GetRegularStructureId() == 0 ) 814 723 { 815 724 G4Exception("G4Navigator::ComputeStep()", … … 944 853 // Act to recover this stuck track. Pushing it along direction 945 854 // 946 Step += 0.9*kCarTolerance;855 Step += 100*kCarTolerance; 947 856 #ifdef G4VERBOSE 948 if ( !fPushed)857 if ((!fPushed) && (fWarnPush)) 949 858 { 950 859 G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl … … 1048 957 G4cout << " Safety = " << pNewSafety << G4endl; 1049 958 } 1050 G4cout.precision(oldcoutPrec);1051 G4cerr.precision(oldcerrPrec);1052 959 #endif 1053 960 … … 1112 1019 fBlockedReplicaNo = -1; 1113 1020 1114 fLastLocatedPointLocal = G4ThreeVector( DBL_MAX, -DBL_MAX, 0.0 );1021 fLastLocatedPointLocal = G4ThreeVector( kInfinity, -kInfinity, 0.0 ); 1115 1022 fLocatedOutsideWorld = false; 1116 1023 } … … 1132 1039 G4VPVParameterisation *pParam; 1133 1040 1134 mother = fHistory.GetVolume(0);1135 1041 for ( i=1; i<=cdepth; i++ ) 1136 1042 { … … 1408 1314 1409 1315 // ******************************************************************** 1316 // ComputeStepLog 1317 // ******************************************************************** 1318 // 1319 void G4Navigator::ComputeStepLog(const G4ThreeVector& pGlobalpoint, 1320 G4double moveLenSq) const 1321 { 1322 // The following checks only make sense if the move is larger 1323 // than the tolerance. 1324 1325 static const G4double fAccuracyForWarning = kCarTolerance, 1326 fAccuracyForException = 1000*kCarTolerance; 1327 1328 G4ThreeVector OriginalGlobalpoint = fHistory.GetTopTransform().Inverse(). 1329 TransformPoint(fLastLocatedPointLocal); 1330 1331 G4double shiftOriginSafSq = (fPreviousSftOrigin-pGlobalpoint).mag2(); 1332 1333 // Check that the starting point of this step is 1334 // within the isotropic safety sphere of the last point 1335 // to a accuracy/precision given by fAccuracyForWarning. 1336 // If so give warning. 1337 // If it fails by more than fAccuracyForException exit with error. 1338 // 1339 if( shiftOriginSafSq >= sqr(fPreviousSafety) ) 1340 { 1341 G4double shiftOrigin = std::sqrt(shiftOriginSafSq); 1342 G4double diffShiftSaf = shiftOrigin - fPreviousSafety; 1343 1344 if( diffShiftSaf > fAccuracyForWarning ) 1345 { 1346 G4int oldcoutPrec= G4cout.precision(8); 1347 G4int oldcerrPrec= G4cerr.precision(10); 1348 G4Exception("G4Navigator::ComputeStep()", 1349 "UnexpectedPositionShift", JustWarning, 1350 "Accuracy error or slightly inaccurate position shift."); 1351 G4cerr << " The Step's starting point has moved " 1352 << std::sqrt(moveLenSq)/mm << " mm " << G4endl 1353 << " since the last call to a Locate method." << G4endl; 1354 G4cerr << " This has resulted in moving " 1355 << shiftOrigin/mm << " mm " 1356 << " from the last point at which the safety " 1357 << " was calculated " << G4endl; 1358 G4cerr << " which is more than the computed safety= " 1359 << fPreviousSafety/mm << " mm at that point." << G4endl; 1360 G4cerr << " This difference is " 1361 << diffShiftSaf/mm << " mm." << G4endl 1362 << " The tolerated accuracy is " 1363 << fAccuracyForException/mm << " mm." << G4endl; 1364 1365 static G4int warnNow = 0; 1366 if( ((++warnNow % 100) == 1) ) 1367 { 1368 G4cerr << " This problem can be due to either " << G4endl; 1369 G4cerr << " - a process that has proposed a displacement" 1370 << " larger than the current safety , or" << G4endl; 1371 G4cerr << " - inaccuracy in the computation of the safety" 1372 << G4endl; 1373 G4cerr << " We suggest that you " << G4endl 1374 << " - find i) what particle is being tracked, and " 1375 << " ii) through what part of your geometry " << G4endl 1376 << " for example by re-running this event with " 1377 << G4endl 1378 << " /tracking/verbose 1 " << G4endl 1379 << " - check which processes you declare for" 1380 << " this particle (and look at non-standard ones)" 1381 << G4endl 1382 << " - in case, create a detailed logfile" 1383 << " of this event using:" << G4endl 1384 << " /tracking/verbose 6 " 1385 << G4endl; 1386 } 1387 G4cout.precision(oldcoutPrec); 1388 G4cerr.precision(oldcerrPrec); 1389 } 1390 #ifdef G4DEBUG_NAVIGATION 1391 else 1392 { 1393 G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl 1394 << " The Step's starting point has moved " 1395 << std::sqrt(moveLenSq) << "," << G4endl 1396 << " which has taken it to the limit of" 1397 << " the current safety. " << G4endl; 1398 } 1399 #endif 1400 } 1401 G4double safetyPlus = fPreviousSafety + fAccuracyForException; 1402 if ( shiftOriginSafSq > sqr(safetyPlus) ) 1403 { 1404 G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl 1405 << " Position has shifted considerably without" 1406 << " notifying the navigator !" << G4endl 1407 << " Tolerated safety: " << safetyPlus << G4endl 1408 << " Computed shift : " << shiftOriginSafSq << G4endl; 1409 G4Exception("G4Navigator::ComputeStep()", 1410 "SignificantPositionShift", JustWarning, 1411 "May lead to a crash or unreliable results."); 1412 } 1413 } 1414 1415 // ******************************************************************** 1410 1416 // Operator << 1411 1417 // ******************************************************************** -
trunk/source/geometry/navigation/src/G4NormalNavigation.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4NormalNavigation.cc,v 1. 9 2007/05/11 13:43:59gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4NormalNavigation.cc,v 1.11 2010/11/04 08:57:56 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 38 38 #include "G4AffineTransform.hh" 39 39 40 #include <iomanip>41 42 40 // ******************************************************************** 43 41 // Constructor … … 45 43 // 46 44 G4NormalNavigation::G4NormalNavigation() 47 : fCheck(false), fVerbose(0) 48 { 45 : fCheck(false) 46 { 47 fLogger = new G4NavigationLogger("G4NormalNavigation"); 49 48 } 50 49 … … 54 53 // 55 54 G4NormalNavigation::~G4NormalNavigation() 56 {;} 55 { 56 delete fLogger; 57 } 57 58 58 59 // ******************************************************************** … … 90 91 91 92 #ifdef G4VERBOSE 92 static G4int precVerf= 20; // Precision93 93 if ( fCheck ) 94 94 { 95 if( fVerbose == 1 ) 96 { 97 G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl 98 << " Invoked DistanceToOut(p) for mother solid: " 99 << motherSolid->GetName() 100 << ". Solid replied: " << motherSafety << G4endl 101 << " For local point p: " << localPoint << G4endl 102 << " To be considered as 'mother safety'." << G4endl; 103 } 104 if ( motherSafety < 0.0 ) 105 { 106 G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl 107 << " Current solid " << motherSolid->GetName() 108 << " gave negative safety: " << motherSafety << G4endl 109 << " for the current (local) point " << localPoint 110 << G4endl; 111 motherSolid->DumpInfo(); 112 G4Exception("G4NormalNavigation::ComputeStep()", 113 "NegativeSafetyMotherVol", FatalException, 114 "Negative Safety In Voxel Navigation !" ); 115 } 116 if( motherSolid->Inside(localPoint)==kOutside ) 117 { 118 G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl 119 << " Point " << localPoint 120 << " is outside current volume " << motherPhysical->GetName() 121 << G4endl; 122 G4double estDistToSolid= motherSolid->DistanceToIn(localPoint); 123 G4cout << " Estimated isotropic distance to solid (distToIn)= " 124 << estDistToSolid << G4endl; 125 if( estDistToSolid > 100.0 * motherSolid->GetTolerance() ) 126 { 127 motherSolid->DumpInfo(); 128 G4Exception("G4NormalNavigation::ComputeStep()", 129 "FarOutsideCurrentVolume", FatalException, 130 "Point is far outside Current Volume !" ); 131 } 132 else 133 G4Exception("G4NormalNavigation::ComputeStep()", "OutsideCurrentVolume", 134 JustWarning, "Point is a little outside Current Volume."); 135 } 136 137 // Verification / verbosity 138 // 139 if ( fVerbose > 1 ) 140 { 141 G4int oldprec = G4cout.precision(precVerf); 142 G4cout << " G4NormalNavigation::ComputeStep()" 143 << " - Information on mother / key daughters ..." << G4endl; 144 G4cout << " Type " << std::setw(12) << "Solid-Name" << " " 145 << std::setw(3*(6+precVerf)) << " local point" << " " 146 << std::setw(4+precVerf) << "solid-Safety" << " " 147 << std::setw(4+precVerf) << "solid-Step" << " " 148 << std::setw(17) << "distance Method " 149 << std::setw(3*(6+precVerf)) << " local direction" << " " 150 << G4endl; 151 G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " " 152 << std::setw(4+precVerf) << localPoint << " " 153 << std::setw(4+precVerf) << motherSafety << " " 154 << G4endl; 155 G4cout.precision(oldprec); 156 } 157 95 fLogger->PreComputeStepLog(motherPhysical, motherSafety, localPoint); 158 96 } 159 97 #endif … … 193 131 const G4double sampleSafety = 194 132 sampleSolid->DistanceToIn(samplePoint); 133 #ifdef G4VERBOSE 134 if( fCheck ) 135 { 136 fLogger->PrintDaughterLog(sampleSolid, samplePoint, sampleSafety, 0); 137 } 138 #endif 195 139 if ( sampleSafety<ourSafety ) 196 140 { … … 202 146 const G4double sampleStep = 203 147 sampleSolid->DistanceToIn(samplePoint,sampleDirection); 204 #ifdef G4VERBOSE 205 if(( fCheck ) && ( fVerbose == 1 )) 148 149 #ifdef G4VERBOSE 150 if( fCheck ) 206 151 { 207 G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl 208 << " Invoked DistanceToIn(p,v) for daughter solid: " 209 << sampleSolid->GetName() 210 << ". Solid replied: " << sampleStep << G4endl 211 << " For local point p: " << samplePoint << G4endl 212 << " Direction v: " << sampleDirection 213 << ", to be considered as 'daughter step'." << G4endl; 152 fLogger->PrintDaughterLog(sampleSolid, samplePoint, 153 sampleSafety, sampleStep); 214 154 } 215 155 #endif … … 221 161 *pBlockedPhysical = samplePhysical; 222 162 blockedReplicaNo = -1; 223 224 #ifdef G4VERBOSE 225 // Check to see that the resulting point is indeed in/on volume. 226 // This check could eventually be made only for successful candidate. 227 228 if ( ( fCheck ) && ( sampleStep < kInfinity ) ) 163 #ifdef G4VERBOSE 164 if( fCheck ) 229 165 { 230 G4ThreeVector intersectionPoint; 231 intersectionPoint= samplePoint + sampleStep * sampleDirection; 232 EInside insideIntPt= sampleSolid->Inside(intersectionPoint); 233 G4String solidResponse = "-kInside-"; 234 if (insideIntPt == kOutside) 235 solidResponse = "-kOutside-"; 236 else if (insideIntPt == kSurface) 237 solidResponse = "-kSurface-"; 238 if( fVerbose == 1 ) 239 { 240 G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl 241 << " Invoked Inside() for solid: " 242 << sampleSolid->GetName() 243 << ". Solid replied: " << solidResponse << G4endl 244 << " For point p: " << intersectionPoint 245 << ", considered as 'intersection' point." << G4endl; 246 } 247 if ( insideIntPt != kSurface ) 248 { 249 G4int oldcoutPrec = G4cout.precision(16); 250 G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl 251 << " Inaccurate DistanceToIn for solid " 252 << sampleSolid->GetName() << G4endl; 253 G4cout << " Solid gave DistanceToIn = " << sampleStep 254 << " yet returns " << solidResponse 255 << " for this point !" << G4endl; 256 G4cout << " Point = " << intersectionPoint << G4endl; 257 if ( insideIntPt != kInside ) 258 G4cout << " DistanceToIn(p) = " 259 << sampleSolid->DistanceToIn(intersectionPoint) 260 << G4endl; 261 if ( insideIntPt != kOutside ) 262 G4cout << " DistanceToOut(p) = " 263 << sampleSolid->DistanceToOut(intersectionPoint) 264 << G4endl; 265 G4Exception("G4NormalNavigation::ComputeStep()", 266 "InaccurateDistanceToIn", JustWarning, 267 "Navigator gets conflicting response from Solid."); 268 G4cout.precision(oldcoutPrec); 269 } 270 } 271 272 // Verification / verbosity 273 // 274 if ( fVerbose > 1 ) 275 { 276 G4int oldprec = G4cout.precision(precVerf); 277 G4cout << " Daught " 278 << std::setw(12) << sampleSolid->GetName() << " " 279 << std::setw(4+precVerf) << samplePoint << " " 280 << std::setw(4+precVerf) << sampleSafety << " " 281 << std::setw(4+precVerf) << sampleStep << " " 282 << std::setw(16) << "distanceToIn" << " " 283 << std::setw(4+precVerf) << localDirection << " " 284 << G4endl; 285 G4cout.precision(oldprec); 166 fLogger->AlongComputeStepLog(sampleSolid, samplePoint, 167 sampleDirection, localDirection, sampleSafety, sampleStep); 286 168 } 287 169 #endif … … 313 195 if ( fCheck ) 314 196 { 315 if( fVerbose == 1 ) 316 { 317 G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl 318 << " Invoked DistanceToOut(p,v,...) for mother solid: " 319 << motherSolid->GetName() 320 << ". Solid replied: " << motherStep << G4endl 321 << " For local point p: " << localPoint << G4endl 322 << " Direction v: " << localDirection 323 << ", to be considered as 'mother step'." << G4endl; 324 } 325 if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) ) 326 { 327 G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl 328 << " Problem in Navigation" << G4endl 329 << " Point (local coordinates): " 330 << localPoint << G4endl 331 << " Local Direction: " << localDirection << G4endl 332 << " Solid: " << motherSolid->GetName() << G4endl; 333 motherSolid->DumpInfo(); 334 G4Exception("G4NormalNavigation::ComputeStep()", 335 "PointDistOutInvalid", FatalException, 336 "Current point is outside the current solid !"); 337 } 338 } 339 if ( fVerbose > 1 ) 340 { 341 G4int oldprec = G4cout.precision(precVerf); 342 G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " " 343 << std::setw(4+precVerf) << localPoint << " " 344 << std::setw(4+precVerf) << motherSafety << " " 345 << std::setw(4+precVerf) << motherStep << " " 346 << std::setw(16) << "distanceToOut" << " " 347 << std::setw(4+precVerf) << localDirection << " " 348 << G4endl; 349 G4cout.precision(oldprec); 197 fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection, 198 motherStep, motherSafety); 350 199 } 351 200 #endif … … 399 248 400 249 #ifdef G4VERBOSE 401 if(( fCheck ) && ( fVerbose == 1 )) 402 { 403 G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl 404 << " Invoked DistanceToOut(p) for mother solid: " 405 << motherSolid->GetName() 406 << ". Solid replied: " << motherSafety << G4endl 407 << " For local point p: " << localPoint 408 << ", to be considered as 'mother safety'." << G4endl; 250 if( fCheck ) 251 { 252 fLogger->ComputeSafetyLog(motherSolid, localPoint, motherSafety, true); 409 253 } 410 254 #endif … … 430 274 } 431 275 #ifdef G4VERBOSE 432 if(( fCheck ) && ( fVerbose == 1 )) 433 { 434 G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl 435 << " Invoked DistanceToIn(p) for daughter solid: " 436 << sampleSolid->GetName() 437 << ". Solid replied: " << sampleSafety << G4endl 438 << " For local point p: " << samplePoint 439 << ", to be considered as 'daughter safety'." << G4endl; 276 if(fCheck) 277 { 278 fLogger->ComputeSafetyLog(sampleSolid, samplePoint, sampleSafety, false); 440 279 } 441 280 #endif -
trunk/source/geometry/navigation/src/G4ParameterisedNavigation.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4ParameterisedNavigation.cc,v 1.1 2 2007/11/09 16:06:02 gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4ParameterisedNavigation.cc,v 1.13 2010/07/13 15:59:42 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 58 58 // 59 59 G4ParameterisedNavigation::G4ParameterisedNavigation() 60 : fVoxelHeader(0) 60 : fVoxelAxis(kUndefined), fVoxelNoSlices(0), fVoxelSliceWidth(0.), 61 fVoxelNodeNo(0), fVoxelHeader(0) 61 62 { 62 63 } -
trunk/source/geometry/navigation/src/G4PathFinder.cc
r1058 r1347 25 25 // 26 26 // 27 // $Id: G4PathFinder.cc,v 1.6 2 2009/05/13 23:20:54 japostExp $27 // $Id: G4PathFinder.cc,v 1.64 2010/07/13 15:59:42 gcosmo Exp $ 28 28 // GEANT4 tag $ Name: $ 29 29 // … … 69 69 G4PathFinder::G4PathFinder() 70 70 : fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.), 71 fFieldExertedForce(false), 71 72 fRelocatedPoint(true), 72 fLastStepNo(-1), 73 fLastStepNo(-1), fCurrentStepNo(-1), 73 74 fVerboseLevel(0) 74 75 { … … 91 92 fMinSafety_atSafLocation= -1.0; 92 93 fMinStep= -1.0; 94 fTrueMinStep= -1.0; 95 fPreStepCenterRenewed= false; 93 96 fNewTrack= false; 94 97 fNoGeometriesLimiting= 0; 95 98 96 for( register int num=0; num< =fMaxNav; ++num )99 for( register int num=0; num< fMaxNav; ++num ) 97 100 { 98 101 fpNavigator[num] = 0; -
trunk/source/geometry/navigation/src/G4PhantomParameterisation.cc
r1058 r1347 25 25 // 26 26 // 27 // $Id: G4PhantomParameterisation.cc,v 1. 6 2009/05/20 08:27:10gcosmo Exp $27 // $Id: G4PhantomParameterisation.cc,v 1.7 2010/07/13 15:59:42 gcosmo Exp $ 28 28 // GEANT4 tag $ Name:$ 29 29 // … … 45 45 //------------------------------------------------------------------ 46 46 G4PhantomParameterisation::G4PhantomParameterisation() 47 { 48 // Initialise data 49 // 50 fMaterialIndices = 0; 51 fContainerWallX = 0.; 52 fContainerWallY = 0.; 53 fContainerWallZ = 0.; 54 47 : fVoxelHalfX(0.), fVoxelHalfY(0.), fVoxelHalfZ(0.), 48 fNoVoxelX(0), fNoVoxelY(0), fNoVoxelZ(0), fNoVoxelXY(0), fNoVoxel(0), 49 fMaterialIndices(0), fContainerSolid(0), 50 fContainerWallX(0.), fContainerWallY(0.), fContainerWallZ(0.), 51 bSkipEqualMaterials(true) 52 { 55 53 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 56 57 bSkipEqualMaterials = 1;58 54 } 59 55 -
trunk/source/geometry/navigation/src/G4PropagatorInField.cc
r1315 r1347 36 36 // 17.03.97 John Apostolakis, renaming new set functions being added 37 37 // 38 // $Id: G4PropagatorInField.cc,v 1.5 1 2010/03/08 13:57:34gcosmo Exp $38 // $Id: G4PropagatorInField.cc,v 1.52 2010/07/13 15:59:42 gcosmo Exp $ 39 39 // GEANT4 tag $ Name: $ 40 40 // --------------------------------------------------------------------------- … … 470 470 G4VPhysicalVolume* startVolume) 471 471 { 472 const G4int verboseLevel= fVerboseLevel;472 const G4int verboseLevel=fVerboseLevel; 473 473 const G4ThreeVector StartPosition = StartFT.GetPosition(); 474 474 const G4ThreeVector StartUnitVelocity = StartFT.GetMomentumDir(); … … 477 477 478 478 G4double step_len = CurrentFT.GetCurveLength() - StartFT.GetCurveLength(); 479 480 G4int oldprec; // cout/cerr precision settings 479 481 480 if( ((stepNo == 0) && (verboseLevel <3)) 481 || (verboseLevel >= 3) ) 482 { 483 static G4int noPrecision= 4; 484 G4cout.precision(noPrecision); 485 // G4cout.setf(ios_base::fixed,ios_base::floatfield); 482 if( ((stepNo == 0) && (verboseLevel <3)) || (verboseLevel >= 3) ) 483 { 484 oldprec = G4cout.precision(4); 486 485 G4cout << std::setw( 6) << " " 487 486 << std::setw( 25) << " Current Position and Direction" << " " … … 495 494 << std::setw( 7) << " N_y " << " " 496 495 << std::setw( 7) << " N_z " << " " ; 497 // << G4endl; 498 G4cout // << " >>> " 499 << std::setw( 7) << " Delta|N|" << " " 500 // << std::setw( 7) << " Delta(N_z) " << " " 496 G4cout << std::setw( 7) << " Delta|N|" << " " 501 497 << std::setw( 9) << "StepLen" << " " 502 498 << std::setw(12) << "StartSafety" << " " 503 499 << std::setw( 9) << "PhsStep" << " "; 504 if( startVolume ) {505 G4cout << std::setw(18) << "NextVolume" << " ";506 }500 if( startVolume ) 501 { G4cout << std::setw(18) << "NextVolume" << " "; } 502 G4cout.precision(oldprec); 507 503 G4cout << G4endl; 508 504 } 509 if((stepNo == 0) && (verboseLevel <=3)){ 510 // Recurse to print the start values 511 // 512 printStatus( StartFT, StartFT, -1.0, safety, -1, startVolume); 513 } 514 if( verboseLevel <= 3 ) 515 { 516 if( stepNo >= 0) 517 G4cout << std::setw( 4) << stepNo << " "; 518 else 519 G4cout << std::setw( 5) << "Start" ; 520 G4cout.precision(8); 521 G4cout << std::setw(10) << CurrentFT.GetCurveLength() << " "; 522 G4cout.precision(8); 523 G4cout << std::setw(10) << CurrentPosition.x() << " " 524 << std::setw(10) << CurrentPosition.y() << " " 525 << std::setw(10) << CurrentPosition.z() << " "; 526 G4cout.precision(4); 527 G4cout << std::setw( 7) << CurrentUnitVelocity.x() << " " 528 << std::setw( 7) << CurrentUnitVelocity.y() << " " 529 << std::setw( 7) << CurrentUnitVelocity.z() << " "; 530 // G4cout << G4endl; 531 // G4cout << " >>> " ; 532 G4cout.precision(3); 533 G4cout << std::setw( 7) << CurrentFT.GetMomentum().mag()- StartFT.GetMomentum().mag() << " "; 534 // << std::setw( 7) << CurrentUnitVelocity.z() - InitialUnitVelocity.z() << " "; 535 G4cout << std::setw( 9) << step_len << " "; 536 G4cout << std::setw(12) << safety << " "; 537 if( requestStep != -1.0 ) 538 G4cout << std::setw( 9) << requestStep << " "; 539 else 540 G4cout << std::setw( 9) << "Init/NotKnown" << " "; 541 542 if( startVolume != 0) 543 { 544 G4cout << std::setw(12) << startVolume->GetName() << " "; 545 } 546 #if 0 547 else 548 { 549 if( step_len != -1 ) 550 G4cout << std::setw(12) << "OutOfWorld" << " "; 551 else 552 G4cout << std::setw(12) << "NotGiven" << " "; 553 } 554 #endif 555 556 G4cout << G4endl; 557 } 558 else // if( verboseLevel > 3 ) 559 { 560 // Multi-line output 561 562 G4cout << "Step taken was " << step_len 563 << " out of PhysicalStep = " << requestStep << G4endl; 564 G4cout << "Final safety is: " << safety << G4endl; 565 566 G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() 567 << G4endl; 568 G4cout << G4endl; 569 } 505 if((stepNo == 0) && (verboseLevel <=3)) 506 { 507 // Recurse to print the start values 508 // 509 printStatus( StartFT, StartFT, -1.0, safety, -1, startVolume); 510 } 511 if( verboseLevel <= 3 ) 512 { 513 if( stepNo >= 0) 514 { G4cout << std::setw( 4) << stepNo << " "; } 515 else 516 { G4cout << std::setw( 5) << "Start" ; } 517 oldprec = G4cout.precision(8); 518 G4cout << std::setw(10) << CurrentFT.GetCurveLength() << " "; 519 G4cout.precision(8); 520 G4cout << std::setw(10) << CurrentPosition.x() << " " 521 << std::setw(10) << CurrentPosition.y() << " " 522 << std::setw(10) << CurrentPosition.z() << " "; 523 G4cout.precision(4); 524 G4cout << std::setw( 7) << CurrentUnitVelocity.x() << " " 525 << std::setw( 7) << CurrentUnitVelocity.y() << " " 526 << std::setw( 7) << CurrentUnitVelocity.z() << " "; 527 G4cout.precision(3); 528 G4cout << std::setw( 7) 529 << CurrentFT.GetMomentum().mag()-StartFT.GetMomentum().mag() << " "; 530 G4cout << std::setw( 9) << step_len << " "; 531 G4cout << std::setw(12) << safety << " "; 532 if( requestStep != -1.0 ) 533 { G4cout << std::setw( 9) << requestStep << " "; } 534 else 535 { G4cout << std::setw( 9) << "Init/NotKnown" << " "; } 536 if( startVolume != 0) 537 { G4cout << std::setw(12) << startVolume->GetName() << " "; } 538 G4cout.precision(oldprec); 539 G4cout << G4endl; 540 } 541 else // if( verboseLevel > 3 ) 542 { 543 // Multi-line output 544 545 G4cout << "Step taken was " << step_len 546 << " out of PhysicalStep = " << requestStep << G4endl; 547 G4cout << "Final safety is: " << safety << G4endl; 548 G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() 549 << G4endl; 550 G4cout << G4endl; 551 } 570 552 } 571 553 -
trunk/source/geometry/navigation/src/G4RegularNavigation.cc
r1058 r1347 25 25 // 26 26 // 27 // $Id: G4RegularNavigation.cc,v 1. 9 2009/01/27 09:31:29 gcosmo Exp $27 // $Id: G4RegularNavigation.cc,v 1.15 2010/11/19 15:13:39 gcosmo Exp $ 28 28 // GEANT4 tag $ Name:$ 29 29 // … … 45 45 //------------------------------------------------------------------ 46 46 G4RegularNavigation::G4RegularNavigation() 47 : f Verbose(1), fCheck(true)47 : fverbose(false), fcheck(false), fnormalNav(0) 48 48 { 49 49 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); … … 122 122 //------------------------------------------------------------------ 123 123 G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials( 124 G4ThreeVectorlocalPoint,124 G4ThreeVector& localPoint, 125 125 const G4ThreeVector& localDirection, 126 126 const G4double currentProposedStepLength, … … 291 291 const G4ThreeVector& globalPoint, 292 292 const G4ThreeVector* globalDirection, 293 const G4bool pLocatedOnEdge,293 const G4bool, // pLocatedOnEdge, 294 294 G4ThreeVector& localPoint ) 295 295 { 296 G4SmartVoxelHeader *motherVoxelHeader;297 296 G4VPhysicalVolume *motherPhysical, *pPhysical; 298 297 G4PhantomParameterisation *pParam; 299 298 G4LogicalVolume *motherLogical; 300 G4VSolid *pSolid;301 299 G4ThreeVector localDir; 302 300 G4int replicaNo; … … 304 302 motherPhysical = history.GetTopVolume(); 305 303 motherLogical = motherPhysical->GetLogicalVolume(); 306 motherVoxelHeader = motherLogical->GetVoxelHeader();307 304 308 305 pPhysical = motherLogical->GetDaughter(0); 309 306 pParam = (G4PhantomParameterisation*)(pPhysical->GetParameterisation()); 310 307 311 pSolid = pParam->GetContainerSolid();312 313 308 // Save parent history in touchable history 314 309 // ... for use as parent t-h in ComputeMaterial method of param … … 327 322 } 328 323 329 // Check that track is not on the surface and check that track is not 330 // exiting the voxel parent volume 331 // 332 if ( !G4AuxiliaryNavServices::CheckPointOnSurface(pSolid, localPoint, 333 globalDirection, history.GetTopTransform(), pLocatedOnEdge) 334 || G4AuxiliaryNavServices::CheckPointExiting(pSolid, localPoint, 335 globalDirection, history.GetTopTransform() ) ) 336 { 337 } 338 else 339 { 340 // Enter this daughter 341 // 342 replicaNo = pParam->GetReplicaNo( localPoint, localDir ); 343 344 if( replicaNo < 0 || replicaNo >= G4int(pParam->GetNoVoxel()) ) 345 { 346 return false; 347 } 348 349 // Set the correct copy number in physical 350 // 351 pPhysical->SetCopyNo(replicaNo); 352 pParam->ComputeTransformation(replicaNo,pPhysical); 353 354 history.NewLevel(pPhysical, kParameterised, replicaNo ); 355 localPoint = history.GetTopTransform().TransformPoint(globalPoint); 356 357 // Set the correct solid and material in Logical Volume 358 // 359 G4LogicalVolume *pLogical = pPhysical->GetLogicalVolume(); 324 // Enter this daughter 325 // 326 replicaNo = pParam->GetReplicaNo( localPoint, localDir ); 327 328 if( replicaNo < 0 || replicaNo >= G4int(pParam->GetNoVoxel()) ) 329 { 330 return false; 331 } 332 333 // Set the correct copy number in physical 334 // 335 pPhysical->SetCopyNo(replicaNo); 336 pParam->ComputeTransformation(replicaNo,pPhysical); 337 338 history.NewLevel(pPhysical, kParameterised, replicaNo ); 339 localPoint = history.GetTopTransform().TransformPoint(globalPoint); 340 341 // Set the correct solid and material in Logical Volume 342 // 343 G4LogicalVolume *pLogical = pPhysical->GetLogicalVolume(); 360 344 361 pLogical->UpdateMaterial(pParam->ComputeMaterial(replicaNo, 362 pPhysical, &parentTouchable) ); 363 return true; 364 } 365 366 return false; 367 } 345 pLogical->UpdateMaterial(pParam->ComputeMaterial(replicaNo, 346 pPhysical, &parentTouchable) ); 347 return true; 348 } -
trunk/source/geometry/navigation/src/G4ReplicaNavigation.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4ReplicaNavigation.cc,v 1. 19 2008/04/28 15:39:55gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4ReplicaNavigation.cc,v 1.20 2010/07/13 15:59:42 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 1039 1039 G4Exception("G4ReplicaNavigation::BackLocate()", "InvalidSetup", 1040 1040 FatalException, "The World volume must be a Placement!"); 1041 return kInside; 1041 1042 } 1042 1043 -
trunk/source/geometry/navigation/src/G4SimpleLocator.cc
r1337 r1347 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4SimpleLocator.cc,v 1. 5 2008/12/11 10:27:58 tnikitinExp $27 // GEANT4 tag $Name: geant4-09-04- beta-01$26 // $Id: G4SimpleLocator.cc,v 1.6 2010/07/13 15:59:42 gcosmo Exp $ 27 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 28 28 // 29 29 // Class G4SimpleLocator implementation … … 105 105 106 106 G4int substep_no = 0; 107 108 G4int oldprc; // cout/cerr precision settings 107 109 108 110 // Limits for substep number … … 358 360 << GetEpsilonStepFor() << G4endl; 359 361 } 360 G4cerr.precision(20);362 oldprc = G4cerr.precision(20); 361 363 G4cerr << " Point A (Curve start) is " << CurveStartPointVelocity 362 364 << G4endl; … … 373 375 G4cerr << " LocateIntersection parameters are : Substep no= " 374 376 << substep_no << G4endl; 377 G4cerr.precision(oldprc); 375 378 376 379 G4Exception("G4SimpleLocator::EstimateIntersectionPoint()", … … 452 455 -1.0, NewSafety, substep_no); 453 456 G4cout << G4endl; 454 G4cout.precision( 10);457 oldprc = G4cout.precision(10); 455 458 G4double done_len = CurrentA_PointVelocity.GetCurveLength(); 456 459 G4double full_len = CurveEndPointVelocity.GetCurveLength(); … … 460 463 << " out of " << full_len << " required." << G4endl; 461 464 G4cout << " Remaining length = " << full_len - done_len << G4endl; 465 G4cout.precision(oldprc); 462 466 463 467 G4Exception("G4SimpleLocator::EstimateIntersectionPoint()", … … 467 471 else if( substep_no >= warn_substeps ) 468 472 { 469 G4int oldprc= G4cout.precision( 10);473 oldprc= G4cout.precision(10); 470 474 G4cout << "WARNING - G4SimpleLocator::EstimateIntersectionPoint()" 471 475 << G4endl … … 475 479 << " Warning level = " << warn_substeps 476 480 << " and maximum substeps = " << max_substeps << G4endl; 481 G4cout.precision(oldprc); 477 482 G4Exception("G4SimpleLocator::EstimateIntersectionPoint()", 478 483 "DifficultyToLocateIntersection", JustWarning, 479 484 "Many substeps while trying to locate intersection."); 480 G4cout.precision( oldprc );481 485 } 482 486 return !there_is_no_intersection; // Success or failure -
trunk/source/geometry/navigation/src/G4TransportationManager.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4TransportationManager.cc,v 1.1 5 2007/04/12 11:51:48 vnivanchExp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4TransportationManager.cc,v 1.16 2010/07/13 15:59:42 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 56 56 G4TransportationManager::G4TransportationManager() 57 57 { 58 if (!fTransportationManager) 59 { 60 // Create the navigator for tracking and activate it; add to collections 61 // 62 G4Navigator* trackingNavigator = new G4Navigator(); 63 trackingNavigator->Activate(true); 64 fNavigators.push_back(trackingNavigator); 65 fActiveNavigators.push_back(trackingNavigator); 66 fWorlds.push_back(trackingNavigator->GetWorldVolume()); // NULL registered 67 68 fGeomMessenger = new G4GeometryMessenger(this); 69 fFieldManager = new G4FieldManager(); 70 fPropagatorInField = new G4PropagatorInField(trackingNavigator, 71 fFieldManager); 72 fSafetyHelper = new G4SafetyHelper(); 73 } 74 else 58 if (fTransportationManager) 75 59 { 76 60 G4cerr << "Only ONE instance of G4TransportationManager is allowed!" … … 80 64 "Only ONE instance of G4TransportationManager is allowed!"); 81 65 } 66 67 // Create the navigator for tracking and activate it; add to collections 68 // 69 G4Navigator* trackingNavigator = new G4Navigator(); 70 trackingNavigator->Activate(true); 71 fNavigators.push_back(trackingNavigator); 72 fActiveNavigators.push_back(trackingNavigator); 73 fWorlds.push_back(trackingNavigator->GetWorldVolume()); // NULL registered 74 75 fGeomMessenger = new G4GeometryMessenger(this); 76 fFieldManager = new G4FieldManager(); 77 fPropagatorInField= new G4PropagatorInField(trackingNavigator,fFieldManager); 78 fSafetyHelper = new G4SafetyHelper(); 82 79 } 83 80 … … 329 326 std::vector<G4Navigator*>::iterator pNav = 330 327 std::find(fNavigators.begin(), fNavigators.end(), aNavigator); 331 if (pNav == fNavigators.end()) 328 if (pNav != fNavigators.end()) 329 { 330 (*pNav)->Activate(false); 331 } 332 else 332 333 { 333 334 G4String message … … 337 338 "NoEffect", JustWarning, message); 338 339 } 339 else 340 { 341 (*pNav)->Activate(false); 342 } 340 343 341 std::vector<G4Navigator*>::iterator pActiveNav = 344 342 std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator); -
trunk/source/geometry/navigation/src/G4VIntersectionLocator.cc
r1337 r1347 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VIntersectionLocator.cc,v 1. 7 2009/11/27 15:21:59 japostExp $27 // GEANT4 tag $Name: geant4-09-04- beta-01$26 // $Id: G4VIntersectionLocator.cc,v 1.8 2010/07/13 15:59:42 gcosmo Exp $ 27 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 28 28 // 29 29 // Class G4VIntersectionLocator implementation … … 83 83 84 84 G4double step_len = CurrentFT.GetCurveLength() - StartFT.GetCurveLength(); 85 85 G4int oldprc; // cout/cerr precision settings 86 86 87 if( ((stepNo == 0) && (verboseLevel <3)) || (verboseLevel >= 3) ) 87 88 { 88 static G4int noPrecision= 4; 89 G4cout.precision(noPrecision); 90 // G4cout.setf(ios_base::fixed,ios_base::floatfield); 89 oldprc = G4cout.precision(4); 91 90 G4cout << std::setw( 6) << " " 92 91 << std::setw( 25) << " Current Position and Direction" << " " … … 100 99 << std::setw( 7) << " N_y " << " " 101 100 << std::setw( 7) << " N_z " << " " ; 102 // << G4endl; 103 G4cout // << " >>> " 104 << std::setw( 7) << " Delta|N|" << " " 105 // << std::setw( 7) << " Delta(N_z) " << " " 101 G4cout << std::setw( 7) << " Delta|N|" << " " 106 102 << std::setw( 9) << "StepLen" << " " 107 103 << std::setw(12) << "StartSafety" << " " 108 104 << std::setw( 9) << "PhsStep" << " "; 109 110 105 G4cout << G4endl; 106 G4cout.precision(oldprc); 111 107 } 112 108 if((stepNo == 0) && (verboseLevel <=3)) … … 126 122 G4cout << std::setw( 5) << "Start" ; 127 123 } 128 G4cout.precision(8);124 oldprc = G4cout.precision(8); 129 125 G4cout << std::setw(10) << CurrentFT.GetCurveLength() << " "; 130 G4cout.precision(8);131 126 G4cout << std::setw(10) << CurrentPosition.x() << " " 132 127 << std::setw(10) << CurrentPosition.y() << " " … … 136 131 << std::setw( 7) << CurrentUnitVelocity.y() << " " 137 132 << std::setw( 7) << CurrentUnitVelocity.z() << " "; 138 // G4cout << G4endl; 139 // G4cout << " >>> " ; 140 G4cout.precision(3); 141 G4cout << std::setw( 7) 142 << CurrentFT.GetMomentum().mag()- StartFT.GetMomentum().mag() 143 << " "; 144 // << std::setw( 7) 145 // << CurrentUnitVelocity.z() - InitialUnitVelocity.z() << " "; 146 G4cout << std::setw( 9) << step_len << " "; 147 G4cout << std::setw(12) << safety << " "; 148 if( requestStep != -1.0 ) 149 { 150 G4cout << std::setw( 9) << requestStep << " "; 151 } 152 else 153 { 154 G4cout << std::setw( 9) << "Init/NotKnown" << " "; 155 } 156 G4cout << G4endl; 157 } 158 else // if( verboseLevel > 3 ) 159 { 160 // Multi-line output 133 G4cout.precision(3); 134 G4cout << std::setw( 7) 135 << CurrentFT.GetMomentum().mag()- StartFT.GetMomentum().mag() 136 << " "; 137 G4cout << std::setw( 9) << step_len << " "; 138 G4cout << std::setw(12) << safety << " "; 139 if( requestStep != -1.0 ) 140 { 141 G4cout << std::setw( 9) << requestStep << " "; 142 } 143 else 144 { 145 G4cout << std::setw( 9) << "Init/NotKnown" << " "; 146 } 147 G4cout << G4endl; 148 G4cout.precision(oldprc); 149 } 150 else // if( verboseLevel > 3 ) 151 { 152 // Multi-line output 161 153 162 G4cout << "Step taken was " << step_len 163 << " out of PhysicalStep= " << requestStep << G4endl; 164 G4cout << "Final safety is: " << safety << G4endl; 165 166 G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() 167 << G4endl; 168 G4cout << G4endl; 169 } 154 G4cout << "Step taken was " << step_len 155 << " out of PhysicalStep= " << requestStep << G4endl; 156 G4cout << "Final safety is: " << safety << G4endl; 157 G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() 158 << G4endl; 159 G4cout << G4endl; 160 } 170 161 } 171 162 -
trunk/source/geometry/navigation/src/G4VoxelNavigation.cc
r1337 r1347 25 25 // 26 26 // 27 // $Id: G4VoxelNavigation.cc,v 1. 9 2008/11/14 18:26:35 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-04- beta-01$27 // $Id: G4VoxelNavigation.cc,v 1.13 2010/11/04 18:18:00 japost Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 37 37 #include "G4VoxelNavigation.hh" 38 38 #include "G4GeometryTolerance.hh" 39 #include "G4VoxelSafety.hh" 39 40 40 41 // ******************************************************************** … … 43 44 // 44 45 G4VoxelNavigation::G4VoxelNavigation() 45 : f VoxelDepth(-1),46 : fBList(), fVoxelDepth(-1), 46 47 fVoxelAxisStack(kNavigatorVoxelStackMax,kXAxis), 47 48 fVoxelNoSlicesStack(kNavigatorVoxelStackMax,0), … … 49 50 fVoxelNodeNoStack(kNavigatorVoxelStackMax,0), 50 51 fVoxelHeaderStack(kNavigatorVoxelStackMax,(G4SmartVoxelHeader*)0), 51 fVoxelNode(0), 52 fCheck(false), 53 fVerbose(0) 52 fVoxelNode(0), fpVoxelSafety(0), fCheck(false), fBestSafety(false) 54 53 { 55 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 54 fLogger = new G4NavigationLogger("G4VoxelNavigation"); 55 fpVoxelSafety = new G4VoxelSafety (); 56 56 } 57 57 … … 62 62 G4VoxelNavigation::~G4VoxelNavigation() 63 63 { 64 #ifdef G4DEBUG_NAVIGATION 65 G4cout << "G4VoxelNavigation::~G4VoxelNavigation() called." << G4endl; 66 #endif 64 delete fpVoxelSafety; 65 delete fLogger; 67 66 } 68 67 … … 110 109 if ( fCheck ) 111 110 { 112 if(fVerbose == 1 ) 113 { 114 G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl 115 << " Invoked DistanceToOut(p) for mother solid: " 116 << motherSolid->GetName() 117 << ". Solid replied: " << motherSafety << G4endl 118 << " For local point p: " << localPoint 119 << ", to be considered as 'mother safety'." << G4endl; 120 } 121 if( motherSafety < 0.0 ) 122 { 123 G4cout << "ERROR - G4VoxelNavigation::ComputeStep()" << G4endl 124 << " Current solid " << motherSolid->GetName() 125 << " gave negative safety: " << motherSafety << G4endl 126 << " for the current (local) point " << localPoint 127 << G4endl; 128 motherSolid->DumpInfo(); 129 G4Exception("G4VoxelNavigation::ComputeStep()", 130 "NegativeSafetyMotherVol", FatalException, 131 "Negative Safety In Voxel Navigation !" ); 132 } 133 if( motherSolid->Inside(localPoint)==kOutside ) 134 { 135 G4cout << "WARNING - G4VoxelNavigation::ComputeStep()" << G4endl 136 << " Point " << localPoint 137 << " is outside current volume " << motherPhysical->GetName() 138 << G4endl; 139 G4double estDistToSolid= motherSolid->DistanceToIn(localPoint); 140 G4cout << " Estimated isotropic distance to solid (distToIn)= " 141 << estDistToSolid << G4endl; 142 if( estDistToSolid > 100.0 * kCarTolerance ) 143 { 144 motherSolid->DumpInfo(); 145 G4Exception("G4VoxelNavigation::ComputeStep()", 146 "FarOutsideCurrentVolume", FatalException, 147 "Point is far outside Current Volume !"); 148 } 149 else 150 G4Exception("G4VoxelNavigation::ComputeStep()", "OutsideCurrentVolume", 151 JustWarning, "Point is a little outside Current Volume."); 152 } 111 fLogger->PreComputeStepLog (motherPhysical, motherSafety, localPoint); 153 112 } 154 113 #endif … … 204 163 sampleSolid->DistanceToIn(samplePoint); 205 164 #ifdef G4VERBOSE 206 if( ( fCheck ) && ( fVerbose == 1 ))165 if( fCheck ) 207 166 { 208 G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl 209 << " Invoked DistanceToIn(p) for daughter solid: " 210 << sampleSolid->GetName() 211 << ". Solid replied: " << sampleSafety << G4endl 212 << " For local point p: " << samplePoint 213 << ", to be considered as 'daughter safety'." << G4endl; 167 fLogger->PrintDaughterLog(sampleSolid,samplePoint,sampleSafety,0); 214 168 } 215 169 #endif … … 224 178 sampleSolid->DistanceToIn(samplePoint, sampleDirection); 225 179 #ifdef G4VERBOSE 226 if( ( fCheck ) && ( fVerbose == 1 ))180 if( fCheck ) 227 181 { 228 G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl 229 << " Invoked DistanceToIn(p,v) for daughter solid: " 230 << sampleSolid->GetName() 231 << ". Solid replied: " << sampleStep << G4endl 232 << " For local point p: " << samplePoint << G4endl 233 << " Direction v: " << sampleDirection 234 << ", to be considered as 'daughter step'." << G4endl; 182 fLogger->PrintDaughterLog(sampleSolid, samplePoint, 183 sampleSafety, sampleStep); 235 184 } 236 185 #endif … … 247 196 // candidate. 248 197 249 if ( ( fCheck ) && ( sampleStep < kInfinity ))198 if ( fCheck ) 250 199 { 251 G4ThreeVector intersectionPoint; 252 intersectionPoint= samplePoint + sampleStep * sampleDirection; 253 EInside insideIntPt= sampleSolid->Inside(intersectionPoint); 254 G4String solidResponse = "-kInside-"; 255 if (insideIntPt == kOutside) 256 { solidResponse = "-kOutside-"; } 257 else if (insideIntPt == kSurface) 258 { solidResponse = "-kSurface-"; } 259 if( fVerbose == 1 ) 260 { 261 G4cout << "*** G4VoxelNavigation::ComputeStep(): ***"<<G4endl 262 << " Invoked Inside() for solid: " 263 << sampleSolid->GetName() 264 << ". Solid replied: " << solidResponse << G4endl 265 << " For point p: " << intersectionPoint 266 << ", considered as 'intersection' point." << G4endl; 267 } 268 G4double safetyIn= -1, safetyOut= -1; // Set to invalid values 269 G4double newDistIn= -1, newDistOut= -1; 270 if( insideIntPt != kInside ) 271 { 272 safetyIn= sampleSolid->DistanceToIn(intersectionPoint); 273 newDistIn= sampleSolid->DistanceToIn(intersectionPoint, 274 sampleDirection); 275 } 276 if( insideIntPt != kOutside ) 277 { 278 safetyOut= sampleSolid->DistanceToOut(intersectionPoint); 279 newDistOut= sampleSolid->DistanceToOut(intersectionPoint, 280 sampleDirection); 281 } 282 if( insideIntPt != kSurface ) 283 { 284 G4int oldcoutPrec = G4cout.precision(16); 285 G4cout << "WARNING - G4VoxelNavigation::ComputeStep()" 286 << G4endl 287 << " Inaccurate solid DistanceToIn" 288 << " for solid " << sampleSolid->GetName() << G4endl; 289 G4cout << " Solid gave DistanceToIn = " 290 << sampleStep << " yet returns " << solidResponse 291 << " for this point !" << G4endl; 292 G4cout << " Point = " << intersectionPoint << G4endl; 293 G4cout << " Safety values: " << G4endl; 294 if ( insideIntPt != kInside ) 295 { 296 G4cout << " DistanceToIn(p) = " << safetyIn 297 << G4endl; 298 } 299 if ( insideIntPt != kOutside ) 300 { 301 G4cout << " DistanceToOut(p) = " << safetyOut 302 << G4endl; 303 } 304 G4Exception("G4VoxelNavigation::ComputeStep()", 305 "InaccurateDistanceToIn", JustWarning, 306 "Conflicting response from Solid."); 307 G4cout.precision(oldcoutPrec); 308 } 309 else 310 { 311 // If it is on the surface, *ensure* that either DistanceToIn 312 // or DistanceToOut returns a finite value ( >= Tolerance). 313 // 314 if( std::max( newDistIn, newDistOut ) <= kCarTolerance ) 315 { 316 G4cout << "ERROR - G4VoxelNavigation::ComputeStep()" 317 << G4endl 318 << " Identified point for which the solid " 319 << sampleSolid->GetName() << G4endl 320 << " has MAJOR problem: " << G4endl 321 << " --> Both DistanceToIn(p,v) and DistanceToOut(p,v) " 322 << "return Zero, an equivalent value or negative value." 323 << G4endl; 324 G4cout << " Solid: " << sampleSolid << G4endl; 325 G4cout << " Point p= " << intersectionPoint << G4endl; 326 G4cout << " Direction v= " << sampleDirection << G4endl; 327 G4cout << " DistanceToIn(p,v) = " << newDistIn 328 << G4endl; 329 G4cout << " DistanceToOut(p,v,..) = " << newDistOut 330 << G4endl; 331 G4cout << " Safety values: " << G4endl; 332 G4cout << " DistanceToIn(p) = " << safetyIn 333 << G4endl; 334 G4cout << " DistanceToOut(p) = " << safetyOut 335 << G4endl; 336 G4Exception("G4VoxelNavigation::ComputeStep()", 337 "DistanceToInAndOutAreZero", FatalException, 338 "Zero from both Solid DistanceIn and Out(p,v)."); 339 } 340 } 200 fLogger->AlongComputeStepLog (sampleSolid, samplePoint, 201 sampleDirection, localDirection, sampleSafety, sampleStep); 341 202 } 342 203 #endif … … 378 239 if ( fCheck ) 379 240 { 380 if(fVerbose == 1) 381 { 382 G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl 383 << " Invoked DistanceToOut(p,v,...) for mother solid: " 384 << motherSolid->GetName() 385 << ". Solid replied: " << motherStep << G4endl 386 << " For local point p: " << localPoint << G4endl 387 << " Direction v: " << localDirection 388 << ", to be considered as 'mother step'." << G4endl; 389 } 390 if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) ) 391 { 392 G4int oldPrOut= G4cout.precision(16); 393 G4int oldPrErr= G4cerr.precision(16); 394 G4cerr << "ERROR - G4VoxelNavigation::ComputeStep()" << G4endl 395 << " Problem in Navigation" << G4endl 396 << " Point (local coordinates): " 397 << localPoint << G4endl 398 << " Local Direction: " << localDirection << G4endl 399 << " Solid: " << motherSolid->GetName() << G4endl; 400 motherSolid->DumpInfo(); 401 G4Exception("G4VoxelNavigation::ComputeStep()", 402 "PointOutsideCurrentVolume", FatalException, 403 "Current point is outside the current solid !"); 404 G4cout.precision(oldPrOut); 405 G4cerr.precision(oldPrErr); 406 } 241 fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection, 242 motherStep, motherSafety); 407 243 } 408 244 #endif … … 480 316 } 481 317 else if (maxCurNodeNoDelta < minCurNodeNoDelta) 482 {483 voxelSafety = maxCurNodeNoDelta*curNodeWidth;484 voxelSafety += maxCurCommonDelta;485 }486 else // (maxCurNodeNoDelta == minCurNodeNoDelta)487 {488 voxelSafety = minCurNodeNoDelta*curNodeWidth;489 voxelSafety += std::min(minCurCommonDelta,maxCurCommonDelta);490 }318 { 319 voxelSafety = maxCurNodeNoDelta*curNodeWidth; 320 voxelSafety += maxCurCommonDelta; 321 } 322 else // (maxCurNodeNoDelta == minCurNodeNoDelta) 323 { 324 voxelSafety = minCurNodeNoDelta*curNodeWidth; 325 voxelSafety += std::min(minCurCommonDelta,maxCurCommonDelta); 326 } 491 327 492 328 // Compute isotropic safety to boundaries of previous levels … … 552 388 553 389 G4double currentDistance = currentStep; 390 static const G4double sigma = 0.5*G4GeometryTolerance::GetInstance() 391 ->GetSurfaceTolerance(); 554 392 555 393 // Determine if end of Step within current voxel … … 567 405 minVal = workMinExtent+workNodeNo*workNodeWidth; 568 406 569 if ( minVal<=workCoord+ kCarTolerance*0.5)407 if ( minVal<=workCoord+sigma ) 570 408 { 571 409 maxVal = minVal+workNodeWidth; 572 if ( maxVal<=workCoord- kCarTolerance*0.5)410 if ( maxVal<=workCoord-sigma ) 573 411 { 574 412 // Must consider next voxel … … 607 445 minVal = workMinExtent+fVoxelNode->GetMinEquivalentSliceNo()*workNodeWidth; 608 446 609 if ( minVal<=workCoord+ kCarTolerance*0.5)447 if ( minVal<=workCoord+sigma ) 610 448 { 611 449 maxVal = workMinExtent+(fVoxelNode->GetMaxEquivalentSliceNo()+1) 612 450 *workNodeWidth; 613 if ( maxVal<=workCoord- kCarTolerance*0.5)451 if ( maxVal<=workCoord-sigma ) 614 452 { 615 453 newNodeNo = fVoxelNode->GetMaxEquivalentSliceNo()+1; … … 710 548 G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint, 711 549 const G4NavigationHistory& history, 712 const G4double )550 const G4double maxLength) 713 551 { 714 552 G4VPhysicalVolume *motherPhysical, *samplePhysical; … … 725 563 motherSolid = motherLogical->GetSolid(); 726 564 565 if( fBestSafety ) 566 { 567 return fpVoxelSafety->ComputeSafety( localPoint,*motherPhysical,maxLength ); 568 } 569 727 570 // 728 571 // Compute mother safety … … 733 576 734 577 #ifdef G4VERBOSE 735 if(( fCheck ) && ( fVerbose == 1 )) 736 { 737 G4cout << "*** G4VoxelNavigation::ComputeSafety(): ***" << G4endl 738 << " Invoked DistanceToOut(p) for mother solid: " 739 << motherSolid->GetName() 740 << ". Solid replied: " << motherSafety << G4endl 741 << " For local point p: " << localPoint 742 << ", to be considered as 'mother safety'." << G4endl; 578 if( fCheck ) 579 { 580 fLogger->ComputeSafetyLog (motherSolid, localPoint, motherSafety, true); 743 581 } 744 582 #endif … … 772 610 } 773 611 #ifdef G4VERBOSE 774 if(( fCheck ) && ( fVerbose == 1 )) 775 { 776 G4cout << "*** G4VoxelNavigation::ComputeSafety(): ***" << G4endl 777 << " Invoked DistanceToIn(p) for daughter solid: " 778 << sampleSolid->GetName() 779 << ". Solid replied: " << sampleSafety << G4endl 780 << " For local point p: " << samplePoint 781 << ", to be considered as 'daughter safety'." << G4endl; 612 if( fCheck ) 613 { 614 fLogger->ComputeSafetyLog (sampleSolid,samplePoint,sampleSafety,false); 782 615 } 783 616 #endif … … 790 623 return ourSafety; 791 624 } 625 626 // ******************************************************************** 627 // SetVerboseLevel 628 // ******************************************************************** 629 // 630 void G4VoxelNavigation::SetVerboseLevel(G4int level) 631 { 632 if( fLogger ) fLogger->SetVerboseLevel(level); 633 if( fpVoxelSafety) fpVoxelSafety->SetVerboseLevel( level ); 634 }
Note:
See TracChangeset
for help on using the changeset viewer.
