LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
microyz.cc File Reference

Main program of the microyz example. More...

#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.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 microyz example.

Definition in file microyz.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file microyz.cc.

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