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
Fun4All_G4_Momentum_Projection_Calorimeters.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Fun4All_G4_Momentum_Projection_Calorimeters.C
1
#ifndef FUN4ALL_G4_MOMENTUM_PROJECTION_CALORIMETERS_C
2
#define FUN4ALL_G4_MOMENTUM_PROJECTION_CALORIMETERS_C
3
4
#include "
G4_CEmc_Spacal.C
"
5
6
#include <
g4detectors/PHG4CylinderSubsystem.h
>
7
8
#include <
g4trackfastsim/PHG4TrackFastSim.h
>
9
#include <
g4trackfastsim/PHG4TrackFastSimEval.h
>
10
11
#include <
g4main/PHG4ParticleGenerator.h
>
12
#include <
g4main/PHG4ParticleGun.h
>
13
#include <
g4main/PHG4Reco.h
>
14
#include <
g4main/PHG4TruthSubsystem.h
>
15
16
#include <
fun4all/Fun4AllDstOutputManager.h
>
17
#include <
fun4all/Fun4AllDummyInputManager.h
>
18
#include <
fun4all/Fun4AllInputManager.h
>
19
#include <
fun4all/Fun4AllOutputManager.h
>
20
#include <
fun4all/Fun4AllServer.h
>
21
#include <
fun4all/SubsysReco.h
>
22
23
#include <
phool/recoConsts.h
>
24
25
R__LOAD_LIBRARY
(libfun4all.so)
26
R__LOAD_LIBRARY
(libg4testbench.so)
27
R__LOAD_LIBRARY
(libg4detectors.so)
28
R__LOAD_LIBRARY
(libg4trackfastsim.so)
29
30
int
Fun4All_G4_Momentum_Projection_Calorimeters
(const
int
nEvents
= 1000, const
string
&evalfile = "FastTrackingEval.root", const
string
&outfile = "")
31
{
33
// Make the Server
35
Fun4AllServer
*se =
Fun4AllServer::instance
();
36
se->
Verbosity
(0);
37
38
recoConsts
*rc =
recoConsts::instance
();
39
// if you want to use a fixed seed for reproducible results
40
// rc->set_IntFlag("RANDOMSEED", 12345); // if you want to use a fixed seed
41
// PHG4ParticleGenerator generates particle
42
// distributions in eta/phi/mom range
43
PHG4ParticleGenerator
*gen =
new
PHG4ParticleGenerator
(
"PGENERATOR"
);
44
gen->
set_name
(
"pi-"
);
45
gen->
set_vtx
(0, 0, 0);
46
gen->
set_eta_range
(-1, 1.);
47
gen->
set_mom_range
(2, 2);
// GeV/c
48
gen->
set_phi_range
(0., 90. / 180. * TMath::Pi());
// 0-90 deg
49
se->
registerSubsystem
(gen);
50
51
PHG4Reco
*g4Reco =
new
PHG4Reco
();
52
g4Reco->
set_field
(1.5);
// 1.5 T solenoidal field
53
54
double
si_thickness[6] = {0.02, 0.02, 0.0625, 0.032, 0.032, 0.032};
55
double
svxrad[6] = {2.71, 4.63, 11.765, 25.46, 41.38, 63.66};
56
double
length
[6] = {20., 20., 36., -1., -1., -1.};
// -1 use eta coverage to determine length
57
PHG4CylinderSubsystem
*cyl;
58
// here is our silicon:
59
for
(
int
ilayer = 0; ilayer < 6; ilayer++)
60
{
61
cyl =
new
PHG4CylinderSubsystem
(
"SVTX"
, ilayer);
62
cyl->
set_double_param
(
"radius"
, svxrad[ilayer]);
63
cyl->
set_string_param
(
"material"
,
"G4_Si"
);
64
cyl->
set_double_param
(
"thickness"
, si_thickness[ilayer]);
65
cyl->
SetActive
();
66
cyl->
SuperDetector
(
"SVTX"
);
67
if
(length[ilayer] > 0)
68
{
69
cyl->
set_double_param
(
"length"
, length[ilayer]);
70
}
71
g4Reco->
registerSubsystem
(cyl);
72
}
73
74
CEmc
(g4Reco, 25, 4);
75
76
// Black hole swallows everything - prevent loopers from returning
77
// to inner detectors
78
cyl =
new
PHG4CylinderSubsystem
(
"BlackHole"
, 0);
79
cyl->
set_double_param
(
"radius"
, 100);
// 80 cm
80
cyl->
set_double_param
(
"thickness"
, 0.1);
// does not matter (but > 0)
81
cyl->
SetActive
();
82
cyl->
BlackHole
();
// eats everything
83
g4Reco->
registerSubsystem
(cyl);
84
85
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
86
g4Reco->
registerSubsystem
(truth);
87
88
se->
registerSubsystem
(g4Reco);
89
90
CEMC_Cells
();
91
CEMC_Towers
();
92
93
//---------------------------
94
// fast pattern recognition and full Kalman filter
95
// output evaluation file for truth track and reco tracks are PHG4TruthInfoContainer
96
//---------------------------
97
PHG4TrackFastSim
*kalman =
new
PHG4TrackFastSim
(
"PHG4TrackFastSim"
);
98
kalman->
set_use_vertex_in_fitting
(
false
);
99
kalman->
set_sub_top_node_name
(
"SVTX"
);
100
kalman->
set_trackmap_out_name
(
"SvtxTrackMap"
);
101
102
// add Si Trtacker
103
kalman->
add_phg4hits
(
104
"G4HIT_SVTX"
,
// const std::string& phg4hitsNames,
105
PHG4TrackFastSim::Cylinder
,
// const DETECTOR_TYPE phg4dettype,
106
300
e
-4,
// radial-resolution [cm]
107
30
e
-4,
// azimuthal-resolution [cm]
108
1,
// z-resolution [cm]
109
1,
// efficiency,
110
0
// noise hits
111
);
112
113
kalman->
add_state_name
(
"CEMC"
);
114
115
se->
registerSubsystem
(kalman);
116
117
PHG4TrackFastSimEval
*fast_sim_eval =
new
PHG4TrackFastSimEval
(
"FastTrackingEval"
);
118
fast_sim_eval->
set_filename
(evalfile);
119
fast_sim_eval->
AddProjection
(
"CEMC"
);
120
121
se->
registerSubsystem
(fast_sim_eval);
122
123
//---------------------------
124
// output DST file for further offlien analysis
125
//---------------------------
126
if
(!outfile.empty())
127
{
128
Fun4AllOutputManager
*out =
new
Fun4AllDstOutputManager
(
"DSTOUT"
, outfile);
129
se->
registerOutputManager
(out);
130
}
131
Fun4AllInputManager
*
in
=
new
Fun4AllDummyInputManager
(
"ANA"
);
132
se->
registerInputManager
(in);
133
134
if
(nEvents > 0)
135
{
136
se->
run
(nEvents);
137
// finish job - close and save output files
138
se->
End
();
139
std::cout <<
"All done"
<< std::endl;
140
141
// cleanup - delete the server and exit
142
delete
se;
143
gSystem->Exit(0);
144
}
145
return
0;
146
}
147
148
PHG4ParticleGenerator
*
get_gen
(
const
char
*
name
=
"PGENERATOR"
)
149
{
150
Fun4AllServer
*se =
Fun4AllServer::instance
();
151
PHG4ParticleGenerator
*pgun = (
PHG4ParticleGenerator
*) se->
getSubsysReco
(
name
);
152
return
pgun;
153
}
154
155
#endif
tutorials
blob
master
Momentum
Fun4All_G4_Momentum_Projection_Calorimeters.C
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:26:00
using
1.8.2 with
ECCE GitHub integration