File indexing completed on 2026-06-01 07:54:55
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 #include "SteppingAction.hh"
0041
0042 #include "G4Alpha.hh"
0043 #include "G4AnalysisManager.hh"
0044 #include "G4DNAGenericIonsManager.hh"
0045 #include "G4Electron.hh"
0046 #include "G4EventManager.hh"
0047 #include "G4Gamma.hh"
0048 #include "G4Proton.hh"
0049 #include "G4SystemOfUnits.hh"
0050
0051
0052
0053 SteppingAction::SteppingAction() : G4UserSteppingAction() {}
0054
0055
0056
0057 SteppingAction::~SteppingAction() {}
0058
0059
0060
0061 void SteppingAction::UserSteppingAction(const G4Step* step)
0062 {
0063
0064 if (!step->GetPostStepPoint()) return;
0065 if (!step->GetPostStepPoint()->GetProcessDefinedStep()) return;
0066
0067
0068 G4double flagParticle = -1.;
0069 G4double flagProcess = -1.;
0070 G4double x, y, z, xp, yp, zp;
0071
0072
0073
0074
0075
0076 G4ParticleDefinition* partDef = step->GetTrack()->GetDynamicParticle()->GetDefinition();
0077
0078 if (partDef == G4Gamma::GammaDefinition()) flagParticle = 0;
0079
0080 if (partDef == G4Electron::ElectronDefinition()) flagParticle = 1;
0081
0082 if (partDef == G4Proton::ProtonDefinition()) flagParticle = 2;
0083
0084 if (partDef == G4Alpha::AlphaDefinition()) flagParticle = 4;
0085
0086 G4DNAGenericIonsManager* instance;
0087 instance = G4DNAGenericIonsManager::Instance();
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 if (partDef == instance->GetIon("hydrogen")) flagParticle = 3;
0099
0100 if (partDef == instance->GetIon("alpha+")) flagParticle = 5;
0101
0102 if (partDef == instance->GetIon("helium")) flagParticle = 6;
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 G4StepPoint* preStep = step->GetPreStepPoint();
0125 G4StepPoint* postStep = step->GetPostStepPoint();
0126 G4int procID = postStep->GetProcessDefinedStep()->GetProcessSubType();
0127
0128 const G4String& processName = postStep->GetProcessDefinedStep()->GetProcessName();
0129
0130 if (processName == "Capture") flagProcess = 1;
0131
0132
0133 else if (flagParticle == 0) {
0134 if (procID == 12)
0135 flagProcess = 81;
0136 else if (procID == 13)
0137 flagProcess = 82;
0138 else if (procID == 14)
0139 flagProcess = 83;
0140 else if (procID == 11)
0141 flagProcess = 84;
0142 }
0143
0144 else if (flagParticle == 1) {
0145 if (procID == 58)
0146 flagProcess = 10;
0147 else if (procID == 51)
0148 flagProcess = 11;
0149 else if (procID == 52)
0150 flagProcess = 12;
0151 else if (procID == 53)
0152 flagProcess = 13;
0153 else if (procID == 55)
0154 flagProcess = 14;
0155 else if (procID == 54)
0156 flagProcess = 15;
0157 else if (procID == 10)
0158 flagProcess = 110;
0159 else if (procID == 1)
0160 flagProcess = 120;
0161 else if (procID == 2)
0162 flagProcess = 130;
0163 }
0164
0165 else if (flagParticle == 2) {
0166 if (procID == 51)
0167 flagProcess = 21;
0168 else if (procID == 52)
0169 flagProcess = 22;
0170 else if (procID == 53)
0171 flagProcess = 23;
0172 else if (procID == 56)
0173 flagProcess = 24;
0174 else if (procID == 10)
0175 flagProcess = 210;
0176 else if (procID == 1)
0177 flagProcess = 220;
0178 else if (procID == 2)
0179 flagProcess = 230;
0180 else if (procID == 8)
0181 flagProcess = 240;
0182 }
0183
0184 else if (flagParticle == 3) {
0185 if (procID == 51)
0186 flagProcess = 31;
0187 else if (procID == 52)
0188 flagProcess = 32;
0189 else if (procID == 53)
0190 flagProcess = 33;
0191 else if (procID == 57)
0192 flagProcess = 35;
0193 }
0194
0195 else if (flagParticle == 4) {
0196 if (procID == 51)
0197 flagProcess = 41;
0198 else if (procID == 52)
0199 flagProcess = 42;
0200 else if (procID == 53)
0201 flagProcess = 43;
0202 else if (procID == 56)
0203 flagProcess = 44;
0204 else if (procID == 10)
0205 flagProcess = 410;
0206 else if (procID == 1)
0207 flagProcess = 420;
0208 else if (procID == 2)
0209 flagProcess = 430;
0210 else if (procID == 8)
0211 flagProcess = 440;
0212 }
0213
0214 else if (flagParticle == 5) {
0215 if (procID == 51)
0216 flagProcess = 51;
0217 else if (procID == 52)
0218 flagProcess = 52;
0219 else if (procID == 53)
0220 flagProcess = 53;
0221 else if (procID == 56)
0222 flagProcess = 54;
0223 else if (procID == 57)
0224 flagProcess = 55;
0225 else if (procID == 10)
0226 flagProcess = 510;
0227 else if (procID == 1)
0228 flagProcess = 520;
0229 else if (procID == 2)
0230 flagProcess = 530;
0231 else if (procID == 8)
0232 flagProcess = 540;
0233 }
0234
0235 else if (flagParticle == 6) {
0236 if (procID == 51)
0237 flagProcess = 61;
0238 else if (procID == 52)
0239 flagProcess = 62;
0240 else if (procID == 53)
0241 flagProcess = 63;
0242 else if (procID == 57)
0243 flagProcess = 65;
0244 }
0245
0246 else if (processName == "GenericIon_G4DNAIonisation")
0247 flagProcess = 73;
0248 else if (processName == "msc")
0249 flagProcess = 710;
0250 else if (processName == "CoulombScat")
0251 flagProcess = 720;
0252 else if (processName == "ionIoni")
0253 flagProcess = 730;
0254 else if (processName == "nuclearStopping")
0255 flagProcess = 740;
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 if (processName != "Transportation") {
0299 x = preStep->GetPosition().x() / nanometer;
0300 y = preStep->GetPosition().y() / nanometer;
0301 z = preStep->GetPosition().z() / nanometer;
0302
0303 xp = postStep->GetPosition().x() / nanometer;
0304 yp = postStep->GetPosition().y() / nanometer;
0305 zp = postStep->GetPosition().z() / nanometer;
0306
0307
0308
0309 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0310
0311
0312 analysisManager->FillNtupleDColumn(0, flagParticle);
0313 analysisManager->FillNtupleDColumn(1, flagProcess);
0314 analysisManager->FillNtupleDColumn(2, xp);
0315 analysisManager->FillNtupleDColumn(3, yp);
0316 analysisManager->FillNtupleDColumn(4, zp);
0317 analysisManager->FillNtupleDColumn(5, step->GetTotalEnergyDeposit() / eV);
0318
0319 analysisManager->FillNtupleDColumn(
0320 6, std::sqrt((x - xp) * (x - xp) + (y - yp) * (y - yp) + (z - zp) * (z - zp)));
0321
0322 analysisManager->FillNtupleDColumn(
0323 7, (preStep->GetKineticEnergy() - postStep->GetKineticEnergy()) / eV);
0324
0325 analysisManager->FillNtupleDColumn(8, preStep->GetKineticEnergy() / eV);
0326
0327 analysisManager->FillNtupleDColumn(9, preStep->GetMomentumDirection()
0328 * postStep->GetMomentumDirection());
0329
0330 analysisManager->FillNtupleIColumn(
0331 10, G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID());
0332
0333 analysisManager->FillNtupleIColumn(11, step->GetTrack()->GetTrackID());
0334
0335 analysisManager->FillNtupleIColumn(12, step->GetTrack()->GetParentID());
0336
0337 analysisManager->FillNtupleIColumn(13, step->GetTrack()->GetCurrentStepNumber());
0338
0339 analysisManager->AddNtupleRow();
0340 }
0341 }