Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:02

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 // class G4RegularNavigation
0027 //
0028 // Class description:
0029 //
0030 // Utility for fast navigation in volumes containing a regular
0031 // parameterisation. If two contiguous voxels have the same material,
0032 // navigation does not stop at the surface
0033 
0034 // History:
0035 // - Created.   P. Arce, May 2007
0036 // --------------------------------------------------------------------
0037 #ifndef G4RegularNavigation_HH
0038 #define G4RegularNavigation_HH
0039 
0040 #include <vector>
0041 
0042 #include "G4Types.hh"
0043 #include "G4ThreeVector.hh"
0044 #include "G4VNavigation.hh"
0045 
0046 class G4NormalNavigation;
0047 class G4VPhysicalVolume;
0048 class G4Navigator;
0049 class G4NavigationHistory;
0050 
0051 class G4RegularNavigation : public G4VNavigation
0052 {
0053   public:  // with description
0054   
0055     G4RegularNavigation();
0056    ~G4RegularNavigation();
0057   
0058     G4bool LevelLocate(      G4NavigationHistory& history,
0059                        const G4VPhysicalVolume* blockedVol,
0060                        const G4int blockedNum,
0061                        const G4ThreeVector& globalPoint,
0062                        const G4ThreeVector* globalDirection,
0063                        const G4bool pLocatedOnEdge, 
0064                              G4ThreeVector& localPoint ) final;
0065       // Locate point using its position with respect to regular
0066       // parameterisation container volume.
0067 
0068     G4double ComputeStep( const G4ThreeVector& globalPoint,
0069                           const G4ThreeVector& globalDirection,
0070                           const G4double currentProposedStepLength,
0071                                 G4double& newSafety,
0072                                 G4NavigationHistory& history,
0073                                 G4bool& validExitNormal,
0074                                 G4ThreeVector& exitNormal,
0075                                 G4bool& exiting,
0076                                 G4bool& entering,
0077                                 G4VPhysicalVolume *(*pBlockedPhysical),
0078                                 G4int& blockedReplicaNo ) final;
0079       // Method never called because to be called the daughter has to be a
0080       // 'regular' volume. This would only happen if the track is in the
0081       // mother of voxels volume. But the voxels fill completely their mother,
0082       // so when a track enters the mother it automatically enters a voxel.
0083   
0084     G4double ComputeStepSkippingEqualMaterials( 
0085                                 G4ThreeVector& localPoint,
0086                           const G4ThreeVector& globalDirection,
0087                           const G4double currentProposedStepLength,
0088                                 G4double& newSafety,
0089                                 G4NavigationHistory& history,
0090                                 G4bool& validExitNormal,
0091                                 G4ThreeVector& exitNormal,
0092                                 G4bool& exiting,
0093                                 G4bool& entering,
0094                                 G4VPhysicalVolume *(*pBlockedPhysical),
0095                                 G4int& blockedReplicaNo,
0096                                 G4VPhysicalVolume* pCurrentPhysical);
0097       // Compute the step skipping surfaces when they separate voxels with
0098       // equal materials. Loop to voxels until a different material is found:
0099       // invokes G4NormalNavigation::ComputeStep() in each voxel and move the
0100       // point to the next voxel.
0101 
0102     G4double ComputeSafety( const G4ThreeVector& localPoint,
0103                             const G4NavigationHistory& history,
0104                             const G4double pProposedMaxLength = DBL_MAX ) final;
0105       // Method never called because to be called the daughter has to be a
0106       // 'regular' volume. This would only happen if the track is in the
0107       // mother of voxels volume. But the voxels fill completely their mother,
0108       // so when a track enters the mother it automatically enters a voxel.
0109 
0110   public:  // without description
0111 
0112     void SetNormalNavigation( G4NormalNavigation* fnormnav )
0113       { fnormalNav = fnormnav; }
0114 
0115   private:
0116 
0117     G4NormalNavigation* fnormalNav = nullptr;
0118     G4double kCarTolerance;  
0119     G4double fMinStep;
0120  
0121     G4bool fLastStepWasZero = false;
0122       // Whether the last ComputeStep moved Zero. Used to check for edges.
0123     G4int fNumberZeroSteps = 0;
0124       // Number of preceding moves that were Zero. Reset to 0 after finite step
0125     G4int fActionThreshold_NoZeroSteps = 2;  
0126       // After this many failed/zero steps, act (push etc) 
0127     G4int fAbandonThreshold_NoZeroSteps = 25; 
0128       // After this many failed/zero steps, abandon track
0129     G4int fNoStepsAllowed = 10000;
0130       // Maximum number of steps a track can travel skipping voxels (if there are more, track is assumed to be stuck and it is killed)
0131 };
0132 
0133 #endif