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
microbeam
microbeam.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: Microbeam.cc,v 1.12 2010-11-17 20:42:14 allison Exp $
28
// -------------------------------------------------------------------
29
// GEANT4 - Microbeam example
30
// Developed by S. Incerti et al.
31
// Centre d'Etudes Nucleaires de Bordeaux-Gradignan
32
// CNRS / IN2P3 / Bordeaux 1 University
33
// 33175 Gradignan, France
34
// incerti@cenbg.in2p3.fr
35
// -------------------------------------------------------------------
36
37
#include "
G4RunManager.hh
"
38
#include "
G4UImanager.hh
"
39
#include "
Randomize.hh
"
40
41
#ifdef G4VIS_USE
42
#include "
G4VisExecutive.hh
"
43
#endif
44
45
#ifdef G4UI_USE
46
#include "
G4UIExecutive.hh
"
47
#endif
48
49
#include "
MicrobeamDetectorConstruction.hh
"
50
#include "
MicrobeamPhysicsList.hh
"
51
#include "
MicrobeamPrimaryGeneratorAction.hh
"
52
#include "
MicrobeamRunAction.hh
"
53
#include "
MicrobeamEventAction.hh
"
54
#include "
MicrobeamTrackingAction.hh
"
55
#include "
MicrobeamSteppingAction.hh
"
56
#include "
MicrobeamSteppingVerbose.hh
"
57
#include "
MicrobeamHistoManager.hh
"
58
59
int
main
(
int
argc,
char
** argv) {
60
61
// choose the Random engine
62
CLHEP::HepRandom::setTheEngine
(
new
CLHEP::RanecuEngine
);
63
64
// verbose output class
65
G4VSteppingVerbose::SetInstance
(
new
MicrobeamSteppingVerbose
);
66
67
// construct the default run manager
68
G4RunManager
* runManager =
new
G4RunManager
;
69
70
// set mandatory initialization classes
71
MicrobeamDetectorConstruction
* detector =
new
MicrobeamDetectorConstruction
;
72
73
runManager->
SetUserInitialization
(detector);
74
75
runManager->
SetUserInitialization
(
new
MicrobeamPhysicsList
);
76
77
#ifdef G4VIS_USE
78
// visualization manager
79
G4VisManager
* visManager =
new
G4VisExecutive
;
80
visManager->
Initialize
();
81
#endif
82
83
// set user action classes
84
MicrobeamPrimaryGeneratorAction
* KinAct =
new
MicrobeamPrimaryGeneratorAction
(detector);
85
runManager->
SetUserAction
(KinAct);
86
87
MicrobeamHistoManager
* histo =
new
MicrobeamHistoManager
();
88
89
MicrobeamRunAction
* RunAct =
new
MicrobeamRunAction
(detector,histo);
90
91
runManager->
SetUserAction
(RunAct);
92
runManager->
SetUserAction
(
new
MicrobeamEventAction
(RunAct,histo));
93
runManager->
SetUserAction
(
new
MicrobeamTrackingAction
(RunAct));
94
runManager->
SetUserAction
(
new
MicrobeamSteppingAction
(RunAct,detector,histo));
95
96
// initialize G4 kernel
97
// runManager->Initialize();
98
99
// get the pointer to the User Interface manager
100
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
101
102
// local user files created by the simulation
103
remove
(
"microbeam.root"
);
104
105
if
(argc==1)
// define UI session for interactive mode.
106
{
107
#ifdef G4UI_USE
108
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
109
#ifdef G4VIS_USE
110
UImanager->
ApplyCommand
(
"/control/execute microbeam.mac"
);
111
#endif
112
ui->
SessionStart
();
113
delete
ui;
114
#endif
115
}
116
else
// batch mode
117
{
118
G4String
command =
"/control/execute "
;
119
G4String
fileName = argv[1];
120
UImanager->
ApplyCommand
(command+fileName);
121
}
122
123
// job termination
124
#ifdef G4VIS_USE
125
delete
visManager;
126
#endif
127
delete
runManager;
128
129
return
0;
130
131
}
132
Generated on Sat May 25 2013 14:32:13 for Geant4 by
1.8.4