File indexing completed on 2025-02-23 09:22:22
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 #include "OpNoviceSteppingAction.hh"
0031
0032 #include "OpNoviceRun.hh"
0033
0034 #include "G4Event.hh"
0035 #include "G4OpBoundaryProcess.hh"
0036 #include "G4OpticalPhoton.hh"
0037 #include "G4RunManager.hh"
0038 #include "G4Step.hh"
0039 #include "G4Track.hh"
0040
0041
0042
0043 OpNoviceSteppingAction::OpNoviceSteppingAction(OpNoviceEventAction* event)
0044 : G4UserSteppingAction(), fEventAction(event)
0045 {}
0046
0047
0048 void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
0049 {
0050 static G4ParticleDefinition* opticalphoton = G4OpticalPhoton::OpticalPhotonDefinition();
0051
0052 const G4ParticleDefinition* particleDef =
0053 step->GetTrack()->GetDynamicParticle()->GetParticleDefinition();
0054
0055 if (particleDef == opticalphoton) {
0056 G4StepPoint* endPoint = step->GetPostStepPoint();
0057 const G4VProcess* pds = endPoint->GetProcessDefinedStep();
0058 G4String procname = pds->GetProcessName();
0059 if (procname == "OpRayleigh")
0060 fEventAction->AddRayleigh();
0061 else if (procname == "OpAbsorption")
0062 fEventAction->AddAbsorption();
0063 else if (procname == "OpMieHG")
0064 fEventAction->AddMie();
0065
0066
0067
0068 if (endPoint->GetStepStatus() == fGeomBoundary) {
0069 G4OpBoundaryProcessStatus theStatus = Undefined;
0070 G4ProcessManager* opManager = opticalphoton->GetProcessManager();
0071 G4int n_proc = opManager->GetPostStepProcessVector(typeDoIt)->entries();
0072 G4ProcessVector* postStepDoItVector = opManager->GetPostStepProcessVector(typeDoIt);
0073 for (G4int i = 0; i < n_proc; ++i) {
0074 G4VProcess* currentProcess = (*postStepDoItVector)[i];
0075
0076 auto opProc = dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
0077 if (opProc) theStatus = opProc->GetStatus();
0078 }
0079 if (theStatus != Undefined && theStatus != NotAtBoundary && theStatus != StepTooSmall) {
0080 fEventAction->AddBoundary();
0081 }
0082 }
0083 }
0084 }
0085