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] [ 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/neuron.cc (Version 11.3.0) and /examples/extended/medical/dna/neuron/neuron.cc (Version ReleaseNotes)


** Warning: Cannot open xref database.

  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 /// \file neuron.cc                               
 40 /// \brief Implementation of the neuron exampl    
 41 //                                                
 42 //....oooOO0OOooo........oooOO0OOooo........oo    
 43 #include "ActionInitialization.hh"                
 44 #include "CommandLineParser.hh"                   
 45 #include "DetectorConstruction.hh"                
 46 #include "PhysicsList.hh"                         
 47                                                   
 48 #include "G4DNAChemistryManager.hh"               
 49 #include "G4RunManagerFactory.hh"                 
 50 #include "G4Timer.hh"                             
 51 #include "G4Types.hh"                             
 52 #include "G4UIExecutive.hh"                       
 53 #include "G4UImanager.hh"                         
 54 #include "G4VisExecutive.hh"                      
 55                                                   
 56 //....oooOO0OOooo........oooOO0OOooo........oo    
 57                                                   
 58 using namespace std;                              
 59 using namespace G4DNAPARSER;                      
 60                                                   
 61 CommandLineParser* parser(0);                     
 62                                                   
 63 void Parse(int& argc, char** argv);               
 64                                                   
 65 int main(int argc, char** argv)                   
 66 {                                                 
 67   // run time in Geant4                           
 68   G4Timer* timer = new G4Timer();                 
 69   timer->Start();                                 
 70                                                   
 71   //////////                                      
 72   // Parse options given in commandLine           
 73   //                                              
 74   Parse(argc, argv);                              
 75                                                   
 76   //////////                                      
 77   // Construct the run manager according to wh    
 78   //                                              
 79   Command* commandLine(0);                        
 80                                                   
 81   auto* runManager = G4RunManagerFactory::Crea    
 82                                                   
 83   if ((commandLine = parser->GetCommandIfActiv    
 84     G4int nThreads = 2;                           
 85                                                   
 86     if (commandLine->GetOption() == "NMAX") {     
 87       nThreads = G4Threading::G4GetNumberOfCor    
 88     }                                             
 89     else {                                        
 90       nThreads = G4UIcommand::ConvertToInt(com    
 91     }                                             
 92     runManager->SetNumberOfThreads(nThreads);     
 93                                                   
 94     G4cout << "===== neuron is started with "     
 95            << " threads of MT MODE =====" << G    
 96   }                                               
 97                                                   
 98   // Set mandatory user initialization classes    
 99   DetectorConstruction* detector = new Detecto    
100   runManager->SetUserInitialization(detector);    
101   runManager->SetUserInitialization(new Physic    
102                                                   
103   // User action initialization                   
104   runManager->SetUserInitialization(new Action    
105                                                   
106   // Initialize G4 kernel                         
107   runManager->Initialize();                       
108                                                   
109   // Initialize visualization                     
110   G4VisManager* visManager = new G4VisExecutiv    
111   visManager->Initialize();                       
112                                                   
113   // Get the pointer to the User Interface man    
114   G4UImanager* UImanager = G4UImanager::GetUIp    
115   G4UIExecutive* ui(0);                           
116                                                   
117   // interactive mode : define UI session         
118   if ((commandLine = parser->GetCommandIfActiv    
119     ui = new G4UIExecutive(argc, argv, command    
120                                                   
121     if (ui->IsGUI()) UImanager->ApplyCommand("    
122                                                   
123     if (parser->GetCommandIfActive("-novis") =    
124     // visualization is used by default           
125     {                                             
126       if ((commandLine = parser->GetCommandIfA    
127       // select a visualization driver if need    
128       {                                           
129         UImanager->ApplyCommand(G4String("/vis    
130       }                                           
131       else                                        
132       // by default OGL is used                   
133       {                                           
134         UImanager->ApplyCommand("/vis/open OGL    
135       }                                           
136       UImanager->ApplyCommand("/control/execut    
137     }                                             
138   }                                               
139   else                                            
140   // to be use visualization file (= store the    
141   // an external file:                            
142   // ASCIITree ;  DAWNFILE ; HepRepFile ; VRML    
143   {                                               
144     if ((commandLine = parser->GetCommandIfAct    
145       UImanager->ApplyCommand(G4String("/vis/o    
146       UImanager->ApplyCommand("/control/execut    
147     }                                             
148   }                                               
149                                                   
150   if ((commandLine = parser->GetCommandIfActiv    
151     G4String command = "/control/execute ";       
152     UImanager->ApplyCommand(command + commandL    
153   }                                               
154   else {                                          
155     UImanager->ApplyCommand("/control/execute     
156   }                                               
157                                                   
158   if ((commandLine = parser->GetCommandIfActiv    
159     ui->SessionStart();                           
160     delete ui;                                    
161   }                                               
162                                                   
163   // calculation time                             
164   timer->Stop();                                  
165   G4cout << " Calculation time                    
166          << G4endl;                               
167                                                   
168   delete visManager;                              
169   delete runManager;                              
170                                                   
171   return 0;                                       
172 }                                                 
173                                                   
174 //....oooOO0OOooo........oooOO0OOooo........oo    
175                                                   
176 void GetNameAndPathOfExecutable(char** argv, G    
177 {                                                 
178   // Get the last position of '/'                 
179   std::string aux(argv[0]);                       
180                                                   
181   // get '/' or '\\' depending on unix/mac or     
182 #if defined(_WIN32) || defined(WIN32)             
183   int pos = aux.rfind('\\');                      
184 #else                                             
185   int pos = aux.rfind('/');                       
186 #endif                                            
187                                                   
188   // Get the path and the name                    
189   path = aux.substr(0, pos + 1);                  
190   executable = aux.substr(pos + 1);               
191 }                                                 
192                                                   
193 //....oooOO0OOooo........oooOO0OOooo........oo    
194                                                   
195 void Parse(int& argc, char** argv)                
196 {                                                 
197   //////////                                      
198   // Parse options given in commandLine           
199   //                                              
200   parser = CommandLineParser::GetParser();        
201                                                   
202   parser->AddCommand("-gui", Command::OptionNo    
203                      "Select geant4 UI or just    
204                                                   
205   parser->AddCommand("-mac", Command::WithOpti    
206                                                   
207   // You cann your own command, as for instanc    
208   //  parser->AddCommand("-seed",                 
209   //                     Command::WithOption,     
210   //                     "Give a seed value in    
211   // it is then up to you to manage this optio    
212                                                   
213   parser->AddCommand("-mt", Command::WithOptio    
214                      " NOT RECOMMANDED WITH CH    
215                                                   
216   parser->AddCommand("-sXY", Command::OptionNo    
217                      "Initial beam position un    
218   parser->AddCommand("-dXY", Command::OptionNo    
219                      "Initial beam position un    
220                                                   
221   parser->AddCommand("-dnaliv", Command::Optio    
222   parser->AddCommand("-dnachemON", Command::Op    
223                      "Activate Livermore + DNA    
224   parser->AddCommand("-dnahad", Command::Optio    
225                      "Activate Hadronic + Live    
226                                                   
227   parser->AddCommand("-swc", Command::WithOpti    
228                                                   
229   parser->AddCommand("-network",                  
230                      Command::WithOption,  //     
231                      "Give a DAT file to simul    
232                                                   
233   parser->AddCommand("-vis", Command::WithOpti    
234                      "OGL 600x600-0+0");          
235                                                   
236   parser->AddCommand("-novis", Command::Withou    
237                                                   
238   G4String exec;                                  
239   G4String path;                                  
240   GetNameAndPathOfExecutable(argv, exec, path)    
241                                                   
242   parser->AddCommand("-out", Command::OptionNo    
243                                                   
244   //////////                                      
245   // If -h or --help is given in option : prin    
246   //                                              
247   if (parser->Parse(argc, argv) != 0)  // help    
248   {                                               
249     // if you are using ROOT, create a TApplic    
250     // to print the help from ROOT as well        
251     CommandLineParser::DeleteInstance();          
252     std::exit(0);                                 
253   }                                               
254   ///////////                                     
255   // Kill application if wrong argument in com    
256   //                                              
257   if (parser->CheckIfNotHandledOptionsExists(a    
258     // if you are using ROOT, you should initi    
259     // before this condition                      
260     abort();                                      
261   }                                               
262 }                                                 
263