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
simulation.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file simulation.C
1
2
void
simulation
(Int_t
nEvents
= 1000)
3
{
4
// Load basic libraries;
5
gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C"
);
6
7
// Create the simulation run manager;
8
EicRunSim
*fRun =
new
EicRunSim
(
"TGeant3"
);
9
10
//fRun->SetCaveFileName("cave-120m-vacuum.geo");
11
fRun->
SetCaveFileName
(
"cave-120m-thin-air.geo"
);
12
fRun->
SetOutputFile
(
"simulation.root"
);
13
14
// Well, do not need secondaries in this simulation;
15
fRun->
SuppressSecondaries
();
16
17
fRun->
AddModule
(
new
EicTpc
(
"TPC/tpc-v01.0-ns.root"
));
18
fRun->
AddModule
(
new
EicMaps
(
"VST"
,
"../geometry/vst-v02.0-ns.root"
,
qVST
));
19
20
// Relevant part of the vacuum system;
21
#if 1//_RETURN_BACK_
22
{
23
fRun->
AddModule
(
new
EicDummyDetector
(
"VP.CENTER"
,
"pCDR-2018/geometry/vacuum.system/vp.center.root"
));
24
fRun->
AddModule
(
new
EicDummyDetector
(
"VP.H-GOING"
,
"pCDR-2018/geometry/vacuum.system/vp.h-going.root"
));
25
26
fRun->
AddModule
(
new
EicDummyDetector
(
"VP.H-GOING.GHOST"
,
"pCDR-2018/geometry/vacuum.system/vp.h-going.ghost.root"
));
27
}
28
{
29
unsigned
id
[] = {
/*103*/
106, 116
/*, 188*/
},
dim
=
sizeof
(id)/
sizeof
(
id
[0]);
30
for
(
unsigned
part
=0;
part
<
dim
;
part
++) {
31
unsigned
qid =
id
[
part
];
32
char
dname[128], fname[128];
33
34
sprintf(dname,
"VACUUM-%02d"
, qid);
35
sprintf(fname,
"../geometry/vacuum.system/00354-000%03d-step.stl"
, qid);
36
37
// FIXME: aluminum or stainless steel?;
38
EicCadFile
*cad =
new
EicCadFile
(dname, fname, qid == 103 ?
"beryllium"
:
"AA2219"
);
39
cad->
config
()->
SetUnits
(
eic::mm
);
40
cad->
SwapXY
();
41
if
(qid == 103 || qid == 106 || qid == 116) cad->
SetKillerFlag
();
42
//if (qid == 188) cad->SetKillerFlag();
43
fRun->
AddModule
(cad);
44
}
//for part
45
}
46
47
// B0 magnet geometry;
48
{
49
{
50
EicCadFile
*cad =
new
EicCadFile
(
"B0-YOKE"
,
"../geometry/b0magnet/yoke.mphtxt"
,
"iron"
, kBlue);
51
52
cad->
config
()->
SetUnits
(
eic::m
);
53
cad->
SetExtraStlTranslation
(0.0, 0.0, 560.0);
54
cad->
CreateStlMirrorCopyXY
();
55
cad->
CreateStlMirrorCopyXZ
();
56
fRun->
AddModule
(cad);
57
}
58
{
59
EicCadFile
*cad =
new
EicCadFile
(
"B0-COIL"
,
"../geometry/b0magnet/coil.mphtxt"
,
"copper"
, kRed);
60
61
cad->
config
()->
SetUnits
(
eic::m
);
62
cad->
SetExtraStlTranslation
(0.0, 0.0, 560.0);
63
cad->
CreateStlMirrorCopyXY
();
64
cad->
CreateStlMirrorCopyXZ
();
65
fRun->
AddModule
(cad);
66
}
67
// NB: may want to include HQE1 from "simple" magnetic elements instead?;
68
{
69
EicCadFile
*cad =
new
EicCadFile
(
"B0-COIL2"
,
"../geometry/b0magnet/coil2.mphtxt"
,
"copper"
);
70
71
cad->
config
()->
SetUnits
(
eic::m
);
72
cad->
SetExtraStlTranslation
(0.0, 0.0, 560.0);
73
//cad->CreateStlMirrorCopyXY();
74
//cad->CreateStlMirrorCopyXZ();
75
//fRun->AddModule(cad);
76
}
77
{
78
EicCadFile
*cad =
new
EicCadFile
(
"B0-SHIELDING"
,
"../geometry/b0magnet/shielding.mphtxt"
,
"iron"
);
79
80
cad->
config
()->
SetUnits
(
eic::m
);
81
cad->
SetExtraStlTranslation
(0.0, 0.0, 560.0);
82
//cad->CreateStlMirrorCopy();
83
//fRun->AddModule(cad);
84
}
85
{
86
// Really copper?;
87
EicCadFile
*cad =
new
EicCadFile
(
"B0-QUAD"
,
"../geometry/b0magnet/quad.mphtxt"
,
"copper"
);
88
89
cad->
config
()->
SetUnits
(
eic::m
);
90
cad->
SetExtraStlTranslation
(0.0, 0.0, 560.0);
91
//cad->CreateStlMirrorCopy();
92
//fRun->AddModule(cad);
93
}
94
}
95
#endif
96
97
// Hadron-going direction detectors;
98
fRun->
AddModule
(
new
EicDetector
(
"IPPT"
,
"../geometry/ip-point.root"
,
qDUMMY
,
qMergeStepsInOneHit
));
99
fRun->
AddModule
(
new
EicDetector
(
"B0TRACKER"
,
"../geometry/b0tracker.root"
,
qDUMMY
,
qMergeStepsInOneHit
));
100
fRun->
AddModule
(
new
EicDetector
(
"RP"
,
"../geometry/rp.root"
,
qDUMMY
,
qMergeStepsInOneHit
));
101
//{
102
//EicDetector *zdc = new EicDetector("ZDC", "../geometry/zdc.root",qDUMMY, qMergeStepsInOneHit);
103
//zdc->AddKillerVolume("ZdcBox");
104
//fRun->AddModule(zdc);
105
//}
106
107
// Event generator;
108
#if 1
109
{
110
// Box generator;
111
int
PDG = 2212;
112
EicBoxGenerator
* boxGen =
new
EicBoxGenerator
(PDG);
113
114
boxGen->
SetMomentum
(275.);
115
boxGen->
SetTheta
(0.0);
//Range(0.003 * TMath::RadToDeg(), 0.010 * TMath::RadToDeg()); //boxGen->SetPhi(45.0);
116
//boxGen->SetTheta(0.003 * TMath::RadToDeg()); //boxGen->SetPhi(45.0);
117
//boxGen->SetTheta(0.013 * TMath::RadToDeg()); //boxGen->SetPhi(45.0);
118
119
boxGen->
SetVertex
(0.000, 0.000, -1.0);
// may want to offset in Z in order to get IPPT "hit";
120
//boxGen->SetVertexSmearing(0.010, 0.002, 0.0); // H:100um and V:20um for now;
121
122
boxGen->
SetNaiveHorizontalBeamRotation
(0.022);
123
fRun->
AddGenerator
(boxGen);
124
}
125
#else
126
{
127
// Physics generator;
128
TString evFile =
"../../data/asc_5x41_dvcs-1M-lines.out"
;
129
//TString evFile = "../../data/ePb_18x110_Q2_1_10_y_0.01_0.95_tau_7_noquench_kt=ptfrag=0.32_Shd3_ShdFac=1.32_Jpsidiffnodecay_fixpfUS3_seqnp_40k.a.root";
130
//TString evFile = "../../data/asc_10x100_dvcs-1M-lines.out";
131
132
EicEventGenerator
* evtGen =
new
EicEventGenerator
(evFile.Data());
133
134
// Select primary protons only; ignore all the rest;
135
evtGen->
SelectPdgCode
(2212);
136
evtGen->
SelectLeadingParticle
();
137
evtGen->
SetNaiveHorizontalBeamRotation
(0.022);
138
139
fRun->
AddGenerator
(evtGen);
140
}
141
#endif
142
143
// Magnetic field; NB: rescale properly!;
144
{
145
EicMagneticField
*fField =
new
EicMagneticField
();
146
147
fField->
AddBeamLineElementGrads
(
"IR/pCDR-2018/madx/H.H-GOING"
,275./275., kBlue);
148
//fField->AddBeamLineElementGrads("IR/pCDR-2018/madx/H.H-GOING", 100./275., kBlue);
149
//fField->AddBeamLineElementGrads("IR/pCDR-2018/madx/H.H-GOING", 275./275., kBlue);
150
fField->
SuppressYokeCreation
(
"YO5_HB0"
);
151
152
fField->
AddBeamLineElementGrads
(
"IR/pCDR-2018/madx/E.H-GOING"
, 5./10., kGreen);
153
//fField->AddBeamLineElementGrads("IR/pCDR-2018/madx/E.H-GOING", 10./10., kGreen);
154
155
fField->
CreateYokeVolumes
(kTRUE);
156
157
fRun->
SetField
(fField);
158
}
159
160
// Initialize and run the simulation; exit at the end;
161
fRun->
Run
(
nEvents
);
162
}
// simulation()
EicRoot
blob
master
pCDR-2018
b0rp
simulation.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:36
using
1.8.2 with
EIC GitHub integration