EIC Software
Reference for
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
Fun4All_G4_EicDirc.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Fun4All_G4_EicDirc.C
1
#include <
fun4all/Fun4AllDstOutputManager.h
>
2
#include <
fun4all/Fun4AllDummyInputManager.h
>
3
#include <
fun4all/Fun4AllInputManager.h
>
4
#include <
fun4all/Fun4AllOutputManager.h
>
5
#include <
fun4all/Fun4AllServer.h
>
6
#include <
fun4all/SubsysReco.h
>
7
#include <
g4detectors/PHG4CylinderSubsystem.h
>
8
#include <
g4main/PHG4ParticleGenerator.h
>
9
#include <
g4main/PHG4TruthSubsystem.h
>
10
#include <
g4main/PHG4Reco.h
>
11
#include <
phool/recoConsts.h
>
12
#include <
g4eicdirc/G4EicDircSubsystem.h
>
13
14
R__LOAD_LIBRARY
(libfun4all.so)
15
R__LOAD_LIBRARY
(libg4testbench.so)
16
R__LOAD_LIBRARY
(libg4detectors.so)
17
R__LOAD_LIBRARY
(libg4eicdirc.so)
18
19
int
Fun4All_G4_EicDirc
(const
int
nEvents
= 1000, const
char
*outfile = NULL)
20
{
22
// Make the Server
24
Fun4AllServer
*se =
Fun4AllServer::instance
();
25
se->
Verbosity
(0);
26
27
recoConsts
*rc =
recoConsts::instance
();
28
// rc->set_IntFlag("RANDOMSEED", 12345); // if you want to use a fixed seed
29
// PHG4ParticleGenerator generates particle
30
// distributions in eta/phi/mom range
31
PHG4ParticleGenerator
*gen =
new
PHG4ParticleGenerator
(
"PGENERATOR"
);
32
gen->
set_name
(
"e+"
);
33
gen->
set_vtx
(0, 0, 0);
34
gen->
set_eta_range
(-0.5, +0.5);
35
gen->
set_mom_range
(0.5, 0.5);
// GeV/c
36
// gen->set_phi_range(0., 90. / 180. * TMath::Pi()); // 0-90 deg
37
se->
registerSubsystem
(gen);
38
39
40
PHG4Reco
*g4Reco =
new
PHG4Reco
();
41
g4Reco->
set_field
(1.5);
// 1.5 T solenoidal field
42
43
G4EicDircSubsystem
*eicdirc =
new
G4EicDircSubsystem
();
44
g4Reco->
registerSubsystem
(eicdirc);
45
46
47
// Black hole swallows everything - prevent loopers from returning
48
// to inner detectors
49
PHG4CylinderSubsystem
*cyl =
new
PHG4CylinderSubsystem
(
"BlackHole"
, 0);
50
cyl->
set_double_param
(
"radius"
, 80);
// 80 cm
51
cyl->
set_double_param
(
"thickness"
, 0.1);
// does not matter (but > 0)
52
cyl->
SetActive
();
53
cyl->
BlackHole
();
// eats everything
54
g4Reco->
registerSubsystem
(cyl);
55
56
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
57
g4Reco->
registerSubsystem
(truth);
58
59
se->
registerSubsystem
(g4Reco);
60
61
//---------------------------
62
63
//---------------------------
64
// output DST file for further offlien analysis
65
//---------------------------
66
if
(outfile)
67
{
68
Fun4AllOutputManager
*out =
new
Fun4AllDstOutputManager
(
"DSTOUT"
, outfile);
69
se->
registerOutputManager
(out);
70
}
71
Fun4AllInputManager
*
in
=
new
Fun4AllDummyInputManager
(
"JADE"
);
72
se->
registerInputManager
(in);
73
74
if
(nEvents > 0)
75
{
76
se->
run
(nEvents);
77
// finish job - close and save output files
78
se->
End
();
79
std::cout <<
"All done"
<< std::endl;
80
81
// cleanup - delete the server and exit
82
delete
se;
83
gSystem->Exit(0);
84
}
85
return
0;
86
}
87
88
PHG4ParticleGenerator
*
get_gen
(
const
char
*
name
=
"PGENERATOR"
)
89
{
90
Fun4AllServer
*se =
Fun4AllServer::instance
();
91
PHG4ParticleGenerator
*pgun = (
PHG4ParticleGenerator
*) se->
getSubsysReco
(
name
);
92
return
pgun;
93
}
fun4all_eicmacros
blob
master
detectors
EicDirc
Fun4All_G4_EicDirc.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration