00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef G4REPLICANAVIGATION_HH
00042 #define G4REPLICANAVIGATION_HH
00043
00044 #include <CLHEP/Units/SystemOfUnits.h>
00045
00046 #include "G4Types.hh"
00047 #include "G4NavigationHistory.hh"
00048 #include "G4LogicalVolume.hh"
00049 #include "G4VPhysicalVolume.hh"
00050 #include "G4ThreeVector.hh"
00051 #include "G4BlockingList.hh"
00052
00053
00054
00055 #include "G4SmartVoxelHeader.hh"
00056
00057 class G4VSolid;
00058
00059 struct G4ExitNormal
00060 {
00061
00062
00063
00064
00065 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPX,kMX,kPY,kMY,kPZ,kMZ,kMother};
00066
00067
00068 G4ThreeVector exitNormal;
00069 G4bool calculated;
00070 G4bool validConvex;
00071 ESide exitSide;
00072
00073 public:
00074
00075 G4ExitNormal(G4ThreeVector norm = G4ThreeVector(0.,0.,0.),
00076 G4bool calc = false,
00077 G4bool valid= false,
00078 ESide side = kNull )
00079 { exitNormal= norm; calculated= calc; validConvex=valid; exitSide=side;}
00080 };
00081
00082 class G4ReplicaNavigation
00083 {
00084 public:
00085
00086 G4ReplicaNavigation();
00087 ~G4ReplicaNavigation();
00088
00089 inline G4bool LevelLocate( G4NavigationHistory& history,
00090 const G4VPhysicalVolume *blockedVol,
00091 const G4int blockedNum,
00092 const G4ThreeVector &globalPoint,
00093 const G4ThreeVector* globalDirection,
00094 const G4bool pLocatedOnEdge,
00095 G4ThreeVector &localPoint );
00096
00097 G4double ComputeStep( const G4ThreeVector &globalPoint,
00098 const G4ThreeVector &globalDirection,
00099 const G4ThreeVector &localPoint,
00100 const G4ThreeVector &localDirection,
00101 const G4double currentProposedStepLength,
00102 G4double &newSafety,
00103 G4NavigationHistory &history,
00104 G4bool &validExitNormal,
00105 G4bool &calculatedExitNormal,
00106 G4ThreeVector &exitNormal,
00107 G4bool &exiting,
00108 G4bool &entering,
00109 G4VPhysicalVolume *(*pBlockedPhysical),
00110 G4int &blockedReplicaNo );
00111
00112 G4double ComputeSafety( const G4ThreeVector &globalPoint,
00113 const G4ThreeVector &localPoint,
00114 G4NavigationHistory &history,
00115 const G4double pProposedMaxLength=DBL_MAX );
00116
00117 EInside BackLocate( G4NavigationHistory &history,
00118 const G4ThreeVector &globalPoint,
00119 G4ThreeVector &localPoint,
00120 const G4bool &exiting,
00121 G4bool ¬KnownInside ) const;
00122
00123 void ComputeTransformation( const G4int replicaNo,
00124 G4VPhysicalVolume *pVol,
00125 G4ThreeVector &point ) const;
00126 void ComputeTransformation( const G4int replicaNo,
00127 G4VPhysicalVolume *pVol ) const;
00128
00129 EInside Inside( const G4VPhysicalVolume *pVol,
00130 const G4int replicaNo,
00131 const G4ThreeVector &localPoint ) const;
00132 G4double DistanceToOut( const G4VPhysicalVolume *pVol,
00133 const G4int replicaNo,
00134 const G4ThreeVector &localPoint ) const;
00135 G4double DistanceToOut( const G4VPhysicalVolume *pVol,
00136 const G4int replicaNo,
00137 const G4ThreeVector &localPoint,
00138 const G4ThreeVector &localDirection,
00139 G4ExitNormal& candidateNormal ) const;
00140
00141 inline G4int GetVerboseLevel() const;
00142 inline void SetVerboseLevel(G4int level);
00143
00144
00145
00146 inline void CheckMode(G4bool mode);
00147
00148
00149
00150
00151 private:
00152
00153 inline G4int VoxelLocate( const G4SmartVoxelHeader *pHead,
00154 const G4ThreeVector &localPoint,
00155 const G4int blocked=-1 ) const;
00156
00157 G4double DistanceToOutPhi( const G4ThreeVector &localPoint,
00158 const G4ThreeVector &localDirection,
00159 const G4double width,
00160 G4ExitNormal& foundNormal ) const;
00161
00162 G4double DistanceToOutRad( const G4ThreeVector &localPoint,
00163 const G4ThreeVector &localDirection,
00164 const G4double width,
00165 const G4double offset,
00166 const G4int replicaNo,
00167 G4ExitNormal& foundNormal ) const;
00168 inline void SetPhiTransformation( const G4double ang,
00169 G4VPhysicalVolume *pVol=0 ) const;
00170 private:
00171
00172
00173
00174
00175 G4bool fCheck;
00176 G4int fVerbose;
00177
00178
00179 G4double kCarTolerance, kRadTolerance, kAngTolerance;
00180
00181 };
00182
00183 #include "G4ReplicaNavigation.icc"
00184
00185 #endif