Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
detector_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
detector_benchmarks
Merge requests
!92
Draft: Resolve "Add TOF benchmark"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: Resolve "Add TOF benchmark"
57-add-tof-benchmark
into
master
Overview
0
Commits
34
Pipelines
0
Changes
7
Closed
Zhenyu Ye
requested to merge
57-add-tof-benchmark
into
master
3 years ago
Overview
0
Commits
34
Pipelines
0
Changes
7
Expand
Closes
#57 (closed)
0
0
Merge request reports
Compare
master
version 33
53a86efd
3 years ago
version 32
2148a8a8
3 years ago
version 31
fd527957
3 years ago
version 30
db1cd74a
3 years ago
version 29
21a7d556
3 years ago
version 28
ad4fadd3
3 years ago
version 27
19de0a0a
3 years ago
version 26
fd459df1
3 years ago
version 25
222c07ea
3 years ago
version 24
a156caf4
3 years ago
version 23
5ae60de7
3 years ago
version 22
14830aa0
3 years ago
version 21
1cdd861c
3 years ago
version 20
7a9b4fcb
3 years ago
version 19
523a9270
3 years ago
version 18
06a696f0
3 years ago
version 17
b959c02a
3 years ago
version 16
040475b5
3 years ago
version 15
8ae29c9d
3 years ago
version 14
757507e5
3 years ago
version 13
76cc10d4
3 years ago
version 12
b86ee6b7
3 years ago
version 11
b5e41007
3 years ago
version 10
c4c28d73
3 years ago
version 9
87155f7b
3 years ago
version 8
c91c1683
3 years ago
version 7
e18537d7
3 years ago
version 6
0f9c17d5
3 years ago
version 5
61cf8be4
3 years ago
version 4
2baeda76
3 years ago
version 3
44ee9b30
3 years ago
version 2
46e90855
3 years ago
version 1
a07c8912
3 years ago
master (base)
and
latest version
latest version
094d77e1
34 commits,
3 years ago
version 33
53a86efd
33 commits,
3 years ago
version 32
2148a8a8
32 commits,
3 years ago
version 31
fd527957
31 commits,
3 years ago
version 30
db1cd74a
30 commits,
3 years ago
version 29
21a7d556
29 commits,
3 years ago
version 28
ad4fadd3
28 commits,
3 years ago
version 27
19de0a0a
27 commits,
3 years ago
version 26
fd459df1
26 commits,
3 years ago
version 25
222c07ea
25 commits,
3 years ago
version 24
a156caf4
24 commits,
3 years ago
version 23
5ae60de7
23 commits,
3 years ago
version 22
14830aa0
22 commits,
3 years ago
version 21
1cdd861c
21 commits,
3 years ago
version 20
7a9b4fcb
20 commits,
3 years ago
version 19
523a9270
19 commits,
3 years ago
version 18
06a696f0
18 commits,
3 years ago
version 17
b959c02a
17 commits,
3 years ago
version 16
040475b5
16 commits,
3 years ago
version 15
8ae29c9d
15 commits,
3 years ago
version 14
757507e5
14 commits,
3 years ago
version 13
76cc10d4
13 commits,
3 years ago
version 12
b86ee6b7
12 commits,
3 years ago
version 11
b5e41007
11 commits,
3 years ago
version 10
c4c28d73
10 commits,
3 years ago
version 9
87155f7b
9 commits,
3 years ago
version 8
c91c1683
8 commits,
3 years ago
version 7
e18537d7
7 commits,
3 years ago
version 6
0f9c17d5
6 commits,
3 years ago
version 5
61cf8be4
5 commits,
3 years ago
version 4
2baeda76
4 commits,
3 years ago
version 3
44ee9b30
3 commits,
3 years ago
version 2
46e90855
2 commits,
3 years ago
version 1
a07c8912
1 commit,
3 years ago
7 files
+
905
−
54
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
benchmarks/tof/scripts/gen_tof_hits.cxx
0 → 100644
+
100
−
0
Options
#include
"HepMC3/GenEvent.h"
#include
"HepMC3/ReaderAscii.h"
#include
"HepMC3/WriterAscii.h"
#include
"HepMC3/Print.h"
#include
<iostream>
#include
<random>
#include
<cmath>
#include
<math.h>
#include
<TMath.h>
using
namespace
HepMC3
;
/** Generate multiple electrons/positron tracks in the central region.
* This is for testing detectors in the "barrel" region.
*/
void
gen_tof_hits
(
int
n_events
=
100
,
const
char
*
out_fname
=
"tof_hits.hepmc"
,
int
n_parts
=
2
)
{
double
cos_theta_min
=
std
::
cos
(
1.0
*
(
M_PI
/
180.0
));
double
cos_theta_max
=
std
::
cos
(
189.0
*
(
M_PI
/
180.0
));
WriterAscii
hepmc_output
(
out_fname
);
int
events_parsed
=
0
;
GenEvent
evt
(
Units
::
GEV
,
Units
::
MM
);
// Random number generator
TRandom
*
r1
=
new
TRandom
();
for
(
events_parsed
=
0
;
events_parsed
<
n_events
;
events_parsed
++
)
{
// FourVector(px,py,pz,e,pdgid,status)
// type 4 is beam
// pdgid 11 - electron
// pdgid 111 - pi0
// pdgid 2212 - proton
Double_t
p
=
r1
->
Uniform
(
0.2
,
4
);
Double_t
costh
=
-
1
*
cos
(
12.
/
180
*
3.1415926
);
//r1->Uniform(cos_theta_min, cos_theta_max);
Double_t
th
=
std
::
acos
(
costh
);
Double_t
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
Double_t
px
=
p
*
std
::
cos
(
phi
)
*
std
::
sin
(
th
);
Double_t
py
=
p
*
std
::
sin
(
phi
)
*
std
::
sin
(
th
);
Double_t
pz
=
p
*
std
::
cos
(
th
);
for
(
int
ip
=
0
;
ip
<
n_parts
;
ip
++
)
{
GenParticlePtr
p1
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
0.0
,
0.0
,
10.0
,
10.0
),
11
,
4
);
GenParticlePtr
p2
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
0.0
,
0.0
,
0.0
,
0.938
),
2212
,
4
);
// Define momentum
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
px
=
p
*
std
::
cos
(
phi
)
*
std
::
sin
(
th
);
py
=
p
*
std
::
sin
(
phi
)
*
std
::
sin
(
th
);
pz
=
p
*
std
::
cos
(
th
);
GenParticlePtr
p3
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
(
p
*
p
+
(
0.000511
*
0.000511
))),
((
ip
%
2
==
0
)
?
11
:
-
11
),
1
);
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
px
=
p
*
std
::
cos
(
phi
)
*
std
::
sin
(
th
);
py
=
p
*
std
::
sin
(
phi
)
*
std
::
sin
(
th
);
pz
=
p
*
std
::
cos
(
th
);
GenParticlePtr
p4
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
(
p
*
p
+
(
0.938272
*
0.938272
))),
((
ip
%
2
==
0
)
?
2212
:
-
2212
),
1
);
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
px
=
p
*
std
::
cos
(
phi
)
*
std
::
sin
(
th
);
py
=
p
*
std
::
sin
(
phi
)
*
std
::
sin
(
th
);
pz
=
p
*
std
::
cos
(
th
);
GenParticlePtr
p5
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
(
p
*
p
+
(
0.493677
*
0.493677
))),
((
ip
%
2
==
0
)
?
321
:
-
321
),
1
);
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
px
=
p
*
std
::
cos
(
phi
)
*
std
::
sin
(
th
);
py
=
p
*
std
::
sin
(
phi
)
*
std
::
sin
(
th
);
pz
=
p
*
std
::
cos
(
th
);
GenParticlePtr
p6
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
(
p
*
p
+
(
0.139570
*
0.139570
))),
((
ip
%
2
==
0
)
?
211
:
-
211
),
1
);
GenVertexPtr
v1
=
std
::
make_shared
<
GenVertex
>
();
v1
->
add_particle_in
(
p1
);
v1
->
add_particle_in
(
p2
);
v1
->
add_particle_out
(
p3
);
v1
->
add_particle_out
(
p4
);
v1
->
add_particle_out
(
p5
);
v1
->
add_particle_out
(
p6
);
evt
.
add_vertex
(
v1
);
}
if
(
events_parsed
==
0
)
{
std
::
cout
<<
"First event: "
<<
std
::
endl
;
Print
::
listing
(
evt
);
}
hepmc_output
.
write_event
(
evt
);
if
(
events_parsed
%
10000
==
0
)
{
std
::
cout
<<
"Event: "
<<
events_parsed
<<
std
::
endl
;
}
evt
.
clear
();
}
hepmc_output
.
close
();
std
::
cout
<<
"Events parsed and written: "
<<
events_parsed
<<
std
::
endl
;
}
Loading