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

Main program of the microprox example. More...

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the microprox example.

Definition in file microprox.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file microprox.cc.

58 {
59  // Detect interactive mode (if no arguments) and define UI session
60  G4UIExecutive* ui = 0;
61  if ( argc == 1 ) {
62  ui = new G4UIExecutive(argc, argv);
63  }
64 
65  // Construct the default run manager
66 
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69 #else
70  G4RunManager* runManager = new G4RunManager;
71 #endif
72 
73  // Set mandatory initialization classes
74  runManager->SetUserInitialization(new DetectorConstruction());
75 
76  runManager->SetUserInitialization(new PhysicsList);
77 
78  // Set user action classes
79  runManager->SetUserInitialization(new ActionInitialization());
80 
81  // Initialize visualization
82  G4VisManager* visManager = new G4VisExecutive;
83  visManager->Initialize();
84 
85  // Get the pointer to the User Interface manager
86  G4UImanager* UImanager = G4UImanager::GetUIpointer();
87 
88  // Process macro or start UI session
89  if ( ! ui ) {
90  // batch mode
91  G4String command = "/control/execute ";
92  G4String fileName = argv[1];
93  UImanager->ApplyCommand(command+fileName);
94  }
95  else {
96  // interactive mode
97  UImanager->ApplyCommand("/control/execute init_vis.mac");
98  ui->SessionStart();
99  delete ui;
100  }
101 
102  // Job termination
103  // Free the store: user actions, physics_list and detector_description are
104  // owned and deleted by the run manager, so they should not be deleted
105  // in the main() program !
106  //
107  delete visManager;
108  delete runManager;
109 }