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