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

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

#include "G4Types.hh"
#include "MyFile.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/svalue example.

Definition in file svalue.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file svalue.cc.

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