G4NormalNavigation Class Reference

#include <G4NormalNavigation.hh>


Public Member Functions

 G4NormalNavigation ()
 ~G4NormalNavigation ()
G4bool LevelLocate (G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
G4double ComputeStep (const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX)
G4int GetVerboseLevel () const
void SetVerboseLevel (G4int level)
void CheckMode (G4bool mode)


Detailed Description

Definition at line 53 of file G4NormalNavigation.hh.


Constructor & Destructor Documentation

G4NormalNavigation::G4NormalNavigation (  ) 

Definition at line 43 of file G4NormalNavigation.cc.

00044   : fCheck(false)
00045 {
00046   fLogger = new G4NavigationLogger("G4NormalNavigation");
00047 }

G4NormalNavigation::~G4NormalNavigation (  ) 

Definition at line 53 of file G4NormalNavigation.cc.

00054 {
00055   delete fLogger;
00056 }


Member Function Documentation

void G4NormalNavigation::CheckMode ( G4bool  mode  )  [inline]

Definition at line 120 of file G4NormalNavigation.icc.

Referenced by G4Navigator::CheckMode(), and G4ITNavigator::CheckMode().

00121 {
00122   fCheck = mode;
00123 }

G4double G4NormalNavigation::ComputeSafety ( const G4ThreeVector globalpoint,
const G4NavigationHistory history,
const G4double  pMaxLength = DBL_MAX 
)

Definition at line 229 of file G4NormalNavigation.cc.

References G4NavigationLogger::ComputeSafetyLog(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopVolume(), and G4VPhysicalVolume::GetTranslation().

Referenced by G4RegularNavigation::ComputeSafety(), G4Navigator::ComputeSafety(), and G4ITNavigator::ComputeSafety().

00232 {
00233   G4VPhysicalVolume *motherPhysical, *samplePhysical;
00234   G4LogicalVolume *motherLogical;
00235   G4VSolid *motherSolid;
00236   G4double motherSafety, ourSafety;
00237   G4int localNoDaughters, sampleNo;
00238 
00239   motherPhysical = history.GetTopVolume();
00240   motherLogical  = motherPhysical->GetLogicalVolume();
00241   motherSolid    = motherLogical->GetSolid();
00242 
00243   // Compute mother safety
00244   //
00245   motherSafety = motherSolid->DistanceToOut(localPoint);
00246   ourSafety = motherSafety; // Working isotropic safety
00247 
00248 #ifdef G4VERBOSE
00249   if( fCheck )
00250   {
00251     fLogger->ComputeSafetyLog(motherSolid, localPoint, motherSafety, true);
00252   }
00253 #endif
00254 
00255   // Compute daughter safeties 
00256   //
00257   localNoDaughters = motherLogical->GetNoDaughters();
00258   for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo-- )
00259   {
00260     samplePhysical = motherLogical->GetDaughter(sampleNo);
00261     G4AffineTransform sampleTf(samplePhysical->GetRotation(),
00262                                samplePhysical->GetTranslation());
00263     sampleTf.Invert();
00264     const G4ThreeVector samplePoint =
00265             sampleTf.TransformPoint(localPoint);
00266     const G4VSolid *sampleSolid =
00267             samplePhysical->GetLogicalVolume()->GetSolid();
00268     const G4double sampleSafety =
00269             sampleSolid->DistanceToIn(samplePoint);
00270     if ( sampleSafety<ourSafety )
00271     {
00272       ourSafety = sampleSafety;
00273     }
00274 #ifdef G4VERBOSE
00275     if(fCheck)
00276     {
00277       fLogger->ComputeSafetyLog(sampleSolid, samplePoint, sampleSafety, false);
00278     }
00279 #endif
00280   }
00281   return ourSafety;
00282 }

G4double G4NormalNavigation::ComputeStep ( const G4ThreeVector localPoint,
const G4ThreeVector localDirection,
const G4double  currentProposedStepLength,
G4double newSafety,
G4NavigationHistory history,
G4bool validExitNormal,
G4ThreeVector exitNormal,
G4bool exiting,
G4bool entering,
G4VPhysicalVolume **  pBlockedPhysical,
G4int blockedReplicaNo 
)

Definition at line 63 of file G4NormalNavigation.cc.

References G4NavigationLogger::AlongComputeStepLog(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopVolume(), G4VPhysicalVolume::GetTranslation(), G4NavigationLogger::PostComputeStepLog(), G4NavigationLogger::PreComputeStepLog(), and G4NavigationLogger::PrintDaughterLog().

Referenced by G4RegularNavigation::ComputeStep(), G4Navigator::ComputeStep(), G4ITNavigator::ComputeStep(), and G4RegularNavigation::ComputeStepSkippingEqualMaterials().

00074 {
00075   G4VPhysicalVolume *motherPhysical, *samplePhysical, *blockedExitedVol=0;
00076   G4LogicalVolume *motherLogical;
00077   G4VSolid *motherSolid;
00078   G4ThreeVector sampleDirection;
00079   G4double ourStep=currentProposedStepLength, motherSafety, ourSafety;
00080   G4int localNoDaughters, sampleNo;
00081 
00082   motherPhysical = history.GetTopVolume();
00083   motherLogical  = motherPhysical->GetLogicalVolume();
00084   motherSolid    = motherLogical->GetSolid();
00085 
00086   // Compute mother safety
00087   //
00088   motherSafety = motherSolid->DistanceToOut(localPoint);
00089   ourSafety = motherSafety; // Working isotropic safety
00090   
00091 #ifdef G4VERBOSE
00092   if ( fCheck )
00093   {
00094     fLogger->PreComputeStepLog(motherPhysical, motherSafety, localPoint);
00095   }
00096 #endif
00097 
00098   //
00099   // Compute daughter safeties & intersections
00100   //
00101 
00102   // Exiting normal optimisation
00103   //
00104   if ( exiting&&validExitNormal )
00105   {
00106     if ( localDirection.dot(exitNormal)>=kMinExitingNormalCosine )
00107     {
00108       // Block exited daughter volume
00109       //
00110       blockedExitedVol =* pBlockedPhysical;
00111       ourSafety = 0;
00112     }
00113   }
00114   exiting  = false;
00115   entering = false;
00116 
00117   localNoDaughters = motherLogical->GetNoDaughters();
00118   for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo--)
00119   {
00120     samplePhysical = motherLogical->GetDaughter(sampleNo);
00121     if ( samplePhysical!=blockedExitedVol )
00122     {
00123       G4AffineTransform sampleTf(samplePhysical->GetRotation(),
00124                                  samplePhysical->GetTranslation());
00125       sampleTf.Invert();
00126       const G4ThreeVector samplePoint =
00127               sampleTf.TransformPoint(localPoint);
00128       const G4VSolid *sampleSolid =
00129               samplePhysical->GetLogicalVolume()->GetSolid();
00130       const G4double sampleSafety =
00131               sampleSolid->DistanceToIn(samplePoint);
00132 #ifdef G4VERBOSE
00133       if( fCheck )
00134       {
00135         fLogger->PrintDaughterLog(sampleSolid, samplePoint, sampleSafety, 0);
00136       }
00137 #endif
00138       if ( sampleSafety<ourSafety )
00139       {
00140         ourSafety=sampleSafety;
00141       }
00142       if ( sampleSafety<=ourStep )
00143       {
00144         sampleDirection = sampleTf.TransformAxis(localDirection);
00145         const G4double sampleStep =
00146                 sampleSolid->DistanceToIn(samplePoint,sampleDirection);
00147 
00148 #ifdef G4VERBOSE
00149         if( fCheck )
00150         {
00151           fLogger->PrintDaughterLog(sampleSolid, samplePoint,
00152                                     sampleSafety, sampleStep);
00153         }
00154 #endif
00155         if ( sampleStep<=ourStep )
00156         {
00157           ourStep  = sampleStep;
00158           entering = true;
00159           exiting  = false;
00160           *pBlockedPhysical = samplePhysical;
00161           blockedReplicaNo  = -1;
00162 #ifdef G4VERBOSE
00163           if( fCheck )
00164           {
00165             fLogger->AlongComputeStepLog(sampleSolid, samplePoint,
00166               sampleDirection, localDirection, sampleSafety, sampleStep);
00167           }
00168 #endif
00169         }
00170       }
00171     }
00172   }
00173   if ( currentProposedStepLength<ourSafety )
00174   {
00175     // Guaranteed physics limited
00176     //
00177     entering = false;
00178     exiting  = false;
00179     *pBlockedPhysical = 0;
00180     ourStep = kInfinity;
00181   }
00182   else
00183   {
00184     // Compute mother intersection if required
00185     //
00186     if ( motherSafety<=ourStep )
00187     {
00188       G4double motherStep = motherSolid->DistanceToOut(localPoint,
00189                                                        localDirection,
00190                                                        true,
00191                                                        &validExitNormal,
00192                                                        &exitNormal);
00193 #ifdef G4VERBOSE
00194       if ( fCheck )
00195       {
00196         fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection,
00197                                     motherStep, motherSafety);
00198       }
00199 #endif
00200 
00201       if ( motherStep<=ourStep )
00202       {
00203         ourStep  = motherStep;
00204         exiting  = true;
00205         entering = false;
00206         if ( validExitNormal )
00207         {
00208           const G4RotationMatrix *rot = motherPhysical->GetRotation();
00209           if (rot)
00210           {
00211             exitNormal *= rot->inverse();
00212           }
00213         }
00214       }
00215       else
00216       {
00217         validExitNormal = false;
00218       }
00219     }
00220   }
00221   newSafety = ourSafety;
00222   return ourStep;
00223 }

G4int G4NormalNavigation::GetVerboseLevel (  )  const [inline]

Definition at line 100 of file G4NormalNavigation.icc.

References G4NavigationLogger::GetVerboseLevel().

00101 {
00102   return fLogger->GetVerboseLevel();
00103 }

G4bool G4NormalNavigation::LevelLocate ( G4NavigationHistory history,
const G4VPhysicalVolume blockedVol,
const G4int  blockedNum,
const G4ThreeVector globalPoint,
const G4ThreeVector globalDirection,
const G4bool  pLocatedOnEdge,
G4ThreeVector localPoint 
) [inline]

Definition at line 40 of file G4NormalNavigation.icc.

References G4NavigationHistory::BackLevel(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), G4NavigationHistory::GetTopTransform(), G4NavigationHistory::GetTopVolume(), kNormal, G4NavigationHistory::NewLevel(), and G4AffineTransform::TransformPoint().

Referenced by G4Navigator::LocateGlobalPointAndSetup(), and G4ITNavigator::LocateGlobalPointAndSetup().

00047 {
00048   G4VPhysicalVolume *targetPhysical, *samplePhysical;
00049   G4LogicalVolume *targetLogical;
00050   G4VSolid *sampleSolid;
00051   G4ThreeVector samplePoint;
00052   G4int targetNoDaughters;
00053   
00054   targetPhysical = history.GetTopVolume();
00055   targetLogical = targetPhysical->GetLogicalVolume();
00056   targetNoDaughters = targetLogical->GetNoDaughters();
00057   
00058   G4bool found = false;
00059 
00060   if (targetNoDaughters!=0)
00061   {
00062     //
00063     // Search daughters in volume
00064     //
00065     for ( register int sampleNo=targetNoDaughters-1; sampleNo>=0; sampleNo-- )
00066     {
00067       samplePhysical = targetLogical->GetDaughter(sampleNo);
00068       if ( samplePhysical!=blockedVol )
00069       {
00070         // Setup history
00071         //
00072         history.NewLevel(samplePhysical, kNormal, samplePhysical->GetCopyNo());
00073         sampleSolid = samplePhysical->GetLogicalVolume()->GetSolid();
00074         samplePoint = history.GetTopTransform().TransformPoint(globalPoint);
00075         if( G4AuxiliaryNavServices::
00076             CheckPointOnSurface(sampleSolid, samplePoint, globalDirection, 
00077                                 history.GetTopTransform(), pLocatedOnEdge) )
00078         {
00079           // Enter this daughter
00080           //
00081           localPoint = samplePoint;
00082           found = true;
00083           break;
00084         }
00085         else
00086         {
00087           history.BackLevel();
00088         }
00089       }
00090     }
00091   }
00092   return found;
00093 }

void G4NormalNavigation::SetVerboseLevel ( G4int  level  )  [inline]

Definition at line 110 of file G4NormalNavigation.icc.

References G4NavigationLogger::SetVerboseLevel().

Referenced by G4Navigator::SetVerboseLevel(), and G4ITNavigator::SetVerboseLevel().

00111 {
00112   fLogger->SetVerboseLevel(level);
00113 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:44 2013 for Geant4 by  doxygen 1.4.7