LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PurgMag.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "PurgMagDetectorConstruction.hh"
#include "PurgMagPhysicsList.hh"
#include "PurgMagActionInitializer.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 61 of file PurgMag.cc.

61  {
62 
63  //choose the Random engine
64  G4Random::setTheEngine(new CLHEP::RanecuEngine);
65 
66  // Construct the default run manager
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69  //runManager->SetNumberOfThreads(2);
70 #else
71  G4RunManager* runManager = new G4RunManager;
72 #endif
73 
74  // set mandatory initialization classes
75  runManager->SetUserInitialization(new PurgMagDetectorConstruction);
76  runManager->SetUserInitialization(new PurgMagPhysicsList);
77  runManager->SetUserInitialization(new PurgMagActionInitializer());
78 
79 
80 #ifdef G4VIS_USE
81  // visualization manager
82  G4VisManager* visManager = new G4VisExecutive;
83  visManager->Initialize();
84 #endif
85 
86  //Initialize G4 kernel
87  runManager->Initialize();
88 
89  // get the pointer to the User Interface manager
90  G4UImanager* UImanager = G4UImanager::GetUIpointer();
91 
92 
93  if (argc==1) // Define UI session for interactive mode.
94  {
95 #ifdef G4UI_USE
96  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
97 #ifdef G4VIS_USE
98  UImanager->ApplyCommand("/control/execute vis.mac");
99 #endif
100  ui->SessionStart();
101  delete ui;
102 #endif
103  }
104  else // Batch mode
105  {
106  G4String command = "/control/execute ";
107  G4String fileName = argv[1];
108  UImanager->ApplyCommand(command+fileName);
109  }
110 
111  // job termination
112 #ifdef G4VIS_USE
113  delete visManager;
114 #endif
115  delete runManager;
116 
117  return 0;
118 }