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
novice
N07
exampleN07.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
// $Id$
28
//
29
//
30
// --------------------------------------------------------------
31
// GEANT 4 - exampleN07
32
// --------------------------------------------------------------
33
34
#include "
G4RunManager.hh
"
35
#include "
G4UImanager.hh
"
36
37
#ifdef G4VIS_USE
38
#include "
G4VisExecutive.hh
"
39
#endif
40
41
#ifdef G4UI_USE
42
#include "
G4UIExecutive.hh
"
43
#endif
44
45
#include "
ExN07DetectorConstruction.hh
"
46
#include "
ExN07ParallelWorld.hh
"
47
#include "
ExN07PhysicsList.hh
"
48
#include "
ExN07PrimaryGeneratorAction.hh
"
49
#include "
ExN07RunAction.hh
"
50
#include "
ExN07SteppingVerbose.hh
"
51
52
int
main
(
int
argc,
char
** argv)
53
{
54
// Construct the stepping verbose class
55
ExN07SteppingVerbose
* verbosity =
new
ExN07SteppingVerbose
;
56
G4VSteppingVerbose::SetInstance
(verbosity);
57
58
// Construct the run manager
59
//
60
G4RunManager
* runManager =
new
G4RunManager
;
61
62
// Set mandatory initialization classes
63
//
64
G4VUserDetectorConstruction
* detector =
new
ExN07DetectorConstruction
;
65
detector->
RegisterParallelWorld
(
new
ExN07ParallelWorld
(
"ParallelScoringWorld"
));
66
runManager->
SetUserInitialization
(detector);
67
//
68
G4VUserPhysicsList
* physics =
new
ExN07PhysicsList
;
69
runManager->
SetUserInitialization
(physics);
70
71
// Set user action classes
72
//
73
G4VUserPrimaryGeneratorAction
* gen_action =
new
ExN07PrimaryGeneratorAction
;
74
runManager->
SetUserAction
(gen_action);
75
//
76
G4UserRunAction
* run_action =
new
ExN07RunAction
;
77
runManager->
SetUserAction
(run_action);
78
79
#ifdef G4VIS_USE
80
// Visualization manager
81
//
82
G4VisManager
* visManager =
new
G4VisExecutive
;
83
visManager->
Initialize
();
84
#endif
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
(argc==1)
// Define UI session for interactive mode
95
{
96
#ifdef G4UI_USE
97
G4UIExecutive
* ui =
new
G4UIExecutive
(argc,argv);
98
#ifdef G4VIS_USE
99
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
100
#endif
101
ui->
SessionStart
();
102
delete
ui;
103
#endif
104
}
105
else
// Batch mode
106
{
107
G4String
command =
"/control/execute "
;
108
G4String
fileName = argv[1];
109
UImanager->
ApplyCommand
(command+fileName);
110
}
111
112
// Job termination
113
// Free the store: user actions, physics_list and detector_description are
114
// owned and deleted by the run manager, so they should not
115
// be deleted in the main() program !
116
117
#ifdef G4VIS_USE
118
delete
visManager;
119
#endif
120
delete
runManager;
121
122
return
0;
123
}
Generated on Sat May 25 2013 14:33:02 for Geant4 by
1.8.4