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 G4ReplicaNavigation
0027 //
0028 // Class description:
0029 //
0030 // Utility for navigation in volumes containing a single G4PVParameterised
0031 // volume for which voxels for the replicated volumes have been constructed.
0032 // [Voxels MUST be along one axis only: NOT refined]
0033 
0034 // History:
0035 // - Created: Paul Kent, Aug 96
0036 // --------------------------------------------------------------------
0037 #ifndef G4REPLICANAVIGATION_HH
0038 #define G4REPLICANAVIGATION_HH
0039 
0040 #include <CLHEP/Units/SystemOfUnits.h>
0041 
0042 #include "G4Types.hh"
0043 #include "G4NavigationHistory.hh"
0044 #include "G4LogicalVolume.hh"
0045 #include "G4VPhysicalVolume.hh"
0046 #include "G4ThreeVector.hh"
0047 #include "G4BlockingList.hh"
0048 
0049 // Required for voxel handling
0050 //
0051 #include "G4SmartVoxelHeader.hh"
0052 
0053 class G4VSolid;
0054 
0055 struct G4ExitNormal
0056 {
0057    // Bucket to hold value of Normal (3-vector), 
0058    // bools for calculated and leave-behind or 'validConvex',
0059    // and exiting side.
0060    
0061    enum  ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPX,kMX,kPY,kMY,kPZ,kMZ,kMother};
0062      // Identity of 'Side' of Replicas. Used by DistanceToOut methods.
0063 
0064    G4ThreeVector exitNormal;
0065    G4bool        calculated;   // Normal
0066    G4bool        validConvex;  // Solid locally convex
0067    ESide         exitSide;
0068 
0069  public:
0070 
0071    G4ExitNormal(const G4ThreeVector& norm = G4ThreeVector(0.,0.,0.),
0072                 G4bool        calc = false,
0073                 G4bool        valid= false,
0074                 ESide         side = kNull )
0075    { exitNormal= norm; calculated= calc; validConvex=valid; exitSide=side;}
0076 };
0077 
0078 class G4ReplicaNavigation
0079 {
0080   public:  // with description
0081 
0082     G4ReplicaNavigation();
0083    ~G4ReplicaNavigation();
0084 
0085     inline G4bool LevelLocate( G4NavigationHistory& history,
0086                          const G4VPhysicalVolume* blockedVol,
0087                          const G4int blockedNum,
0088                          const G4ThreeVector& globalPoint,
0089                          const G4ThreeVector* globalDirection,
0090                          const G4bool pLocatedOnEdge, 
0091                                G4ThreeVector& localPoint );
0092 
0093     G4double ComputeStep( const G4ThreeVector& globalPoint,
0094                           const G4ThreeVector& globalDirection,
0095                           const G4ThreeVector& localPoint,
0096                           const G4ThreeVector& localDirection,
0097                           const G4double currentProposedStepLength,
0098                                 G4double& newSafety,
0099                                 G4NavigationHistory& history,
0100                                 G4bool& validExitNormal,
0101                                 G4bool& calculatedExitNormal,
0102                                 G4ThreeVector &exitNormal,
0103                                 G4bool& exiting,
0104                                 G4bool& entering,
0105                                 G4VPhysicalVolume* (*pBlockedPhysical),
0106                                 G4int &blockedReplicaNo );
0107 
0108     G4double ComputeSafety( const G4ThreeVector& globalPoint,
0109                             const G4ThreeVector& localPoint,
0110                             const G4NavigationHistory& history,
0111                             const G4double pProposedMaxLength = DBL_MAX ) const;
0112 
0113     EInside BackLocate( G4NavigationHistory &history,
0114                   const G4ThreeVector& globalPoint,
0115                         G4ThreeVector& localPoint,
0116                   const G4bool& exiting,
0117                         G4bool& notKnownInside ) const;
0118 
0119     void ComputeTransformation( const G4int replicaNo,
0120                                       G4VPhysicalVolume* pVol,
0121                                       G4ThreeVector& point ) const; 
0122     void ComputeTransformation( const G4int replicaNo,
0123                                       G4VPhysicalVolume* pVol ) const; 
0124 
0125     EInside Inside( const G4VPhysicalVolume* pVol,
0126                     const G4int replicaNo,
0127                     const G4ThreeVector& localPoint ) const;
0128     G4double DistanceToOut( const G4VPhysicalVolume* pVol,
0129                             const G4int replicaNo,
0130                             const G4ThreeVector &localPoint ) const;
0131     G4double DistanceToOut( const G4VPhysicalVolume* pVol,
0132                             const G4int replicaNo,
0133                             const G4ThreeVector& localPoint,
0134                             const G4ThreeVector& localDirection,
0135                                   G4ExitNormal& candidateNormal ) const;
0136 
0137     inline G4int GetVerboseLevel() const;
0138     inline void  SetVerboseLevel(G4int level);
0139       // Get/Set Verbose(ness) level.
0140       // [if level>0 && G4VERBOSE, printout can occur]
0141 
0142     inline void CheckMode(G4bool mode);
0143       // Run navigation in "check-mode", therefore using additional
0144       // verifications and more strict correctness conditions.
0145       // Is effective only with G4VERBOSE set.
0146 
0147   private:
0148 
0149     inline G4int VoxelLocate( const G4SmartVoxelHeader* pHead,
0150                               const G4ThreeVector& localPoint,
0151                               const G4int blocked=-1 ) const;
0152 
0153     G4double DistanceToOutPhi( const G4ThreeVector& localPoint,
0154                                const G4ThreeVector& localDirection,
0155                                const G4double width,
0156                                G4ExitNormal& foundNormal ) const;
0157 
0158     G4double DistanceToOutRad( const G4ThreeVector& localPoint,
0159                                const G4ThreeVector& localDirection,
0160                                const G4double width,
0161                                const G4double offset,
0162                                const G4int replicaNo,
0163                                      G4ExitNormal& foundNormal ) const;
0164     inline void SetPhiTransformation( const G4double ang,
0165                                             G4VPhysicalVolume* pVol=nullptr ) const;
0166   private:
0167 
0168     // Invariants - unaltered during navigation
0169     // **********
0170 
0171     G4bool fCheck = false; 
0172     G4int  fVerbose = 0;
0173       // Configuration parameters
0174 
0175     G4double kCarTolerance, kRadTolerance, kAngTolerance,
0176              halfkCarTolerance, halfkRadTolerance, halfkAngTolerance,
0177              fMinStep;
0178       // Local copy of constants
0179 };
0180 
0181 #include "G4ReplicaNavigation.icc"
0182 
0183 #endif