LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
range.cc File Reference

Main program of the medical/dna/range example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "SteppingVerbose.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/dna/range example.

Definition in file range.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 49 of file range.cc.

49  {
50 
51  //delete output file
52  remove ("range.txt");
53 
54  //detect interactive mode (if no arguments) and define UI session
55  G4UIExecutive* ui = 0;
56  if ( argc == 1 ) {
57  ui = new G4UIExecutive(argc, argv);
58  }
59 
60  //Construct the default run manager
61 #ifdef G4MULTITHREADED
62  G4MTRunManager* runManager = new G4MTRunManager();
63  G4int nThreads = G4Threading::G4GetNumberOfCores();
64  if (argc==3)
65  {
66  nThreads = G4UIcommand::ConvertToInt(argv[2]);
67  G4cout << argv[0] << " launched with " << nThreads
68  << " (may be overwritten by script)"
69  << G4endl;
70  }
71  runManager->SetNumberOfThreads(nThreads);
72 #else
73  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
74  G4RunManager* runManager = new G4RunManager();
75 #endif
76 
77  //set mandatory initialization classes
78  runManager->SetUserInitialization(new DetectorConstruction());
79  runManager->SetUserInitialization(new PhysicsList());
80  runManager->SetUserInitialization(new ActionInitialization());
81 
82  //visualization
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 
86  //get the pointer to the User Interface manager
87  G4UImanager* UI = G4UImanager::GetUIpointer();
88 
89  if (argc>1) // batch mode
90  {
91  G4String command = "/control/execute ";
92  G4String fileName = argv[1];
93  UI->ApplyCommand(command+fileName);
94  }
95 
96  else //define visualization and UI terminal for interactive mode
97  {
98  ui->SessionStart();
99  delete ui;
100  }
101 
102  //job termination
103  delete visManager;
104  delete runManager;
105 
106  return 0;
107 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:83