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
advanced
underground_physics
DMX.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
// --------------------------------------------------------------
28
// GEANT 4 - Underground Dark Matter Detector Advanced Example
29
//
30
// For information related to this code contact: Alex Howard
31
// e-mail: alexander.howard@cern.ch
32
// --------------------------------------------------------------
33
// Comments
34
//
35
// Underground Advanced example main program
36
// by A. Howard and H. Araujo
37
// (27th November 2001)
38
//
39
// main program
40
// --------------------------------------------------------------
41
42
#include "
G4RunManager.hh
"
43
#include "
G4UImanager.hh
"
44
45
#include "
Randomize.hh
"
46
47
#ifdef G4VIS_USE
48
#include "
G4VisExecutive.hh
"
49
#endif
50
51
#ifdef G4UI_USE
52
#include "
G4UIExecutive.hh
"
53
#endif
54
55
#include "
DMXAnalysisManager.hh
"
56
#include "
DMXDetectorConstruction.hh
"
57
#include "
DMXPhysicsList.hh
"
58
#include "
DMXPrimaryGeneratorAction.hh
"
59
#include "
DMXRunAction.hh
"
60
#include "
DMXEventAction.hh
"
61
#include "
DMXSteppingAction.hh
"
62
#include "
DMXStackingAction.hh
"
63
64
#include <vector>
65
66
int
main
(
int
argc,
char
** argv) {
67
68
// choose the Random engine
69
CLHEP::HepRandom::setTheEngine
(
new
CLHEP::RanecuEngine
);
70
71
// Construct the default run manager
72
G4RunManager
* runManager =
new
G4RunManager
;
73
74
// set mandatory initialization classes
75
DMXDetectorConstruction
* detector =
new
DMXDetectorConstruction
;
76
runManager->
SetUserInitialization
(detector);
77
runManager->
SetUserInitialization
(
new
DMXPhysicsList
);
78
79
#ifdef G4VIS_USE
80
// visualization manager
81
G4VisManager
* visManager =
new
G4VisExecutive
;
82
visManager->
Initialize
();
83
#endif
84
85
// output environment variables:
86
#ifdef G4ANALYSIS_USE
87
G4cout
<<
G4endl
<<
G4endl
<<
G4endl
88
<<
" User Environment "
<<
G4endl
89
<<
" Using AIDA 3.2.1 analysis "
<<
G4endl
;
90
#else
91
G4cout
<< G4endl << G4endl << G4endl
92
<<
" User Environment "
<< G4endl
93
<<
" G4ANALYSIS_USE environment variable not set, NO ANALYSIS "
94
<<
G4endl
;
95
#endif
96
97
#ifdef DMXENV_GPS_USE
98
G4cout
<<
" Using GPS and not DMX gun "
<<
G4endl
;
99
#else
100
G4cout
<<
" Using the DMX gun "
<<
G4endl
;
101
#endif
102
103
// set user action classes
104
DMXPrimaryGeneratorAction
* DMXGenerator =
new
DMXPrimaryGeneratorAction
;
105
runManager->
SetUserAction
(DMXGenerator);
106
// runManager->SetUserAction(new DMXPrimaryGeneratorAction);
107
// RunAction is inherited by EventAction for output filenames - will all
108
// change when implement proper analysis manager?
109
DMXRunAction
* DMXRun =
new
DMXRunAction
;
110
runManager->
SetUserAction
(DMXRun);
111
DMXEventAction
* eventAction =
new
DMXEventAction
(DMXRun,DMXGenerator);
112
runManager->
SetUserAction
(eventAction);
113
// eventAction is inherited by SteppingAction in order to switch colour
114
// flag:
115
runManager->
SetUserAction
(
new
DMXSteppingAction
(eventAction));
116
runManager->
SetUserAction
(
new
DMXStackingAction
);
117
118
//Initialize G4 kernel
119
runManager->
Initialize
();
120
121
// get the pointer to the User Interface manager
122
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
123
124
// Define UI session for interactive mode.
125
if
(argc == 1)
126
{
127
#ifdef G4UI_USE
128
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
129
#ifdef G4VIS_USE
130
UImanager->
ApplyCommand
(
"/control/execute initInter.mac"
);
131
#endif
132
ui->
SessionStart
();
133
delete
ui;
134
#endif
135
}
136
// Batch mode
137
else
138
{
139
G4String
command =
"/control/execute "
;
140
G4String
fileName = argv[1];
141
UImanager->
ApplyCommand
(command+fileName);
142
}
143
144
// job termination
145
#ifdef G4ANALYSIS_USE
146
DMXAnalysisManager::getInstance()->Finish();
147
G4cout
<<
"Analysis files closed"
<<
G4endl
;
148
#endif
149
150
#ifdef G4VIS_USE
151
if
(visManager)
delete
visManager;
152
#endif
153
delete
runManager;
154
155
return
0;
156
}
157
Generated on Sat May 25 2013 14:32:14 for Geant4 by
1.8.4