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
PurgMag.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PurgMag.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
// Code developed by:
27
// S.Larsson
28
//
29
// *********************
30
// * *
31
// * PurgMag.cc *
32
// * *
33
// *********************
34
//
35
//
36
// Comments: Main program for the Purgin Magnet example.
37
//
38
39
#include "
G4Types.hh
"
40
41
#ifdef G4MULTITHREADED
42
#include "
G4MTRunManager.hh
"
43
#else
44
#include "
G4RunManager.hh
"
45
#endif
46
47
#include "
G4UImanager.hh
"
48
#include "
Randomize.hh
"
49
#include "
G4VisExecutive.hh
"
50
#include "
G4UIExecutive.hh
"
51
#include "
PurgMagDetectorConstruction.hh
"
52
#include "
PurgMagPhysicsList.hh
"
53
#include "
PurgMagActionInitializer.hh
"
54
#include "
PurgMagAnalysisManager.hh
"
55
56
int
main
(
int
argc,
char
** argv) {
57
58
//choose the Random engine
59
G4Random::setTheEngine(
new
CLHEP::RanecuEngine
);
60
61
// Construct the default run manager
62
#ifdef G4MULTITHREADED
63
G4MTRunManager
* runManager =
new
G4MTRunManager
;
64
//runManager->SetNumberOfThreads(2);
65
#else
66
G4RunManager
* runManager =
new
G4RunManager
;
67
#endif
68
69
// set mandatory initialization classes
70
runManager->
SetUserInitialization
(
new
PurgMagDetectorConstruction
);
71
runManager->
SetUserInitialization
(
new
PurgMagPhysicsList
);
72
runManager->
SetUserInitialization
(
new
PurgMagActionInitializer
());
73
74
// visualization manager
75
G4VisManager
* visManager =
new
G4VisExecutive
;
76
visManager->
Initialize
();
77
78
//Initialize G4 kernel
79
runManager->
Initialize
();
80
81
// get the pointer to the User Interface manager
82
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
83
84
85
if
(argc==1)
// Define UI session for interactive mode.
86
{
87
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
88
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
89
ui->
SessionStart
();
90
delete
ui;
91
}
92
else
// Batch mode
93
{
94
G4String
command =
"/control/execute "
;
95
G4String
fileName = argv[1];
96
UImanager->
ApplyCommand
(command+fileName);
97
}
98
99
// Save histograms
100
G4AnalysisManager
* man =
G4AnalysisManager::Instance
();
101
man->
Write
();
102
man->
CloseFile
();
103
104
// job termination
105
delete
visManager;
106
107
delete
runManager;
108
109
return
0;
110
}
111
geant4
tree
geant4-10.6-release
examples
advanced
purging_magnet
PurgMag.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:00
using
1.8.2 with
ECCE GitHub integration