ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
XrayFluoSimulation.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file XrayFluoSimulation.cc
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
// Author: Elena Guardincerri
29
//
30
// History:
31
// -----------
32
// 28 Nov 2001 Elena Guardincerri Created
33
// 24 Ago 2002 Splitted in a separet class Alfonso Mantero
34
// 18 Jan 2011 adapted to new deexcitation design
35
//
36
// -------------------------------------------------------------------
37
38
#include "
G4Types.hh
"
39
40
#ifdef G4MULTITHREADED
41
#include "
G4MTRunManager.hh
"
42
#else
43
#include "
G4RunManager.hh
"
44
#endif
45
46
#include "
G4UImanager.hh
"
47
#include "
Randomize.hh
"
48
#include "
G4VisExecutive.hh
"
49
#include "
G4UIExecutive.hh
"
50
#include "
XrayFluoDetectorConstruction.hh
"
51
#include "
XrayFluoPlaneDetectorConstruction.hh
"
52
#include "
XrayFluoMercuryDetectorConstruction.hh
"
53
#include "
XrayFluoPhysicsList.hh
"
54
#include "
XrayFluoSimulation.hh
"
55
56
#include "
XrayFluoActionInitializer.hh
"
57
#include "
XrayFluoAnalysisManager.hh
"
58
59
60
XrayFluoSimulation::XrayFluoSimulation
(
G4int
seed
):
dir
(seed)
61
{;}
62
63
64
XrayFluoSimulation::~XrayFluoSimulation
()
65
{;}
66
67
void
XrayFluoSimulation::RunSimulation
(
int
argc,
char
* argv[])
68
{
69
// choose the Random engine
70
G4Random::setTheEngine(
new
CLHEP::RanecuEngine
);
71
G4Random::setTheSeed(
dir
);
72
73
#ifdef G4MULTITHREADED
74
// Construct the default run manager
75
G4MTRunManager
* runManager =
new
G4MTRunManager
();
76
G4cout
<<
"Using the MT Run Manager (G4MULTITHREADED=ON)"
<<
G4endl
;
77
#else
78
G4RunManager
* runManager =
new
G4RunManager
;
79
G4cout
<<
"Using the sequential Run Manager"
<<
G4endl
;
80
#endif
81
82
83
// chosing Geometry setup
84
G4int
geometryNumber = 0;
85
86
if
(argc == 3){
87
geometryNumber = atoi(argv[2]);
88
89
}
90
while
( (geometryNumber < 1) || (geometryNumber >4)) {
91
G4cout
<<
"Please Select Simulation Geometrical Set-Up: "
<<
G4endl
;
92
G4cout
<<
"1 - Test Beam"
<<
G4endl
;
93
G4cout
<<
"2 - Infinite Plane"
<<
G4endl
;
94
G4cout
<<
"3 - Planet and Sun"
<<
G4endl
;
95
G4cout
<<
"4 - Phase-Space Production"
<<
G4endl
;
96
97
G4cin
>> geometryNumber;
98
}
99
100
// set analysis to have the messenger running...
101
XrayFluoAnalysisManager
*
analysis
=
102
XrayFluoAnalysisManager::getInstance
();
103
104
// set mandatory initialization
105
106
//Initialize geometry
107
if
(geometryNumber == 1 || geometryNumber == 4) {
108
XrayFluoDetectorConstruction
* testBeamDetector
109
=
XrayFluoDetectorConstruction::GetInstance
();
110
if
(geometryNumber == 4) {
111
testBeamDetector->
PhaseSpaceOn
();
112
analysis->
PhaseSpaceOn
();
113
}
114
runManager->
SetUserInitialization
(testBeamDetector);
115
}
116
else
if
(geometryNumber == 2) {
117
XrayFluoPlaneDetectorConstruction
*
118
planeDetector =
XrayFluoPlaneDetectorConstruction::GetInstance
();
119
runManager->
SetUserInitialization
(planeDetector);
120
}
121
else
if
(geometryNumber == 3) {
122
XrayFluoMercuryDetectorConstruction
* mercuryDetector =
123
XrayFluoMercuryDetectorConstruction::GetInstance
();
124
runManager->
SetUserInitialization
(mercuryDetector);
125
}
126
127
128
//Initialize physics
129
runManager->
SetUserInitialization
(
new
XrayFluoPhysicsList
());
130
131
//Initialize actions
132
runManager->
SetUserInitialization
133
(
new
XrayFluoActionInitializer
(geometryNumber));
134
135
//visualization manager
136
G4VisManager
* visManager =
new
G4VisExecutive
;
137
visManager->
Initialize
();
138
139
// get the pointer to the User Interface manager
140
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
141
142
if
(argc == 1)
// Define UI session for interactive mode.
143
{
144
UImanager->
ApplyCommand
(
"/control/execute initInter.mac"
);
145
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
146
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
147
ui->
SessionStart
();
148
delete
ui;
149
}
150
else
// Batch mode
151
{
152
G4String
command =
"/control/execute "
;
153
G4String
fileName = argv[1];
154
UImanager->
ApplyCommand
(command+fileName);
155
}
156
157
// job termination
158
delete
visManager;
159
G4cout
<<
"visManager deleted"
<<
G4endl
;
160
161
delete
runManager;
162
}
geant4
tree
geant4-10.6-release
examples
advanced
xray_fluorescence
src
XrayFluoSimulation.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:01
using
1.8.2 with
ECCE GitHub integration