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

Main program of the splitting example. More...

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the splitting example.

Definition in file splitting.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 60 of file splitting.cc.

61 {
62  // Instantiate G4UIExecutive if interactive mode
63  G4UIExecutive* ui = nullptr;
64  if ( argc == 1 ) {
65  ui = new G4UIExecutive(argc, argv);
66  }
67 
68 #ifdef G4MULTITHREADED
69  G4MTRunManager* runManager= new G4MTRunManager;
70  G4int nThreads = 2;
71  runManager->SetNumberOfThreads(nThreads);
72 #else
73  G4RunManager* runManager = new G4RunManager();
74 #endif
75 
76  // Set user classes
77  //
78  runManager->SetUserInitialization(new DetectorConstruction());
79  PhysicsList* physList = new PhysicsList();
80  runManager->SetUserInitialization(physList);
81  runManager->SetUserInitialization(new ActionInitialization(physList));
82 
83  // Initialize G4 kernel
84  G4UImanager* UI = G4UImanager::GetUIpointer();
85 
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 
89  if (!ui) // 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