LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
exampleGB03.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "GB03DetectorConstruction.hh"
#include "GB03PrimaryGeneratorAction.hh"
#include "GB03ActionInitialization.hh"
#include "FTFP_BERT.hh"
#include "G4GenericBiasingPhysics.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 49 of file exampleGB03.cc.

50 {
51 
52  // -- Construct the run manager : MT or sequential one
53 #ifdef G4MULTITHREADED
54  G4MTRunManager * runManager = new G4MTRunManager;
55  G4cout << " ********** Run Manager constructed in MT mode ************ " << G4endl;
56  // -- Choose 4 threads:
57  runManager->SetNumberOfThreads(4);
58 #else
59  G4RunManager * runManager = new G4RunManager;
60  G4cout << " ********** Run Manager constructed in sequential mode ************ " << G4endl;
61 #endif
62 
63 
64  // -- Set mandatory initialization classes
65  G4VUserDetectorConstruction* detector = new GB03DetectorConstruction;
66  runManager->SetUserInitialization(detector);
67  G4VModularPhysicsList* physicsList = new FTFP_BERT;
68  // -- Setup biasing for neutron only. As will not bias any
69  // -- physics process, require the G4GenericBiasingPhysics()
70  // -- to modify the physics list just for "non-physics" biasing:
71  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
72  biasingPhysics->NonPhysicsBias("neutron");
73  physicsList->RegisterPhysics(biasingPhysics);
74  runManager->SetUserInitialization(physicsList);
75 
76  // -- Set user action initialization class
77  G4VUserActionInitialization* actions = new GB03ActionInitialization;
78  runManager->SetUserInitialization(actions);
79 
80 #ifdef G4VIS_USE
81  // Visualization manager
82  //
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 #endif
86 
87  // Initialize G4 kernel
88  //
89  runManager->Initialize();
90 
91  // Get the pointer to the User Interface manager
92  //
93  G4UImanager* UImanager = G4UImanager::GetUIpointer();
94 
95  if (argc==1) // Define UI session for interactive mode
96  {
97 #ifdef G4UI_USE
98  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
99 #ifdef G4VIS_USE
100  UImanager->ApplyCommand("/control/execute vis.mac");
101 #endif
102  ui->SessionStart();
103  delete ui;
104 #endif
105  }
106  else // Batch mode
107  {
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  }
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116  delete runManager;
117 
118  return 0;
119 }