Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exampleB2b.cc File Reference
#include "B2bDetectorConstruction.hh"
#include "B2ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
#include "Randomize.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
Include dependency graph for exampleB2b.cc:

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 exampleB2b.cc.

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  // Choose the Random engine
61  G4Random::setTheEngine(new CLHEP::RanecuEngine);
62 
63  // Construct the default run manager
64  //
65 #ifdef G4MULTITHREADED
66  G4MTRunManager* runManager = new G4MTRunManager;
67 #else
68  G4RunManager* runManager = new G4RunManager;
69 #endif
70 
71  // Set mandatory initialization classes
72  //
74 
75  G4VModularPhysicsList* physicsList = new FTFP_BERT;
76  physicsList->RegisterPhysics(new G4StepLimiterPhysics());
77  runManager->SetUserInitialization(physicsList);
78 
79  // Set user action classes
81 
82  // Initialize visualization
83  //
84  G4VisManager* visManager = new G4VisExecutive;
85  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
86  // G4VisManager* visManager = new G4VisExecutive("Quiet");
87  visManager->Initialize();
88 
89  // Get the pointer to the User Interface manager
91 
92  // Process macro or start UI session
93  //
94  if ( ! ui ) {
95  // barch 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 init_vis.mac");
103  if (ui->IsGUI()) {
104  UImanager->ApplyCommand("/control/execute gui.mac");
105  }
106  ui->SessionStart();
107  delete ui;
108  }
109 
110  // Job termination
111  // Free the store: user actions, physics_list and detector_description are
112  // owned and deleted by the run manager, so they should not be deleted
113  // in the main() program !
114 
115  delete visManager;
116  delete runManager;
117 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
G4bool IsGUI() const
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: