LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
exampleGB03.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.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 46 of file exampleGB03.cc.

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