File indexing completed on 2025-01-18 09:26:25
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 #ifndef G4SteppingManager_hh
0045 #define G4SteppingManager_hh 1
0046
0047 #include "G4LogicalVolume.hh" // Include from 'geometry'
0048 #include "G4Navigator.hh" // Include from 'geometry'
0049 #include "G4NoProcess.hh" // Include from 'processes'
0050 #include "G4ProcessManager.hh" // Include from 'processes'
0051 #include "G4Step.hh" // Include from 'tracking'
0052 #include "G4StepPoint.hh" // Include from 'tracking'
0053 #include "G4StepStatus.hh" // Include from 'tracking'
0054 #include "G4TouchableHandle.hh" // Include from 'geometry'
0055 #include "G4Track.hh" // Include from 'tracking'
0056 #include "G4TrackStatus.hh" // Include from 'tracking'
0057 #include "G4TrackVector.hh" // Include from 'tracking'
0058 #include "G4UserSteppingAction.hh" // Include from 'tracking'
0059 #include "G4VPhysicalVolume.hh" // Include from 'geometry'
0060 #include "G4VSteppingVerbose.hh" // Include from 'tracking'
0061 #include "Randomize.hh" // Include from 'global'
0062 #include "globals.hh" // Include from 'global'
0063
0064 #include <iomanip> // Include from 'system'
0065 #include <vector> // Include from 'system'
0066
0067 using G4SelectedAtRestDoItVector = std::vector<G4int>;
0068 using G4SelectedAlongStepDoItVector = std::vector<G4int>;
0069 using G4SelectedPostStepDoItVector = std::vector<G4int>;
0070
0071 class G4VSensitiveDetector;
0072
0073 class G4SteppingManager
0074 {
0075 public:
0076
0077
0078
0079
0080
0081
0082
0083
0084 G4SteppingManager();
0085 ~G4SteppingManager();
0086
0087
0088
0089 const G4TrackVector* GetSecondary() const;
0090 void SetUserAction(G4UserSteppingAction* apAction);
0091 G4Track* GetTrack() const;
0092 void SetVerboseLevel(G4int vLevel);
0093 void SetVerbose(G4VSteppingVerbose*);
0094 G4Step* GetStep() const;
0095 void SetNavigator(G4Navigator* value);
0096
0097
0098
0099
0100 G4StepStatus Stepping();
0101
0102
0103
0104
0105 void SetInitialStep(G4Track* valueTrack);
0106
0107
0108 void GetProcessNumber();
0109 G4double GetPhysicalStep();
0110 G4double GetGeometricalStep();
0111 G4double GetCorrectedStep();
0112 G4bool GetPreStepPointIsGeom();
0113 G4bool GetFirstStep();
0114 G4StepStatus GetfStepStatus();
0115 G4double GetTempInitVelocity();
0116 G4double GetTempVelocity();
0117 G4double GetMass();
0118 G4double GetsumEnergyChange();
0119 G4VParticleChange* GetfParticleChange();
0120 G4Track* GetfTrack();
0121 G4TrackVector* GetfSecondary();
0122 G4Step* GetfStep();
0123 G4StepPoint* GetfPreStepPoint();
0124 G4StepPoint* GetfPostStepPoint();
0125 G4VPhysicalVolume* GetfCurrentVolume();
0126 G4VSensitiveDetector* GetfSensitive();
0127 G4VProcess* GetfCurrentProcess();
0128 G4ProcessVector* GetfAtRestDoItVector();
0129 G4ProcessVector* GetfAlongStepDoItVector();
0130 G4ProcessVector* GetfPostStepDoItVector();
0131 G4ProcessVector* GetfAlongStepGetPhysIntVector();
0132 G4ProcessVector* GetfPostStepGetPhysIntVector();
0133 G4ProcessVector* GetfAtRestGetPhysIntVector();
0134 G4double GetcurrentMinimumStep();
0135 G4double GetnumberOfInteractionLengthLeft();
0136 std::size_t GetfAtRestDoItProcTriggered();
0137 std::size_t GetfAlongStepDoItProcTriggered();
0138 std::size_t GetfPostStepDoItProcTriggered();
0139 G4int GetfN2ndariesAtRestDoIt();
0140 G4int GetfN2ndariesAlongStepDoIt();
0141 G4int GetfN2ndariesPostStepDoIt();
0142 G4Navigator* GetfNavigator();
0143 G4int GetverboseLevel();
0144 std::size_t GetMAXofAtRestLoops();
0145 std::size_t GetMAXofAlongStepLoops();
0146 std::size_t GetMAXofPostStepLoops();
0147 G4SelectedAtRestDoItVector* GetfSelectedAtRestDoItVector();
0148 G4SelectedAlongStepDoItVector* GetfSelectedAlongStepDoItVector();
0149 G4SelectedPostStepDoItVector* GetfSelectedPostStepDoItVector();
0150 G4double GetfPreviousStepSize();
0151 const G4TouchableHandle& GetTouchableHandle();
0152 G4SteppingControl GetStepControlFlag();
0153 G4UserSteppingAction* GetUserAction();
0154 G4double GetphysIntLength();
0155 G4ForceCondition GetfCondition();
0156 G4GPILSelection GetfGPILSelection();
0157
0158 private:
0159
0160
0161
0162
0163
0164 void DefinePhysicalStepLength();
0165
0166 void InvokeAtRestDoItProcs();
0167 void InvokeAlongStepDoItProcs();
0168 void InvokePostStepDoItProcs();
0169 void InvokePSDIP(size_t);
0170 G4int ProcessSecondariesFromParticleChange();
0171
0172
0173 G4double CalculateSafety();
0174
0175
0176
0177 static const size_t SizeOfSelectedDoItVector = 100;
0178
0179 G4bool KillVerbose = false;
0180
0181 G4UserSteppingAction* fUserSteppingAction = nullptr;
0182
0183 G4VSteppingVerbose* fVerbose = nullptr;
0184
0185 G4double PhysicalStep = 0.0;
0186 G4double GeometricalStep = 0.0;
0187 G4double CorrectedStep = 0.0;
0188 G4bool PreStepPointIsGeom = false;
0189 G4bool FirstStep = false;
0190 G4StepStatus fStepStatus = fUndefined;
0191
0192 G4double TempInitVelocity = 0.0;
0193 G4double TempVelocity = 0.0;
0194 G4double Mass = 0.0;
0195
0196 G4double sumEnergyChange = 0.0;
0197
0198 G4VParticleChange* fParticleChange = nullptr;
0199 G4Track* fTrack = nullptr;
0200 G4TrackVector* fSecondary = nullptr;
0201 G4Step* fStep = nullptr;
0202 G4StepPoint* fPreStepPoint = nullptr;
0203 G4StepPoint* fPostStepPoint = nullptr;
0204
0205 G4VPhysicalVolume* fCurrentVolume = nullptr;
0206 G4VSensitiveDetector* fSensitive = nullptr;
0207 G4VProcess* fCurrentProcess = nullptr;
0208
0209
0210 G4ProcessVector* fAtRestDoItVector = nullptr;
0211 G4ProcessVector* fAlongStepDoItVector = nullptr;
0212 G4ProcessVector* fPostStepDoItVector = nullptr;
0213
0214 G4ProcessVector* fAtRestGetPhysIntVector = nullptr;
0215 G4ProcessVector* fAlongStepGetPhysIntVector = nullptr;
0216 G4ProcessVector* fPostStepGetPhysIntVector = nullptr;
0217
0218 std::size_t MAXofAtRestLoops = 0;
0219 std::size_t MAXofAlongStepLoops = 0;
0220 std::size_t MAXofPostStepLoops = 0;
0221
0222 std::size_t fAtRestDoItProcTriggered = 0;
0223 std::size_t fAlongStepDoItProcTriggered = 0;
0224 std::size_t fPostStepDoItProcTriggered = 0;
0225
0226 G4int fN2ndariesAtRestDoIt = 0;
0227 G4int fN2ndariesAlongStepDoIt = 0;
0228 G4int fN2ndariesPostStepDoIt = 0;
0229
0230
0231
0232 G4Navigator* fNavigator = nullptr;
0233
0234 G4int verboseLevel = 0;
0235
0236 G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr;
0237 G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr;
0238 G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr;
0239
0240 G4double fPreviousStepSize = 0.0;
0241
0242 G4TouchableHandle fTouchableHandle;
0243
0244 G4SteppingControl StepControlFlag = NormalCondition;
0245
0246 G4double kCarTolerance = 0.0;
0247 G4double proposedSafety = 0.0;
0248 G4ThreeVector endpointSafOrigin;
0249 G4double endpointSafety = 0.0;
0250
0251 G4double physIntLength = 0.0;
0252 G4ForceCondition fCondition = InActivated;
0253 G4GPILSelection fGPILSelection = NotCandidateForSelection;
0254
0255
0256
0257
0258
0259 G4NoProcess const* fNoProcess = nullptr;
0260
0261 };
0262
0263
0264
0265
0266
0267
0268
0269 inline G4double G4SteppingManager::GetPhysicalStep() { return PhysicalStep; }
0270
0271 inline G4double G4SteppingManager::GetGeometricalStep() { return GeometricalStep; }
0272
0273 inline G4double G4SteppingManager::GetCorrectedStep() { return CorrectedStep; }
0274
0275 inline G4bool G4SteppingManager::GetPreStepPointIsGeom() { return PreStepPointIsGeom; }
0276
0277 inline G4bool G4SteppingManager::GetFirstStep() { return FirstStep; }
0278
0279 inline G4StepStatus G4SteppingManager::GetfStepStatus() { return fStepStatus; }
0280
0281 inline G4double G4SteppingManager::GetTempInitVelocity() { return TempInitVelocity; }
0282
0283 inline G4double G4SteppingManager::GetTempVelocity() { return TempVelocity; }
0284
0285 inline G4double G4SteppingManager::GetMass() { return Mass; }
0286
0287 inline G4double G4SteppingManager::GetsumEnergyChange() { return sumEnergyChange; }
0288
0289 inline G4VParticleChange* G4SteppingManager::GetfParticleChange() { return fParticleChange; }
0290
0291 inline G4Track* G4SteppingManager::GetfTrack() { return fTrack; }
0292
0293 inline G4TrackVector* G4SteppingManager::GetfSecondary() { return fStep->GetfSecondary(); }
0294
0295 inline G4Step* G4SteppingManager::GetfStep() { return fStep; }
0296
0297 inline G4StepPoint* G4SteppingManager::GetfPreStepPoint() { return fPreStepPoint; }
0298
0299 inline G4StepPoint* G4SteppingManager::GetfPostStepPoint() { return fPostStepPoint; }
0300
0301 inline G4VPhysicalVolume* G4SteppingManager::GetfCurrentVolume() { return fCurrentVolume; }
0302
0303 inline G4VSensitiveDetector* G4SteppingManager::GetfSensitive() { return fSensitive; }
0304
0305 inline G4VProcess* G4SteppingManager::GetfCurrentProcess() { return fCurrentProcess; }
0306
0307 inline G4ProcessVector* G4SteppingManager::GetfAtRestDoItVector() { return fAtRestDoItVector; }
0308
0309 inline G4ProcessVector* G4SteppingManager::GetfAlongStepDoItVector()
0310 {
0311 return fAlongStepDoItVector;
0312 }
0313
0314 inline G4ProcessVector* G4SteppingManager::GetfPostStepDoItVector() { return fPostStepDoItVector; }
0315
0316 inline G4ProcessVector* G4SteppingManager::GetfAtRestGetPhysIntVector()
0317 {
0318 return fAtRestGetPhysIntVector;
0319 }
0320
0321 inline G4ProcessVector* G4SteppingManager::GetfAlongStepGetPhysIntVector()
0322 {
0323 return fAlongStepGetPhysIntVector;
0324 }
0325
0326 inline G4ProcessVector* G4SteppingManager::GetfPostStepGetPhysIntVector()
0327 {
0328 return fPostStepGetPhysIntVector;
0329 }
0330
0331 inline size_t G4SteppingManager::GetMAXofAtRestLoops() { return MAXofAtRestLoops; }
0332
0333 inline size_t G4SteppingManager::GetMAXofAlongStepLoops() { return MAXofAlongStepLoops; }
0334
0335 inline size_t G4SteppingManager::GetMAXofPostStepLoops() { return MAXofPostStepLoops; }
0336
0337 inline size_t G4SteppingManager::GetfAtRestDoItProcTriggered() { return fAtRestDoItProcTriggered; }
0338
0339 inline size_t G4SteppingManager::GetfAlongStepDoItProcTriggered()
0340 {
0341 return fAtRestDoItProcTriggered;
0342 }
0343
0344 inline size_t G4SteppingManager::GetfPostStepDoItProcTriggered()
0345 {
0346 return fPostStepDoItProcTriggered;
0347 }
0348
0349 inline G4int G4SteppingManager::GetfN2ndariesAtRestDoIt() { return fN2ndariesAtRestDoIt; }
0350
0351 inline G4int G4SteppingManager::GetfN2ndariesAlongStepDoIt() { return fN2ndariesAlongStepDoIt; }
0352
0353 inline G4int G4SteppingManager::GetfN2ndariesPostStepDoIt() { return fN2ndariesPostStepDoIt; }
0354
0355 inline G4Navigator* G4SteppingManager::GetfNavigator() { return fNavigator; }
0356
0357 inline G4int G4SteppingManager::GetverboseLevel() { return verboseLevel; }
0358
0359 inline G4SelectedAtRestDoItVector* G4SteppingManager::GetfSelectedAtRestDoItVector()
0360 {
0361 return fSelectedAtRestDoItVector;
0362 }
0363
0364 inline G4SelectedAlongStepDoItVector* G4SteppingManager::GetfSelectedAlongStepDoItVector()
0365 {
0366 return fSelectedAlongStepDoItVector;
0367 }
0368
0369 inline G4SelectedPostStepDoItVector* G4SteppingManager::GetfSelectedPostStepDoItVector()
0370 {
0371 return fSelectedPostStepDoItVector;
0372 }
0373
0374 inline G4double G4SteppingManager::GetfPreviousStepSize() { return fPreviousStepSize; }
0375
0376 inline const G4TouchableHandle& G4SteppingManager::GetTouchableHandle() { return fTouchableHandle; }
0377
0378 inline G4SteppingControl G4SteppingManager::GetStepControlFlag() { return StepControlFlag; }
0379
0380 inline G4double G4SteppingManager::GetphysIntLength() { return physIntLength; }
0381
0382 inline G4ForceCondition G4SteppingManager::GetfCondition() { return fCondition; }
0383
0384 inline G4GPILSelection G4SteppingManager::GetfGPILSelection() { return fGPILSelection; }
0385
0386 inline const G4TrackVector* G4SteppingManager::GetSecondary() const
0387 {
0388 return fStep->GetSecondary();
0389 }
0390
0391 inline void G4SteppingManager::SetNavigator(G4Navigator* value) { fNavigator = value; }
0392
0393 inline void G4SteppingManager::SetUserAction(G4UserSteppingAction* apAction)
0394 {
0395 fUserSteppingAction = apAction;
0396 }
0397
0398 inline G4UserSteppingAction* G4SteppingManager::GetUserAction() { return fUserSteppingAction; }
0399
0400 inline G4Track* G4SteppingManager::GetTrack() const { return fTrack; }
0401
0402 inline void G4SteppingManager::SetVerboseLevel(G4int vLevel) { verboseLevel = vLevel; }
0403
0404 inline void G4SteppingManager::SetVerbose(G4VSteppingVerbose* yourVerbose)
0405 {
0406 fVerbose = yourVerbose;
0407 }
0408
0409 inline G4Step* G4SteppingManager::GetStep() const { return fStep; }
0410
0411 inline G4double G4SteppingManager::CalculateSafety()
0412 {
0413 return std::max(
0414 endpointSafety - (endpointSafOrigin - fPostStepPoint->GetPosition()).mag(), kCarTolerance);
0415 }
0416
0417 #endif