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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/dna/dsbandrepair/src/SteppingAction.cc (Version 11.3.0) and /examples/advanced/dna/dsbandrepair/src/SteppingAction.cc (Version 6.0)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 /// \file SteppingAction.cc                       
 28 /// \brief Implementation of the SteppingActio    
 29 /// \file SteppingAction.cc                       
 30 /// \brief Implementation of the SteppingActio    
 31                                                   
 32 #include "SteppingAction.hh"                      
 33 #include "Analysis.hh"                            
 34 #include "G4SteppingManager.hh"                   
 35 #include "G4VTouchable.hh"                        
 36 #include "G4VPhysicalVolume.hh"                   
 37 #include "G4RunManager.hh"                        
 38 #include "G4LogicalVolumeStore.hh"                
 39 #include "G4SteppingManager.hh"                   
 40 #include "G4SystemOfUnits.hh"                     
 41 #include "G4Track.hh"                             
 42 #include "G4RunManager.hh"                        
 43 #include "G4Proton.hh"                            
 44 #include "G4Electron.hh"                          
 45 #include "G4Alpha.hh"                             
 46 #include "G4DNAGenericIonsManager.hh"             
 47                                                   
 48 #ifdef USE_MPI                                    
 49 #include "G4MPImanager.hh"                        
 50 #endif                                            
 51                                                   
 52 //....oooOO0OOooo........oooOO0OOooo........oo    
 53                                                   
 54 SteppingAction::SteppingAction(EventAction* pE    
 55 {                                                 
 56     fEventAction = pEvent;                        
 57 }                                                 
 58                                                   
 59 //....oooOO0OOooo........oooOO0OOooo........oo    
 60                                                   
 61 void SteppingAction::UserSteppingAction(const     
 62 {                                                 
 63     SetupFlags(step);                             
 64                                                   
 65     SetupVoxelCopyNumber(step);                   
 66                                                   
 67     if(fFlagVolume>0)                             
 68     {                                             
 69         fEventAction->AddEdep(step->GetTotalEn    
 70     }                                             
 71     //G4cout<<step->GetPreStepPoint()->GetTouc    
 72     // Check we are in a DNA volume               
 73     if(fFlagVolume == 1 // d1                     
 74             || fFlagVolume == 11 // p1            
 75             || fFlagVolume == 2 // d2             
 76             || fFlagVolume == 22 // p2            
 77             || fFlagVolume == 3 // cyto           
 78             || fFlagVolume == 4 // gua            
 79             || fFlagVolume == 5 // thy            
 80             || fFlagVolume == 6 // ade            
 81             || fFlagVolume == 7 // d1_w           
 82             || fFlagVolume == 71 // p1_w          
 83             || fFlagVolume == 8 // d2_w           
 84             || fFlagVolume == 81 // p2_w          
 85             || fFlagVolume == 9 // ade_w          
 86             || fFlagVolume == 10 // gua_w         
 87             || fFlagVolume == 13 // cyto_w        
 88             || fFlagVolume == 12) // thy_w        
 89     {                                             
 90         // ***********************************    
 91         // Saving physical stage informations     
 92         // ***********************************    
 93         if(step->GetPostStepPoint()->GetToucha    
 94         {                                         
 95             G4double x=step->GetPreStepPoint()    
 96             G4double y=step->GetPreStepPoint()    
 97             G4double z=step->GetPreStepPoint()    
 98                                                   
 99             G4double dE = step->GetTotalEnergy    
100             G4double copyNo = G4double (step->    
101                                                   
102             G4int eventId = G4RunManager::GetR    
103 #ifdef USE_MPI                                    
104             auto g4MPI = G4MPImanager::GetMana    
105             if (g4MPI->IsSlave()) { // update     
106                 G4int rank = g4MPI->GetRank();    
107                 eventId += g4MPI->GetEventsInM    
108             }                                     
109 #endif                                            
110             // ***************************        
111             // put to vector                      
112             // ***************************        
113             InfoInPhysStage aInfo;                
114             aInfo.fFlagParticle = fFlagParticl    
115             aInfo.fFlagParentID = fFlagParentI    
116             aInfo.fFlagProcess = fFlagProcess;    
117             aInfo.fX = x;                         
118             aInfo.fY = y;                         
119             aInfo.fZ = z;                         
120             aInfo.fEdep = dE;                     
121             aInfo.fEventNumber = eventId;         
122             aInfo.fVolumeName = fFlagVolume;      
123             aInfo.fCopyNumber = copyNo;           
124             aInfo.fLastMetVoxelCopyNum = fLast    
125             Analysis::GetAnalysis()->AddInfoIn    
126         }                                         
127     }                                             
128 }                                                 
129                                                   
130 //....oooOO0OOooo........oooOO0OOooo........oo    
131                                                   
132 void SteppingAction::SetupFlags(const G4Step*     
133 {                                                 
134     fFlagParticle=0;                              
135     fFlagProcess=0;                               
136     fFlagParentID=0;                              
137     fFlagVolume=0;                                
138                                                   
139     fFlagParentID = step->GetTrack()->GetParen    
140                                                   
141     SetupParticleAndProcessFlags(step);           
142                                                   
143     fFlagVolume = SetupVolumeFlag(step->GetPre    
144 }                                                 
145                                                   
146 //....oooOO0OOooo........oooOO0OOooo........oo    
147                                                   
148 void SteppingAction::SetupParticleAndProcessFl    
149 {                                                 
150     fFlagParticle = 0;                            
151     fFlagProcess = 0;                             
152     auto partDef = step->GetTrack()->GetDynami    
153     auto* instance = G4DNAGenericIonsManager::    
154                                                   
155     if (partDef == G4Electron::ElectronDefinit    
156     if (partDef == G4Proton::ProtonDefinition(    
157     if (partDef == instance->GetIon("hydrogen"    
158     if (partDef == G4Alpha::AlphaDefinition())    
159     if (partDef == instance->GetIon("alpha+"))    
160     if (partDef == instance->GetIon("helium"))    
161                                                   
162     G4int procSubtype = step->GetPostStepPoint    
163                                                   
164                                                   
165     if (fFlagParticle == 1) { // e-               
166         if (procSubtype == 58) fFlagProcess =     
167         if (procSubtype == 51) fFlagProcess =     
168         if (procSubtype == 52) fFlagProcess =     
169         if (procSubtype == 53) fFlagProcess =     
170         if (procSubtype == 55) fFlagProcess =     
171         if (procSubtype == 54) fFlagProcess =     
172     }                                             
173                                                   
174     if (fFlagParticle == 2) { // Proton           
175         if (procSubtype == 52) fFlagProcess =     
176         if (procSubtype == 53) fFlagProcess =     
177         if (procSubtype == 56) fFlagProcess =     
178     }                                             
179                                                   
180     if (fFlagParticle == 3) { // hydrogen         
181         if (procSubtype == 52) fFlagProcess =     
182         if (procSubtype == 53) fFlagProcess =     
183         if (procSubtype == 57) fFlagProcess =     
184     }                                             
185                                                   
186     if (fFlagParticle == 4) { // alpha            
187         if (procSubtype == 52) fFlagProcess =     
188         if (procSubtype == 53) fFlagProcess =     
189         if (procSubtype == 56) fFlagProcess =     
190     }                                             
191                                                   
192     if (fFlagParticle == 5) { // alpha+           
193         if (procSubtype == 52) fFlagProcess =     
194         if (procSubtype == 53) fFlagProcess =     
195         if (procSubtype == 56) fFlagProcess =     
196         if (procSubtype == 57) fFlagProcess =     
197     }                                             
198                                                   
199     if (fFlagParticle == 6) { // helium           
200         if (procSubtype == 52) fFlagProcess =     
201         if (procSubtype == 53) fFlagProcess =     
202         if (procSubtype == 57) fFlagProcess =     
203     }                                             
204                                                   
205 }                                                 
206                                                   
207 //....oooOO0OOooo........oooOO0OOooo........oo    
208                                                   
209 G4int SteppingAction::SetupVolumeFlag(const G4    
210 {                                                 
211     G4int flagVolume(-1);                         
212                                                   
213     if(volumeName=="deoxyribose1_phys") flagVo    
214     else if(volumeName=="phosphate1_phys") fla    
215     else if(volumeName=="deoxyribose2_phys") f    
216     else if(volumeName=="phosphate2_phys") fla    
217     else if(volumeName=="base_cytosine_phys")     
218     else if(volumeName=="base_guanine_phys") f    
219     else if(volumeName=="base_thymine_phys") f    
220     else if(volumeName=="base_adenine_phys") f    
221     else if(volumeName=="deoxyribose1_water_ph    
222     else if(volumeName=="phosphate1_water_phys    
223     else if(volumeName=="deoxyribose2_water_ph    
224     else if(volumeName=="phosphate2_water_phys    
225     else if(volumeName=="base_adenine_water_ph    
226     else if(volumeName=="base_guanine_water_ph    
227     else if(volumeName=="base_cytosine_water_p    
228     else if(volumeName=="base_thymine_water_ph    
229     else if(volumeName=="fiber") flagVolume =     
230     else if(volumeName=="voxelStraight" || vol    
231     else if(volumeName=="voxelRight" || volume    
232     else if(volumeName=="voxelLeft" || volumeN    
233     else if(volumeName=="voxelUp" || volumeNam    
234     else if(volumeName=="voxelDown" || volumeN    
235     else if(volumeName=="voxelStraight2" || vo    
236     else if(volumeName=="voxelRight2" || volum    
237     else if(volumeName=="voxelLeft2" || volume    
238     else if(volumeName=="voxelUp2" || volumeNa    
239     else if(volumeName=="voxelDown2" || volume    
240     else if(volumeName=="physWorld") flagVolum    
241     else if(volumeName=="wrapper") flagVolume     
242     else if(volumeName=="histone_phys") flagVo    
243     else if(volumeName=="nucleus_pl") flagVolu    
244     return flagVolume;                            
245 }                                                 
246                                                   
247 //....oooOO0OOooo........oooOO0OOooo........oo    
248                                                   
249 void SteppingAction::SetupVoxelCopyNumber(cons    
250 {                                                 
251     // Each time we will do a step in a voxel,    
252     // This way, this number will always be th    
253     // Therefore, in a DNA volume, the number     
254                                                   
255     if(step->GetPostStepPoint()->GetTouchable(    
256     {                                             
257         const G4String& volPost = step->GetPos    
258                                                   
259         // If we enter a voxel or stay in it      
260         if(    volPost == "VoxelStraight" || v    
261             || volPost == "VoxelRight" || volP    
262             || volPost == "VoxelLeft" || volPo    
263             || volPost == "VoxelUp" || volPost    
264             || volPost == "VoxelDown" || volPo    
265             || volPost == "VoxelStraight2" ||     
266             || volPost == "VoxelRight2" || vol    
267             || volPost == "VoxelLeft2" || volP    
268             || volPost == "VoxelUp2" || volPos    
269             || volPost == "VoxelDown2" || volP    
270         {                                         
271             fLastMetVoxelCopyNumber = step->Ge    
272         }                                         
273     }                                             
274 }                                                 
275                                                   
276 //....oooOO0OOooo........oooOO0OOooo........oo    
277                                                   
278