LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
microbeam.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file microbeam.cc.

51  {
52 
53  // Detect interactive mode (if no arguments) and define UI session
54  //
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  //runManager->SetNumberOfThreads(1);
65 #else
66  G4RunManager* runManager = new G4RunManager;
67 #endif
68 
69  // Set mandatory user initialization classes
70 
72  runManager->SetUserInitialization(detector);
73 
74  runManager->SetUserInitialization(new PhysicsList);
75 
76  // User action initialization
77 
78  runManager->SetUserInitialization(new ActionInitialization(detector));
79 
80  // Initialize G4 kernel
81 
82  runManager->Initialize();
83 
84  // Visualization
85 
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 
89  // Get the pointer to the User Interface manager
90  G4UImanager* UImanager = G4UImanager::GetUIpointer();
91 
92  // Process macro or start UI session
93  //
94  if ( ! ui ) {
95  // batch mode
96  G4String command = "/control/execute ";
97  G4String fileName = argv[1];
98  UImanager->ApplyCommand(command+fileName);
99  }
100  else {
101  // interactive mode
102  UImanager->ApplyCommand("/control/execute vis.mac");
103  ui->SessionStart();
104  delete ui;
105  }
106 
107  delete visManager;
108  delete runManager;
109 
110  return 0;
111 
112 }