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

Main program of the medical/dna/wvalue 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/wvalue example.

Definition in file wvalue.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 49 of file wvalue.cc.

49  {
50 
51  //delete output file
52  remove ("wvalue.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 
62 #ifdef G4MULTITHREADED
63  G4MTRunManager* runManager = new G4MTRunManager;
64  G4int nThreads = G4Threading::G4GetNumberOfCores();
65  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
66  runManager->SetNumberOfThreads(nThreads);
67 #else
68 
69  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
70  G4RunManager* runManager = new G4RunManager;
71 #endif
72 
73  //set mandatory initialization classes
75  runManager->SetUserInitialization(det);
76 
77  PhysicsList* phys = new PhysicsList;
78  runManager->SetUserInitialization(phys);
79 
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