Geant4  10.02.p02
exampleGB03.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 #ifdef G4MULTITHREADED
28 #include "G4MTRunManager.hh"
29 #else
30 #include "G4RunManager.hh"
31 #endif
32 
33 #ifdef G4VIS_USE
34 #include "G4VisExecutive.hh"
35 #endif
36 
37 #ifdef G4UI_USE
38 #include "G4UIExecutive.hh"
39 #endif
40 
41 #include "G4UImanager.hh"
42 
46 #include "FTFP_BERT.hh"
48 
49 int main(int argc,char** argv)
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
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
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 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
void SetNumberOfThreads(G4int n)
Definition of the GB03DetectorConstruction class.
Definition of the GB03PrimaryGeneratorAction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
Definition of the GB03ActionInitialization class.
int main(int argc, char **argv)
Definition: exampleGB03.cc:49
void NonPhysicsBias(const G4String &particleName)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446