File indexing completed on 2025-01-18 09:58:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 #ifndef G4ITMULTINAVIGATOR_HH
0050 #define G4ITMULTINAVIGATOR_HH
0051
0052 #include <iostream>
0053
0054 #include "geomdefs.hh"
0055 #include "G4ThreeVector.hh"
0056 #include "G4ITNavigator.hh"
0057
0058 #include "G4TouchableHandle.hh"
0059
0060 #include "G4NavigationHistory.hh"
0061 #include "G4TrackState.hh"
0062 #include "G4MultiNavigator.hh"
0063
0064 namespace G4ITMN
0065 {
0066 enum ELimited
0067 {
0068 kDoNot,
0069 kUnique,
0070 kSharedTransport,
0071 kSharedOther,
0072 kUndefLimited
0073 };
0074 }
0075 class G4ITTransportationManager;
0076 class G4VPhysicalVolume;
0077
0078 class G4ITMultiNavigator;
0079
0080
0081 template<>
0082 class G4TrackState<G4ITMultiNavigator> : public G4TrackState<G4ITNavigator>
0083 {
0084 public:
0085 ~G4TrackState() override
0086 = default;
0087
0088 G4TrackState()
0089 {
0090 G4ThreeVector Big3Vector(kInfinity, kInfinity, kInfinity);
0091 fLastLocatedPosition = Big3Vector;
0092 fSafetyLocation = Big3Vector;
0093 fPreStepLocation = Big3Vector;
0094
0095 fMinSafety_PreStepPt = -1.0;
0096 fMinSafety_atSafLocation = -1.0;
0097 fMinSafety = -kInfinity;
0098 fTrueMinStep = fMinStep = -kInfinity;
0099
0100 for (G4int num = 0; num < G4ITNavigator::fMaxNav; ++num)
0101 {
0102 fLimitTruth[num] = false;
0103 fLimitedStep[num] = kUndefLimited;
0104 fCurrentStepSize[num] = fNewSafety[num] = -1.0;
0105 fLocatedVolume[num] = nullptr;
0106 }
0107
0108 fNoLimitingStep = -1;
0109 fIdNavLimiting = -1;
0110 fWasLimitedByGeometry = false;
0111 }
0112 ;
0113
0114 protected:
0115 friend class G4ITMultiNavigator;
0116
0117 ELimited fLimitedStep[G4ITNavigator::fMaxNav];
0118 G4bool fLimitTruth[G4ITNavigator::fMaxNav];
0119 G4double fCurrentStepSize[G4ITNavigator::fMaxNav];
0120 G4double fNewSafety[G4ITNavigator::fMaxNav];
0121 G4int fNoLimitingStep;
0122 G4int fIdNavLimiting;
0123
0124 G4bool fWasLimitedByGeometry;
0125
0126
0127 G4double fMinStep;
0128 G4double fMinSafety;
0129 G4double fTrueMinStep;
0130
0131
0132 G4VPhysicalVolume* fLocatedVolume[G4ITNavigator::fMaxNav];
0133 G4ThreeVector fLastLocatedPosition;
0134
0135
0136 G4ThreeVector fSafetyLocation;
0137 G4double fMinSafety_atSafLocation;
0138 G4ThreeVector fPreStepLocation;
0139 G4double fMinSafety_PreStepPt;
0140 };
0141
0142 class G4ITMultiNavigator : public G4ITNavigator,
0143 public G4TrackStateDependent<G4ITMultiNavigator>
0144 {
0145 public:
0146
0147
0148 friend std::ostream& operator <<(std::ostream &os, const G4ITNavigator &n);
0149
0150 G4ITMultiNavigator();
0151
0152
0153 ~G4ITMultiNavigator() override;
0154
0155
0156 G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
0157 const G4ThreeVector &pDirection,
0158 const G4double pCurrentProposedStepLength,
0159 G4double &pNewSafety) override;
0160
0161
0162 G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety,
0163 G4double &minStepLast,
0164 ELimited &limitedStep);
0165
0166
0167 void PrepareNavigators();
0168
0169 void PrepareNewTrack(const G4ThreeVector position,
0170 const G4ThreeVector direction);
0171
0172
0173 G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
0174 const G4ThreeVector &direction,
0175 const G4TouchableHistory &h) override;
0176
0177
0178
0179
0180
0181
0182 G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
0183 const G4ThreeVector* direction =
0184 nullptr,
0185 const G4bool pRelativeSearch =
0186 true,
0187 const G4bool ignoreDirection =
0188 true) override;
0189
0190
0191
0192
0193
0194
0195 void LocateGlobalPointWithinVolume(const G4ThreeVector& position) override;
0196
0197
0198
0199
0200 G4double ComputeSafety(const G4ThreeVector &globalpoint,
0201 const G4double pProposedMaxLength = DBL_MAX,
0202 const G4bool keepState = false) override;
0203
0204
0205
0206
0207 G4TouchableHandle CreateTouchableHistoryHandle() const override;
0208
0209
0210 G4ThreeVector GetLocalExitNormal(G4bool* obtained) override;
0211 G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point,
0212 G4bool* obtained) override;
0213 G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point,
0214 G4bool* obtained) override;
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226 public:
0227
0228 G4ITNavigator* GetNavigator(G4int n) const
0229 {
0230 if( (n>fNoActiveNavigators)||(n<0))
0231 { n=0;}
0232 return fpNavigator[n];
0233 }
0234
0235 protected:
0236
0237 void ResetState() override;
0238
0239
0240 void SetupHierarchy() override;
0241
0242
0243
0244
0245
0246 void WhichLimited();
0247 void PrintLimited();
0248 void CheckMassWorld();
0249
0250 private:
0251
0252 G4int fNoActiveNavigators;
0253 G4VPhysicalVolume* fLastMassWorld{nullptr};
0254
0255 G4ITNavigator* fpNavigator[fMaxNav];
0256
0257 G4ITTransportationManager* pTransportManager;
0258 };
0259
0260 #endif