Warning, file /geant4/examples/advanced/dna/dsbandrepair/src/SteppingAction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "SteppingAction.hh"
0033 #include "Analysis.hh"
0034 #include "G4SteppingManager.hh"
0035 #include "G4VTouchable.hh"
0036 #include "G4VPhysicalVolume.hh"
0037 #include "G4RunManager.hh"
0038 #include "G4LogicalVolumeStore.hh"
0039 #include "G4SteppingManager.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4Track.hh"
0042 #include "G4RunManager.hh"
0043 #include "G4Proton.hh"
0044 #include "G4Electron.hh"
0045 #include "G4Alpha.hh"
0046 #include "G4DNAGenericIonsManager.hh"
0047
0048 #ifdef USE_MPI
0049 #include "G4MPImanager.hh"
0050 #endif
0051
0052
0053
0054 SteppingAction::SteppingAction(EventAction* pEvent)
0055 {
0056 fEventAction = pEvent;
0057 }
0058
0059
0060
0061 void SteppingAction::UserSteppingAction(const G4Step* step)
0062 {
0063 SetupFlags(step);
0064
0065 SetupVoxelCopyNumber(step);
0066
0067 if(fFlagVolume>0)
0068 {
0069 fEventAction->AddEdep(step->GetTotalEnergyDeposit()/eV);
0070 }
0071
0072
0073 if(fFlagVolume == 1
0074 || fFlagVolume == 11
0075 || fFlagVolume == 2
0076 || fFlagVolume == 22
0077 || fFlagVolume == 3
0078 || fFlagVolume == 4
0079 || fFlagVolume == 5
0080 || fFlagVolume == 6
0081 || fFlagVolume == 7
0082 || fFlagVolume == 71
0083 || fFlagVolume == 8
0084 || fFlagVolume == 81
0085 || fFlagVolume == 9
0086 || fFlagVolume == 10
0087 || fFlagVolume == 13
0088 || fFlagVolume == 12)
0089 {
0090
0091
0092
0093 if(step->GetPostStepPoint()->GetTouchable()->GetVolume() )
0094 {
0095 G4double x=step->GetPreStepPoint()->GetPosition().x()/nanometer;
0096 G4double y=step->GetPreStepPoint()->GetPosition().y()/nanometer;
0097 G4double z=step->GetPreStepPoint()->GetPosition().z()/nanometer;
0098
0099 G4double dE = step->GetTotalEnergyDeposit()/eV;
0100 G4double copyNo = G4double (step->GetPreStepPoint()->GetTouchable()->GetVolume()->GetCopyNo() );
0101
0102 G4int eventId = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
0103 #ifdef USE_MPI
0104 auto g4MPI = G4MPImanager::GetManager();
0105 if (g4MPI->IsSlave()) {
0106 G4int rank = g4MPI->GetRank();
0107 eventId += g4MPI->GetEventsInMaster() + (rank-1)*g4MPI->GetEventsInSlave();
0108 }
0109 #endif
0110
0111
0112
0113 InfoInPhysStage aInfo;
0114 aInfo.fFlagParticle = fFlagParticle;
0115 aInfo.fFlagParentID = fFlagParentID;
0116 aInfo.fFlagProcess = fFlagProcess;
0117 aInfo.fX = x;
0118 aInfo.fY = y;
0119 aInfo.fZ = z;
0120 aInfo.fEdep = dE;
0121 aInfo.fEventNumber = eventId;
0122 aInfo.fVolumeName = fFlagVolume;
0123 aInfo.fCopyNumber = copyNo;
0124 aInfo.fLastMetVoxelCopyNum = fLastMetVoxelCopyNumber;
0125 Analysis::GetAnalysis()->AddInfoInPhysStage(aInfo);
0126 }
0127 }
0128 }
0129
0130
0131
0132 void SteppingAction::SetupFlags(const G4Step* step)
0133 {
0134 fFlagParticle=0;
0135 fFlagProcess=0;
0136 fFlagParentID=0;
0137 fFlagVolume=0;
0138
0139 fFlagParentID = step->GetTrack()->GetParentID();
0140
0141 SetupParticleAndProcessFlags(step);
0142
0143 fFlagVolume = SetupVolumeFlag(step->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName() );
0144 }
0145
0146
0147
0148 void SteppingAction::SetupParticleAndProcessFlags(const G4Step *step)
0149 {
0150 fFlagParticle = 0;
0151 fFlagProcess = 0;
0152 auto partDef = step->GetTrack()->GetDynamicParticle()->GetDefinition();
0153 auto* instance = G4DNAGenericIonsManager::Instance();
0154
0155 if (partDef == G4Electron::ElectronDefinition()) fFlagParticle = 1;
0156 if (partDef == G4Proton::ProtonDefinition()) fFlagParticle = 2;
0157 if (partDef == instance->GetIon("hydrogen")) fFlagParticle = 3;
0158 if (partDef == G4Alpha::AlphaDefinition()) fFlagParticle = 4;
0159 if (partDef == instance->GetIon("alpha+")) fFlagParticle = 5;
0160 if (partDef == instance->GetIon("helium")) fFlagParticle = 6;
0161
0162 G4int procSubtype = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessSubType();
0163
0164
0165 if (fFlagParticle == 1) {
0166 if (procSubtype == 58) fFlagProcess = 10;
0167 if (procSubtype == 51) fFlagProcess = 11;
0168 if (procSubtype == 52) fFlagProcess = 12;
0169 if (procSubtype == 53) fFlagProcess = 13;
0170 if (procSubtype == 55) fFlagProcess = 14;
0171 if (procSubtype == 54) fFlagProcess = 15;
0172 }
0173
0174 if (fFlagParticle == 2) {
0175 if (procSubtype == 52) fFlagProcess = 17;
0176 if (procSubtype == 53) fFlagProcess = 18;
0177 if (procSubtype == 56) fFlagProcess = 19;
0178 }
0179
0180 if (fFlagParticle == 3) {
0181 if (procSubtype == 52) fFlagProcess = 20;
0182 if (procSubtype == 53) fFlagProcess = 21;
0183 if (procSubtype == 57) fFlagProcess = 22;
0184 }
0185
0186 if (fFlagParticle == 4) {
0187 if (procSubtype == 52) fFlagProcess = 23;
0188 if (procSubtype == 53) fFlagProcess = 24;
0189 if (procSubtype == 56) fFlagProcess = 25;
0190 }
0191
0192 if (fFlagParticle == 5) {
0193 if (procSubtype == 52) fFlagProcess = 26;
0194 if (procSubtype == 53) fFlagProcess = 27;
0195 if (procSubtype == 56) fFlagProcess = 28;
0196 if (procSubtype == 57) fFlagProcess = 29;
0197 }
0198
0199 if (fFlagParticle == 6) {
0200 if (procSubtype == 52) fFlagProcess = 30;
0201 if (procSubtype == 53) fFlagProcess = 31;
0202 if (procSubtype == 57) fFlagProcess = 32;
0203 }
0204
0205 }
0206
0207
0208
0209 G4int SteppingAction::SetupVolumeFlag(const G4String& volumeName)
0210 {
0211 G4int flagVolume(-1);
0212
0213 if(volumeName=="deoxyribose1_phys") flagVolume = 1;
0214 else if(volumeName=="phosphate1_phys") flagVolume = 11;
0215 else if(volumeName=="deoxyribose2_phys") flagVolume = 2;
0216 else if(volumeName=="phosphate2_phys") flagVolume = 22;
0217 else if(volumeName=="base_cytosine_phys") flagVolume = 3;
0218 else if(volumeName=="base_guanine_phys") flagVolume = 4;
0219 else if(volumeName=="base_thymine_phys") flagVolume = 5;
0220 else if(volumeName=="base_adenine_phys") flagVolume = 6;
0221 else if(volumeName=="deoxyribose1_water_phys") flagVolume = 7;
0222 else if(volumeName=="phosphate1_water_phys") flagVolume = 71;
0223 else if(volumeName=="deoxyribose2_water_phys") flagVolume = 8;
0224 else if(volumeName=="phosphate2_water_phys") flagVolume = 81;
0225 else if(volumeName=="base_adenine_water_phys") flagVolume = 9;
0226 else if(volumeName=="base_guanine_water_phys") flagVolume = 10;
0227 else if(volumeName=="base_cytosine_water_phys") flagVolume = 13;
0228 else if(volumeName=="base_thymine_water_phys") flagVolume = 12;
0229 else if(volumeName=="fiber") flagVolume = 110;
0230 else if(volumeName=="voxelStraight" || volumeName=="VoxelStraight") flagVolume = 161;
0231 else if(volumeName=="voxelRight" || volumeName=="VoxelRight") flagVolume = 162;
0232 else if(volumeName=="voxelLeft" || volumeName=="VoxelLeft") flagVolume = 163;
0233 else if(volumeName=="voxelUp" || volumeName=="VoxelUp") flagVolume = 164;
0234 else if(volumeName=="voxelDown" || volumeName=="VoxelDown") flagVolume = 165;
0235 else if(volumeName=="voxelStraight2" || volumeName=="VoxelStraight2") flagVolume = 261;
0236 else if(volumeName=="voxelRight2" || volumeName=="VoxelRight2") flagVolume = 262;
0237 else if(volumeName=="voxelLeft2" || volumeName=="VoxelLeft2") flagVolume = 263;
0238 else if(volumeName=="voxelUp2" || volumeName=="VoxelUp2") flagVolume = 264;
0239 else if(volumeName=="voxelDown2" || volumeName=="VoxelDown2") flagVolume = 265;
0240 else if(volumeName=="physWorld") flagVolume = -1.;
0241 else if(volumeName=="wrapper") flagVolume = 130;
0242 else if(volumeName=="histone_phys") flagVolume = 140;
0243 else if(volumeName=="nucleus_pl") flagVolume = 200;
0244 return flagVolume;
0245 }
0246
0247
0248
0249 void SteppingAction::SetupVoxelCopyNumber(const G4Step* step)
0250 {
0251
0252
0253
0254
0255 if(step->GetPostStepPoint()->GetTouchable()->GetVolume() )
0256 {
0257 const G4String& volPost = step->GetPostStepPoint()->GetTouchable()->GetVolume()->GetName();
0258
0259
0260 if( volPost == "VoxelStraight" || volPost=="voxelStraight"
0261 || volPost == "VoxelRight" || volPost=="voxelRight"
0262 || volPost == "VoxelLeft" || volPost=="voxelLeft"
0263 || volPost == "VoxelUp" || volPost=="voxelUp"
0264 || volPost == "VoxelDown" || volPost=="voxelDown"
0265 || volPost == "VoxelStraight2" || volPost=="voxelStraight2"
0266 || volPost == "VoxelRight2" || volPost=="voxelRight2"
0267 || volPost == "VoxelLeft2" || volPost=="voxelLeft2"
0268 || volPost == "VoxelUp2" || volPost=="voxelUp2"
0269 || volPost == "VoxelDown2" || volPost=="voxelDown2")
0270 {
0271 fLastMetVoxelCopyNumber = step->GetPostStepPoint()->GetTouchable()->GetCopyNumber();
0272 }
0273 }
0274 }
0275
0276
0277