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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/extended/medical/dna/neuron/src/ITTrackingInteractivity.cc (Version 11.3.0) and /examples/extended/medical/dna/neuron/src/ITTrackingInteractivity.cc (Version 10.2.p2)


  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 // This example is provided by the Geant4-DNA     
 27 // Any report or published results obtained us    
 28 // shall cite the following Geant4-DNA collabo    
 29 // Med. Phys. 37 (2010) 4692-4708                 
 30 // and papers                                     
 31 // M. Batmunkh et al. J Radiat Res Appl Sci 8     
 32 // O. Belov et al. Physica Medica 32 (2016) 15    
 33 // The Geant4-DNA web site is available at htt    
 34 //                                                
 35 // -------------------------------------------    
 36 // November 2016                                  
 37 // -------------------------------------------    
 38 //                                                
 39 //                                                
 40 /// \file ITTrackingInteractivity.hh              
 41 /// \brief Implementation of the ITTrackingInt    
 42                                                   
 43 #include "ITTrackingInteractivity.hh"             
 44                                                   
 45 #include "G4Event.hh"                             
 46 #include "G4EventManager.hh"                      
 47 #include "G4IT.hh"                                
 48 #include "G4RichTrajectory.hh"                    
 49 #include "G4SmoothTrajectory.hh"                  
 50 #include "G4TrackingInformation.hh"               
 51 #include "G4Trajectory.hh"                        
 52 #include "G4UserSteppingAction.hh"                
 53 #include "G4UserTrackingAction.hh"                
 54 #include "G4VSteppingVerbose.hh"                  
 55 #include "G4VTrajectory.hh"                       
 56 #include "G4VisManager.hh"                        
 57                                                   
 58 class G4Trajectory_Lock                           
 59 {                                                 
 60     friend class ITTrackingInteractivity;         
 61                                                   
 62     G4Trajectory_Lock() : fpTrajectory(0) { ;     
 63                                                   
 64     ~G4Trajectory_Lock() { ; }                    
 65                                                   
 66     G4VTrajectory* fpTrajectory;                  
 67 };                                                
 68                                                   
 69 ITTrackingInteractivity::ITTrackingInteractivi    
 70 {                                                 
 71   fStoreTrajectory = 0;                           
 72   fVerboseLevel = 0;                              
 73                                                   
 74   fpUserTrackingAction = 0;                       
 75   fpUserSteppingAction = 0;                       
 76                                                   
 77   ////////////////////////////                    
 78   // In case you want to use same tracking/ste    
 79   // for normal and IT stepping                   
 80   /*                                              
 81     fpUserTrackingAction =                        
 82       trackingManager->GetUserTrackingAction()    
 83     fpUserSteppingAction =                        
 84       G4EventManager::GetEventManager()->GetUs    
 85    */                                             
 86   ////////////////////////////                    
 87 }                                                 
 88                                                   
 89 //....oooOO0OOooo........oooOO0OOooo........oo    
 90                                                   
 91 ITTrackingInteractivity::~ITTrackingInteractiv    
 92 {                                                 
 93   G4EventManager* eventManager = G4EventManage    
 94                                                   
 95   if (eventManager) {                             
 96     G4UserTrackingAction* std_trackAct = event    
 97     if (fpUserTrackingAction != std_trackAct &    
 98                                                   
 99     G4UserSteppingAction* std_stepAct = eventM    
100     if (fpUserSteppingAction != std_stepAct &&    
101   }                                               
102   else {                                          
103     if (fpUserSteppingAction) {                   
104       delete fpUserSteppingAction;                
105     }                                             
106                                                   
107     if (fpUserTrackingAction) {                   
108       delete fpUserTrackingAction;                
109     }                                             
110   }                                               
111 }                                                 
112                                                   
113 //....oooOO0OOooo........oooOO0OOooo........oo    
114                                                   
115 void ITTrackingInteractivity::Initialize()        
116 {                                                 
117   G4TrackingManager* trackingManager = G4Event    
118   fStoreTrajectory = trackingManager->GetStore    
119   fVerboseLevel = trackingManager->GetVerboseL    
120 }                                                 
121                                                   
122 //....oooOO0OOooo........oooOO0OOooo........oo    
123                                                   
124 void ITTrackingInteractivity::StartTracking(G4    
125 {                                                 
126 #ifdef G4VERBOSE                                  
127   if (fVerboseLevel) {                            
128     TrackBanner(track, "G4ITTrackingManager::S    
129   }                                               
130 #endif                                            
131                                                   
132   if (fVerboseLevel > 0 && (G4VSteppingVerbose    
133                                                   
134   // Pre tracking user intervention process.      
135   if (fpUserTrackingAction != 0) {                
136     fpUserTrackingAction->PreUserTrackingActio    
137   }                                               
138   // #ifdef G4_STORE_TRAJECTORY                   
139   G4TrackingInformation* trackingInfo = GetIT(    
140   G4Trajectory_Lock* trajectory_lock = trackin    
141                                                   
142   // Construct a trajectory if it is requested    
143   if (fStoreTrajectory && (!trajectory_lock))     
144     trajectory_lock = new G4Trajectory_Lock();    
145     trackingInfo->SetTrajectory_Lock(trajector    
146     G4VTrajectory* trajectory = 0;                
147     // default trajectory concrete class objec    
148     switch (fStoreTrajectory) {                   
149       default:                                    
150       case 1:                                     
151         trajectory = new G4Trajectory(track);     
152         break;                                    
153       case 2:                                     
154         trajectory = new G4SmoothTrajectory(tr    
155         break;                                    
156       case 3:                                     
157         trajectory = new G4RichTrajectory(trac    
158         break;                                    
159     }                                             
160     trajectory_lock->fpTrajectory = trajectory    
161   }                                               
162   // #endif                                       
163 }                                                 
164                                                   
165 //....oooOO0OOooo........oooOO0OOooo........oo    
166                                                   
167 void ITTrackingInteractivity::AppendStep(G4Tra    
168 {                                                 
169   ////////////////////////////                    
170   // If you want to use sensitive detector        
171   /*                                              
172     G4VPhysicalVolume* currentVolume =            
173     step->GetPreStepPoint()->GetPhysicalVolume    
174     G4SteppingControl stepControlFlag =  step-    
175                                                   
176     if( currentVolume  != 0 && stepControlFlag    
177     {                                             
178         G4VSensitiveDetector* sensitive = step    
179                 GetSensitiveDetector();           
180         if( sensitive != 0 )                      
181         {                                         
182             sensitive->Hit(fpStep);               
183         }                                         
184     }                                             
185    */                                             
186   ////////////////////////////                    
187                                                   
188   if (fpUserSteppingAction) fpUserSteppingActi    
189                                                   
190   ////////////////////////////                    
191   // If you want to use regional stepping acti    
192   /*                                              
193     G4UserSteppingAction* regionalAction          
194             = fpStep->GetPreStepPoint()->GetPh    
195                   GetLogicalVolume()->GetRegio    
196                   GetRegionalSteppingAction();    
197     if( regionalAction ) regionalAction->UserS    
198    */                                             
199   ////////////////////////////                    
200                                                   
201   if (fStoreTrajectory) {                         
202     G4TrackingInformation* trackingInfo = GetI    
203     G4Trajectory_Lock* trajectory_lock = track    
204     trajectory_lock->fpTrajectory->AppendStep(    
205   }                                               
206 }                                                 
207                                                   
208 //....oooOO0OOooo........oooOO0OOooo........oo    
209                                                   
210 void ITTrackingInteractivity::EndTracking(G4Tr    
211 {                                                 
212 #ifdef G4VERBOSE                                  
213   if (fVerboseLevel) {                            
214     TrackBanner(track, "G4ITTrackingManager::E    
215   }                                               
216 #endif                                            
217   // Post tracking user intervention process.     
218   if (fpUserTrackingAction != 0) {                
219     fpUserTrackingAction->PostUserTrackingActi    
220   }                                               
221                                                   
222   // #ifdef G4_STORE_TRAJECTORY                   
223   G4TrackingInformation* trackingInfo = GetIT(    
224   G4Trajectory_Lock* trajectory_lock = trackin    
225                                                   
226   if (trajectory_lock) {                          
227     G4VTrajectory*& trajectory = trajectory_lo    
228                                                   
229     if (fStoreTrajectory && trajectory) {         
230 #ifdef G4VERBOSE                                  
231       if (fVerboseLevel > 10) trajectory->Show    
232 #endif                                            
233       G4TrackStatus istop = track->GetTrackSta    
234                                                   
235       if (trajectory && (istop != fStopButAliv    
236         G4Event* currentEvent = G4EventManager    
237                                                   
238         if (currentEvent) {                       
239           G4TrajectoryContainer* trajectoryCon    
240                                                   
241           if (!trajectoryContainer) {             
242             trajectoryContainer = new G4Trajec    
243             currentEvent->SetTrajectoryContain    
244           }                                       
245           trajectoryContainer->insert(trajecto    
246         }                                         
247         else {                                    
248           fTrajectories.push_back(trajectory);    
249         }                                         
250       }                                           
251     }                                             
252     // Destruct the trajectory if it was creat    
253     else if ((!fStoreTrajectory) && trajectory    
254       delete trajectory;                          
255       trajectory = 0;                             
256     }                                             
257     delete trajectory_lock;                       
258     trackingInfo->SetTrajectory_Lock(0);          
259   }                                               
260   // #endif                                       
261 }                                                 
262                                                   
263 void ITTrackingInteractivity::Finalize()          
264 {                                                 
265   for (std::vector<G4VTrajectory*>::iterator i    
266        it++)                                      
267   {                                               
268     G4VisManager::GetConcreteInstance()->Draw(    
269   }                                               
270 }                                                 
271