LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Hadr08.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 //
28 //
29 //
30 
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "G4Types.hh"
35 #include "DetectorConstruction.hh"
36 #include "FTFP_BERT.hh"
37 #include "FTFP_INCLXX.hh"
38 #include "G4UImanager.hh"
39 #ifdef G4MULTITHREADED
40 #include "G4MTRunManager.hh"
41 #else
42 #include "G4RunManager.hh"
43 #endif
44 #include "ActionInitialization.hh"
45 #include "G4UIExecutive.hh"
46 #include "G4GenericBiasingPhysics.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
50 int main( int argc, char** argv ) {
51 
52  G4UIExecutive* ui = nullptr;
53  if ( argc == 1 ) {
54  ui = new G4UIExecutive(argc, argv);
55  }
56 
57  #ifdef G4MULTITHREADED
58  G4MTRunManager * runManager = new G4MTRunManager;
59  runManager->SetNumberOfThreads(4);
60  G4cout<<"+-------------------------------------------------------+"<<G4endl;
61  G4cout<<"| Constructing MT run manager |"<<G4endl;
62  G4cout<<"+-------------------------------------------------------+"<<G4endl;
63  #else
64  G4RunManager * runManager = new G4RunManager;
65  G4cout<<"+-------------------------------------------------------+"<<G4endl;
66  G4cout<<"| Constructing sequential run manager |"<<G4endl;
67  G4cout<<"+-------------------------------------------------------+"<<G4endl;
68  #endif
69 
70  G4VUserDetectorConstruction* detector = new DetectorConstruction;
71  runManager->SetUserInitialization( detector );
72 
73  FTFP_BERT* physicsList = new FTFP_BERT;
74  //FTFP_INCLXX* physicsList = new FTFP_INCLXX;
75 
76  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics;
77  biasingPhysics->Bias( "proton" );
78  biasingPhysics->Bias( "neutron" );
79  biasingPhysics->Bias( "pi+" );
80  biasingPhysics->Bias( "pi-" );
81  physicsList->RegisterPhysics( biasingPhysics );
82 
83  runManager->SetUserInitialization( physicsList );
84  runManager->SetUserInitialization( new ActionInitialization );
85 
86  runManager->Initialize();
87 
88  if ( ui ) {
89  ui->SessionStart();
90  delete ui;
91  } else {
92  G4String command = "/control/execute ";
93  G4String fileName = argv[1];
94  G4UImanager * UImanager = G4UImanager::GetUIpointer();
95  UImanager->ApplyCommand(command+fileName);
96  }
97 
98  delete runManager;
99 
100  return 0;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc, char **argv)
Definition: Hadr08.cc:50