File indexing completed on 2025-02-23 09:22:12
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 #include "SteppingAction.hh"
0039
0040
0041 #include "CommandLineParser.hh"
0042
0043 #include "G4AnalysisManager.hh"
0044
0045 #include <G4SystemOfUnits.hh>
0046 #include <G4Track.hh>
0047 #include <G4VProcess.hh>
0048 #include <globals.hh>
0049
0050 using namespace G4DNAPARSER;
0051
0052
0053
0054 SteppingAction::SteppingAction() : G4UserSteppingAction() {}
0055
0056
0057
0058 SteppingAction::~SteppingAction() {}
0059
0060
0061
0062 void SteppingAction::UserSteppingAction(const G4Step* step)
0063 {
0064 G4double flagParticle = 0.;
0065 G4double flagProcess = 0.;
0066 G4double flagVolume = 0.;
0067 G4double x, y, z, xp, yp, zp;
0068 G4double dE;
0069
0070 dE = step->GetTotalEnergyDeposit() / eV;
0071
0072 const G4String& particleName =
0073 step->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();
0074
0075 const G4String& processName = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
0076
0077 const G4String& volumeName = step->GetPreStepPoint()->GetPhysicalVolume()->GetName();
0078
0079 if (particleName == "e-")
0080 flagParticle = 10;
0081 else if (particleName == "proton")
0082 flagParticle = 20;
0083 else if (particleName == "hydrogen")
0084 flagParticle = 30;
0085 else if (particleName == "alpha")
0086 flagParticle = 40;
0087 else if (particleName == "alpha+")
0088 flagParticle = 50;
0089 else if (particleName == "helium")
0090 flagParticle = 60;
0091
0092 if (processName == "e-_G4DNAElastic")
0093 flagProcess = 11;
0094 else if (processName == "e-_G4DNAExcitation")
0095 flagProcess = 12;
0096 else if (processName == "e-_G4DNAIonisation")
0097 flagProcess = 13;
0098 else if (processName == "e-_G4DNAAttachment")
0099 flagProcess = 14;
0100 else if (processName == "e-_G4DNAVibExcitation")
0101 flagProcess = 15;
0102 else if (processName == "eCapture")
0103 flagProcess = 16;
0104
0105
0106
0107 else if (processName == "proton_G4DNAExcitation")
0108 flagProcess = 21;
0109 else if (processName == "proton_G4DNAIonisation")
0110 flagProcess = 22;
0111 else if (processName == "proton_G4DNAChargeDecrease")
0112 flagProcess = 23;
0113
0114 else if (processName == "hydrogen_G4DNAExcitation")
0115 flagProcess = 31;
0116 else if (processName == "hydrogen_G4DNAIonisation")
0117 flagProcess = 32;
0118 else if (processName == "hydrogen_G4DNAChargeIncrease")
0119 flagProcess = 33;
0120
0121 else if (processName == "alpha_G4DNAExcitation")
0122 flagProcess = 41;
0123 else if (processName == "alpha_G4DNAIonisation")
0124 flagProcess = 42;
0125 else if (processName == "alpha_G4DNAChargeDecrease")
0126 flagProcess = 43;
0127
0128 else if (processName == "alpha+_G4DNAExcitation")
0129 flagProcess = 51;
0130 else if (processName == "alpha+_G4DNAIonisation")
0131 flagProcess = 52;
0132 else if (processName == "alpha+_G4DNAChargeDecrease")
0133 flagProcess = 53;
0134 else if (processName == "alpha+_G4DNAChargeIncrease")
0135 flagProcess = 54;
0136
0137 else if (processName == "helium_G4DNAExcitation")
0138 flagProcess = 61;
0139 else if (processName == "helium_G4DNAIonisation")
0140 flagProcess = 62;
0141 else if (processName == "helium_G4DNAChargeIncrease")
0142 flagProcess = 63;
0143
0144
0145
0146
0147
0148
0149 if (volumeName == "physi sugar 2")
0150 flagVolume = 1;
0151 else if (volumeName == "physi sugar 4")
0152 flagVolume = 2;
0153
0154 if (flagVolume != 0 && dE != 0) {
0155 x = step->GetPreStepPoint()->GetPosition().x() / nanometer;
0156 y = step->GetPreStepPoint()->GetPosition().y() / nanometer;
0157 z = step->GetPreStepPoint()->GetPosition().z() / nanometer;
0158 xp = step->GetPostStepPoint()->GetPosition().x() / nanometer;
0159 yp = step->GetPostStepPoint()->GetPosition().y() / nanometer;
0160 zp = step->GetPostStepPoint()->GetPosition().z() / nanometer;
0161
0162
0163
0164
0165 CommandLineParser* parser = CommandLineParser::GetParser();
0166 Command* command(0);
0167 if ((command = parser->GetCommandIfActive("-out")) == 0) return;
0168
0169
0170 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0171
0172 analysisManager->FillNtupleDColumn(0, flagParticle);
0173 analysisManager->FillNtupleDColumn(1, flagProcess);
0174 analysisManager->FillNtupleDColumn(2, flagVolume);
0175 analysisManager->FillNtupleDColumn(3, xp);
0176 analysisManager->FillNtupleDColumn(4, yp);
0177 analysisManager->FillNtupleDColumn(5, zp);
0178 analysisManager->FillNtupleDColumn(6, dE);
0179 analysisManager->FillNtupleDColumn(
0180 7, std::sqrt((x - xp) * (x - xp) + (y - yp) * (y - yp) + (z - zp) * (z - zp)));
0181
0182 analysisManager->AddNtupleRow();
0183 }
0184 }