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
!82
Adding tracking_detectors benchmarks directory
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Adding tracking_detectors benchmarks directory
tracking_detectors
into
master
Overview
0
Commits
11
Pipelines
0
Changes
5
Merged
Whitney Armstrong
requested to merge
tracking_detectors
into
master
3 years ago
Overview
0
Commits
11
Pipelines
0
Changes
5
Expand
This is for inspecting /testing tracking hits straight from geant4
0
0
Merge request reports
Compare
master
version 9
bd2409bd
3 years ago
version 8
b841b7c0
3 years ago
version 7
c83d9e12
3 years ago
version 6
fbe61a9f
3 years ago
version 5
f1f418d9
3 years ago
version 4
8279412c
3 years ago
version 3
7ff58d36
3 years ago
version 2
d75010a9
3 years ago
version 1
20022829
3 years ago
master (base)
and
latest version
latest version
10a744ff
11 commits,
3 years ago
version 9
bd2409bd
10 commits,
3 years ago
version 8
b841b7c0
9 commits,
3 years ago
version 7
c83d9e12
8 commits,
3 years ago
version 6
fbe61a9f
7 commits,
3 years ago
version 5
f1f418d9
6 commits,
3 years ago
version 4
8279412c
5 commits,
3 years ago
version 3
7ff58d36
3 commits,
3 years ago
version 2
d75010a9
2 commits,
3 years ago
version 1
20022829
1 commit,
3 years ago
5 files
+
418
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
benchmarks/tracking_detectors/scripts/gen_track_hits.cxx
0 → 100644
+
81
−
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_track_hits
(
int
n_events
=
100
,
const
char
*
out_fname
=
"track_hits.hepmc"
,
int
n_parts
=
2
)
{
double
cos_theta_min
=
std
::
cos
(
10.0
*
(
M_PI
/
180.0
));
double
cos_theta_max
=
std
::
cos
(
170.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
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
Double_t
p
=
r1
->
Uniform
(
1.0
,
10.0
);
Double_t
phi
=
r1
->
Uniform
(
0.0
,
2.0
*
M_PI
);
Double_t
costh
=
r1
->
Uniform
(
cos_theta_min
,
cos_theta_max
);
Double_t
th
=
std
::
acos
(
costh
);
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
);
// Generates random vectors, uniformly distributed over the surface of a
// sphere of given radius, in this case momentum.
// r1->Sphere(px, py, pz, p);
// std::cout << std::sqrt(px*px + py*py + pz*pz) - p << " is zero? \n";
// type 1 is final state
// pdgid 11 - electron 0.510 MeV/c^2
GenParticlePtr
p3
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
(
p
*
p
+
(
0.000511
*
0.000511
))),
((
ip
%
2
==
0
)
?
11
:
-
11
),
1
);
GenVertexPtr
v1
=
std
::
make_shared
<
GenVertex
>
();
v1
->
add_particle_in
(
p1
);
v1
->
add_particle_in
(
p2
);
v1
->
add_particle_out
(
p3
);
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