File indexing completed on 2025-02-23 09:20:53
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 #include "SteppingAction.hh"
0034
0035 #include "HistoManager.hh"
0036 #include "Run.hh"
0037
0038 #include "G4RunManager.hh"
0039
0040
0041
0042 void SteppingAction::UserSteppingAction(const G4Step* aStep)
0043 {
0044 const G4StepPoint* endPoint = aStep->GetPostStepPoint();
0045 G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
0046
0047 Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
0048
0049 G4bool transmit = (endPoint->GetStepStatus() <= fGeomBoundary);
0050 if (transmit) {
0051 run->CountProcesses(procName);
0052 }
0053 else {
0054
0055 G4double stepLength = aStep->GetStepLength();
0056 run->CountProcesses(procName);
0057 run->SumTrack(stepLength);
0058 }
0059
0060
0061
0062 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0063
0064
0065
0066 G4int id = 1;
0067 if (aStep->GetTrack()->GetTrackStatus() == fAlive) {
0068 G4double energy = endPoint->GetKineticEnergy();
0069 analysisManager->FillH1(id, energy);
0070
0071 id = 2;
0072 G4ThreeVector direction = endPoint->GetMomentumDirection();
0073 G4double costeta = direction.x();
0074 analysisManager->FillH1(id, costeta);
0075 }
0076
0077
0078
0079 const std::vector<const G4Track*>* secondary = aStep->GetSecondaryInCurrentStep();
0080 for (size_t lp = 0; lp < (*secondary).size(); lp++) {
0081 G4double charge = (*secondary)[lp]->GetDefinition()->GetPDGCharge();
0082 if (charge != 0.) {
0083 id = 3;
0084 }
0085 else {
0086 id = 5;
0087 }
0088 G4double energy = (*secondary)[lp]->GetKineticEnergy();
0089 analysisManager->FillH1(id, energy);
0090
0091 ++id;
0092 G4ThreeVector direction = (*secondary)[lp]->GetMomentumDirection();
0093 G4double costeta = direction.x();
0094 analysisManager->FillH1(id, costeta);
0095
0096
0097 if (charge != 0.) {
0098 run->SumeTransf(energy);
0099 }
0100 }
0101
0102
0103
0104 G4RunManager::GetRunManager()->AbortEvent();
0105 }
0106
0107