LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Ultra.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "UltraActionInitializer.hh"
#include "UltraDetectorConstruction.hh"
#include "UltraPhysicsList.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 56 of file Ultra.cc.

56  {
57 
58 //choose the Random engine from CLHEP
59 //(lets use C++ implementation of Jame's RANLUX generator)
60 
61  G4Random::setTheEngine(new CLHEP::RanluxEngine);
62 
63 #ifdef G4MULTITHREADED
64  G4MTRunManager* runManager = new G4MTRunManager;
65  //runManager->SetNumberOfThreads(2);
66 #else
67  G4RunManager* runManager = new G4RunManager;
68 #endif
69 
70  // UserInitialization classes - mandatory
71  UltraDetectorConstruction* detector = new UltraDetectorConstruction;
72  UltraPhysicsList* list = new UltraPhysicsList();
73  runManager->SetUserInitialization(detector);
74  runManager->SetUserInitialization(list);
75 
76  // UserAction classes - optional
77  runManager->SetUserInitialization(new UltraActionInitializer());
78 
79  // Detect interactive mode (if no arguments) and define UI session
80  G4UIExecutive* ui = 0;
81  if ( argc == 1 ) {
82  ui = new G4UIExecutive(argc, argv);
83  }
84 
85  // Initialise visualization
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 
89  // Get the Pointer to the UI Manager
90  G4UImanager* UImanager = G4UImanager::GetUIpointer();
91 
92  // User interactions
93  // Define (G)UI for interactive mode
94  if(argc==1)
95  {
96  UImanager->ApplyCommand("/control/execute Visualisation.mac");
97  ui->SessionStart();
98  delete ui;
99  }
100  else // Batch mode
101  {
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UImanager->ApplyCommand(command+fileName);
105  }
106 
107  delete visManager;
108  delete runManager;
109 
110  return 0;
111 }