Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
hadronic
Hadr00
Hadr00.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
// $Id$
31
//
32
// -------------------------------------------------------------
33
// GEANT4 Hadr00
34
//
35
// Application demonstrating Geant4 hadronic cross sections
36
//
37
// Author: V.Ivanchenko 20 June 2008
38
//
39
// Modified:
40
//
41
// -------------------------------------------------------------
42
//
43
//
44
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47
#include "
G4RunManager.hh
"
48
#include "
G4UImanager.hh
"
49
#include "
Randomize.hh
"
50
51
#include "DetectorConstruction.hh"
52
#include "
G4PhysListFactory.hh
"
53
#include "
G4VModularPhysicsList.hh
"
54
#include "PrimaryGeneratorAction.hh"
55
56
#include "RunAction.hh"
57
#include "EventAction.hh"
58
59
#ifdef G4VIS_USE
60
#include "
G4VisExecutive.hh
"
61
#endif
62
63
#ifdef G4UI_USE
64
#include "
G4UIExecutive.hh
"
65
#endif
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69
int
main
(
int
argc,
char
** argv) {
70
71
//choose the Random engine
72
CLHEP::HepRandom::setTheEngine
(
new
CLHEP::RanecuEngine
());
73
74
//Construct the default run manager
75
G4RunManager
* runManager =
new
G4RunManager
();
76
77
//set mandatory initialization classes
78
runManager->
SetUserInitialization
(
new
DetectorConstruction
());
79
80
G4PhysListFactory
factory;
81
G4VModularPhysicsList
* phys = 0;
82
G4String
physName =
""
;
83
84
// Physics List name defined via 3nd argument
85
if
(argc==3) { physName = argv[2]; }
86
87
// Physics List is defined via environment variable PHYSLIST
88
if
(
""
== physName) {
89
char
* path = getenv(
"PHYSLIST"
);
90
if
(path) { physName =
G4String
(path); }
91
}
92
93
// if name is not known to the factory use FTFP_BERT
94
if
(
""
== physName || !factory.
IsReferencePhysList
(physName)) {
95
physName =
"FTFP_BERT"
;
96
}
97
98
// reference PhysicsList via its name
99
phys = factory.
GetReferencePhysList
(physName);
100
101
runManager->
SetUserInitialization
(phys);
102
103
runManager->
SetUserAction
(
new
PrimaryGeneratorAction
());
104
105
//set user action classes
106
runManager->
SetUserAction
(
new
RunAction
());
107
runManager->
SetUserAction
(
new
EventAction
());
108
109
//get the pointer to the User Interface manager
110
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
111
#ifdef G4VIS_USE
112
G4VisManager
* visManager = 0;
113
#endif
114
115
if
(argc==1)
// Define UI terminal for interactive mode
116
{
117
#ifdef G4VIS_USE
118
//visualization manager
119
visManager =
new
G4VisExecutive
;
120
visManager->
Initialize
();
121
#endif
122
#ifdef G4UI_USE
123
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
124
ui->
SessionStart
();
125
delete
ui;
126
#endif
127
}
128
else
// Batch mode
129
{
130
G4String
command =
"/control/execute "
;
131
G4String
fileName = argv[1];
132
UImanager->
ApplyCommand
(command+fileName);
133
}
134
135
//job termination
136
#ifdef G4VIS_USE
137
delete
visManager;
138
#endif
139
delete
runManager;
140
141
return
0;
142
}
143
144
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Generated on Sat May 25 2013 14:32:27 for Geant4 by
1.8.4