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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/pdb4dna/pdb4dna.cc (Version 11.3.0) and /examples/extended/medical/dna/pdb4dna/pdb4dna.cc (Version 6.2.p1)


  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 // Delage et al. PDB4DNA: implementation of DN    
 31 //                  Bank (PDB) description for    
 32 //                  simulations (submitted to     
 33 // The Geant4-DNA web site is available at htt    
 34 //                                                
 35 //                                                
 36 /// \file pdb4dna.cc                              
 37 /// \brief Main program of the pdb4dna example    
 38                                                   
 39 #include "ActionInitialization.hh"                
 40 #include "DetectorConstruction.hh"                
 41 #include "PhysicsList.hh"                         
 42                                                   
 43 #ifdef G4MULTITHREADED                            
 44 #  include "G4MTRunManager.hh"                    
 45 #else                                             
 46 #  include "G4RunManager.hh"                      
 47 #endif                                            
 48                                                   
 49 #include "G4UIExecutive.hh"                       
 50 #include "G4UImanager.hh"                         
 51 #include "G4VisExecutive.hh"                      
 52 #include "Randomize.hh"                           
 53 #ifdef G4UI_USE_QT                                
 54 #  include "G4UIQt.hh"                            
 55 #endif                                            
 56 #include "CommandLineParser.hh"                   
 57                                                   
 58 //....oooOO0OOooo........oooOO0OOooo........oo    
 59                                                   
 60 using namespace G4DNAPARSER;                      
 61 CommandLineParser* parser(0);                     
 62                                                   
 63 void Parse(int& argc, char** argv);               
 64                                                   
 65 //....oooOO0OOooo........oooOO0OOooo........oo    
 66                                                   
 67 int main(int argc, char** argv)                   
 68 {                                                 
 69   //////////                                      
 70   // Parse options given in commandLine           
 71   //                                              
 72   Parse(argc, argv);                              
 73                                                   
 74   //////////                                      
 75   // Construct the run manager according to wh    
 76   //                                              
 77   Command* commandLine(0);                        
 78                                                   
 79 #ifdef G4MULTITHREADED                            
 80   G4MTRunManager* runManager = new G4MTRunMana    
 81   if ((commandLine = parser->GetCommandIfActiv    
 82     int nThreads = 2;                             
 83     if (commandLine->GetOption() == "NMAX") {     
 84       nThreads = G4Threading::G4GetNumberOfCor    
 85     }                                             
 86     else {                                        
 87       nThreads = G4UIcommand::ConvertToInt(com    
 88     }                                             
 89     G4cout << "===== PDB4DNA is started with "    
 90            << " threads =====" << G4endl;         
 91                                                   
 92     runManager->SetNumberOfThreads(nThreads);     
 93   }                                               
 94 #else                                             
 95   G4RunManager* runManager = new G4RunManager(    
 96 #endif                                            
 97                                                   
 98   // Set user classes                             
 99   //                                              
100   runManager->SetUserInitialization(new Detect    
101   runManager->SetUserInitialization(new Physic    
102   runManager->SetUserInitialization(new Action    
103                                                   
104   // Initialize G4 keRnel                         
105   //                                              
106   // runManager->Initialize();                    
107                                                   
108   // Initialize visualization                     
109   G4VisManager* visManager = new G4VisExecutiv    
110   visManager->Initialize();                       
111                                                   
112   // Get the pointer to the User Interface man    
113   G4UImanager* UImanager = G4UImanager::GetUIp    
114   G4UIExecutive* ui(0);                           
115                                                   
116   // interactive mode : define UI session         
117   if ((commandLine = parser->GetCommandIfActiv    
118     ui = new G4UIExecutive(argc, argv, command    
119                                                   
120     if (parser->GetCommandIfActive("-novis") =    
121     // visualization is used by default           
122     {                                             
123       if ((commandLine = parser->GetCommandIfA    
124       // select a visualization driver if need    
125       {                                           
126         UImanager->ApplyCommand(G4String("/vis    
127       }                                           
128       else                                        
129       // by default OGL is used                   
130       {                                           
131         UImanager->ApplyCommand("/vis/open OGL    
132       }                                           
133       UImanager->ApplyCommand("/control/execut    
134     }                                             
135     if (ui->IsGUI()) UImanager->ApplyCommand("    
136   }                                               
137   else                                            
138   // to be use visualization file (= store the    
139   // an external file:                            
140   // ASCIITree ;  DAWNFILE ; HepRepFile ; VRML    
141   {                                               
142     if ((commandLine = parser->GetCommandIfAct    
143       UImanager->ApplyCommand(G4String("/vis/o    
144       UImanager->ApplyCommand("/control/execut    
145     }                                             
146   }                                               
147                                                   
148   if ((commandLine = parser->GetCommandIfActiv    
149     G4String command = "/control/execute ";       
150     UImanager->ApplyCommand(command + commandL    
151   }                                               
152   else {                                          
153     UImanager->ApplyCommand("/control/execute     
154   }                                               
155                                                   
156   if ((commandLine = parser->GetCommandIfActiv    
157 #ifdef G4UI_USE_QT                                
158     G4UIQt* UIQt = static_cast<G4UIQt*>(UImana    
159     if (UIQt) {                                   
160       UIQt->AddViewerTabFromFile("README", "RE    
161     }                                             
162 #endif                                            
163     ui->SessionStart();                           
164     delete ui;                                    
165   }                                               
166                                                   
167   // Job termination                              
168   delete visManager;                              
169   delete runManager;                              
170                                                   
171   return 0;                                       
172 }                                                 
173                                                   
174 //....oooOO0OOooo........oooOO0OOooo........oo    
175                                                   
176 void Parse(int& argc, char** argv)                
177 {                                                 
178   //////////                                      
179   // Parse options given in commandLine           
180   //                                              
181   parser = CommandLineParser::GetParser();        
182                                                   
183   parser->AddCommand("-gui", Command::OptionNo    
184                      "Select geant4 UI or just    
185                                                   
186   parser->AddCommand("-mac", Command::WithOpti    
187                                                   
188   // You cann your own command, as for instanc    
189   //  parser->AddCommand("-seed",                 
190   //                     Command::WithOption,     
191   //                     "Give a seed value in    
192   // it is then up to you to manage this optio    
193                                                   
194 #ifdef G4MULTITHREADED                            
195   parser->AddCommand("-mt", Command::WithOptio    
196                      "2");                        
197 #endif                                            
198                                                   
199   parser->AddCommand("-vis", Command::WithOpti    
200                      "OGL 600x600-0+0");          
201                                                   
202   parser->AddCommand("-novis", Command::Withou    
203                                                   
204   //////////                                      
205   // If -h or --help is given in option : prin    
206   //                                              
207   if (parser->Parse(argc, argv) != 0)  // help    
208   {                                               
209     // if you are using ROOT, create a TApplic    
210     // to print the help from ROOT as well        
211     CommandLineParser::DeleteInstance();          
212     std::exit(0);                                 
213   }                                               
214                                                   
215   ///////////                                     
216   // Kill application if wrong argument in com    
217   //                                              
218   if (parser->CheckIfNotHandledOptionsExists(a    
219     // if you are using ROOT, you should initi    
220     // before this condition                      
221     abort();                                      
222   }                                               
223 }                                                 
224