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