LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
field03.cc File Reference

Main program of the field/field03 example. More...

#include "F03SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "F03DetectorConstruction.hh"
#include "F03ActionInitialization.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
#include "Randomize.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the field/field03 example.

Definition in file field03.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 62 of file field03.cc.

63 {
64  // Choose the Random engine
65  //
66  G4Random::setTheEngine(new CLHEP::RanecuEngine);
67 
68  // Construct the default run manager
69  //
70 #ifdef G4MULTITHREADED
71  G4MTRunManager * runManager = new G4MTRunManager;
72 #else
73  G4VSteppingVerbose::SetInstance(new F03SteppingVerbose);
74  G4RunManager * runManager = new G4RunManager;
75 #endif
76 
77  // Set mandatory initialization classes
78  //
79  // Detector construction
80  F03DetectorConstruction* detector = new F03DetectorConstruction();
81  runManager->SetUserInitialization(detector);
82  // Physics list
83  G4VModularPhysicsList* physicsList = new FTFP_BERT;
84  physicsList->RegisterPhysics(new G4StepLimiterPhysics());
85  runManager->SetUserInitialization(physicsList);
86  // User action initialization
87  runManager->SetUserInitialization(new F03ActionInitialization(detector));
88 
89  // Initialize G4 kernel
90  //
91  runManager->Initialize();
92 
93 #ifdef G4VIS_USE
94  // Initialize visualization
95  //
96  G4VisManager* visManager = new G4VisExecutive;
97  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
98  // G4VisManager* visManager = new G4VisExecutive("Quiet");
99  visManager->Initialize();
100 #endif
101 
102  // Get the pointer to the User Interface manager
103  //
104  G4UImanager* UImanager = G4UImanager::GetUIpointer();
105 
106  if (argc!=1) // batch mode
107  {
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  }
112  else
113  { // interactive mode : define UI session
114 #ifdef G4UI_USE
115  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
116  if (ui->IsGUI())
117  UImanager->ApplyCommand("/control/execute gui.mac");
118  ui->SessionStart();
119  delete ui;
120 #endif
121  }
122 
123  // Job termination
124  // Free the store: user actions, physics_list and detector_description are
125  // owned and deleted by the run manager, so they should not
126  // be deleted in the main() program !
127 
128 #ifdef G4VIS_USE
129  delete visManager;
130 #endif
131  delete runManager;
132 
133  return 0;
134 }