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
HepMCEx01.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file HepMCEx01.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
//
28
//
29
//
30
// --------------------------------------------------------------
31
// GEANT 4 - example derived from novice exampleN04
32
// --------------------------------------------------------------
33
34
#include "
G4Types.hh
"
35
36
#include "
FTFP_BERT.hh
"
37
#include "
G4RunManager.hh
"
38
#include "
G4UImanager.hh
"
39
40
#include "ExN04DetectorConstruction.hh"
41
#include "ExN04EventAction.hh"
42
#include "ExN04PrimaryGeneratorAction.hh"
43
#include "ExN04RunAction.hh"
44
#include "ExN04StackingAction.hh"
45
#include "ExN04SteppingAction.hh"
46
#include "ExN04SteppingVerbose.hh"
47
#include "ExN04TrackingAction.hh"
48
49
#include "
G4VisExecutive.hh
"
50
#include "
G4UIExecutive.hh
"
51
52
int
main
(
int
argc,
char
** argv)
53
{
54
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
55
G4UIExecutive
* ui =
nullptr
;
56
if
( argc == 1 ) {
57
ui =
new
G4UIExecutive
(argc, argv);
58
}
59
60
// User Verbose output class
61
//
62
G4VSteppingVerbose
* verbosity =
new
ExN04SteppingVerbose
;
63
G4VSteppingVerbose::SetInstance
(verbosity);
64
65
// Run manager
66
//
67
G4RunManager
* runManager =
new
G4RunManager
;
68
69
// User Initialization classes (mandatory)
70
//
71
G4VUserDetectorConstruction
* detector =
new
ExN04DetectorConstruction
;
72
runManager->
SetUserInitialization
(detector);
73
//
74
G4VUserPhysicsList
* physics =
new
FTFP_BERT
;
75
runManager->
SetUserInitialization
(physics);
76
77
runManager->
Initialize
();
78
79
// User Action classes
80
//
81
G4VUserPrimaryGeneratorAction
* gen_action =
new
ExN04PrimaryGeneratorAction
;
82
runManager->
SetUserAction
(gen_action);
83
//
84
G4UserRunAction
* run_action =
new
ExN04RunAction
;
85
runManager->
SetUserAction
(run_action);
86
//
87
G4UserEventAction
* event_action =
new
ExN04EventAction
;
88
runManager->
SetUserAction
(event_action);
89
//
90
G4UserStackingAction
* stacking_action =
new
ExN04StackingAction
;
91
runManager->
SetUserAction
(stacking_action);
92
//
93
G4UserTrackingAction
* tracking_action =
new
ExN04TrackingAction
;
94
runManager->
SetUserAction
(tracking_action);
95
//
96
G4UserSteppingAction
* stepping_action =
new
ExN04SteppingAction
;
97
runManager->
SetUserAction
(stepping_action);
98
99
G4VisManager
* visManager =
new
G4VisExecutive
;
100
visManager->
Initialize
();
101
102
//get the pointer to the User Interface manager
103
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
104
105
if
(!ui)
// batch mode
106
{
107
visManager->
SetVerboseLevel
(
"quiet"
);
108
G4String
command =
"/control/execute "
;
109
G4String
fileName = argv[1];
110
UImanager->
ApplyCommand
(command+fileName);
111
}
112
else
113
{
// interactive mode : define UI session
114
ui->
SessionStart
();
115
delete
ui;
116
}
117
118
// Free the store: user actions, physics_list and detector_description are
119
// owned and deleted by the run manager, so they should not
120
// be deleted in the main() program !
121
122
delete
visManager;
123
delete
runManager;
124
delete
verbosity;
125
}
geant4
tree
geant4-10.6-release
examples
extended
eventgenerator
HepMC
HepMCEx01
HepMCEx01.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:04
using
1.8.2 with
ECCE GitHub integration