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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
detector_benchmarks
Merge requests
!72
B0tracker basics
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
B0tracker basics
b0tracker
into
master
Overview
1
Commits
16
Pipelines
0
Changes
4
Merged
B0tracker basics
Whitney Armstrong
requested to merge
b0tracker
into
master
Aug 9, 2021
Overview
1
Commits
16
Pipelines
0
Changes
4
0
0
Merge request reports
Compare
master
version 14
1f0200f8
Aug 9, 2021
version 13
e982006c
Aug 9, 2021
version 12
ecbfc426
Aug 9, 2021
version 11
3ad4f12b
Aug 9, 2021
version 10
c6706d64
Aug 9, 2021
version 9
02a41c06
Aug 9, 2021
version 8
8e3242d8
Aug 9, 2021
version 7
ea6a6896
Aug 9, 2021
version 6
8184e467
Aug 9, 2021
version 5
f91b9c31
Aug 9, 2021
version 4
a16f7da3
Aug 9, 2021
version 3
f0229882
Aug 9, 2021
version 2
4f9d37f3
Aug 9, 2021
version 1
f61e63bb
Aug 9, 2021
master (base)
and
version 2
latest version
950f215b
16 commits,
Aug 9, 2021
version 14
1f0200f8
15 commits,
Aug 9, 2021
version 13
e982006c
14 commits,
Aug 9, 2021
version 12
ecbfc426
13 commits,
Aug 9, 2021
version 11
3ad4f12b
11 commits,
Aug 9, 2021
version 10
c6706d64
10 commits,
Aug 9, 2021
version 9
02a41c06
9 commits,
Aug 9, 2021
version 8
8e3242d8
8 commits,
Aug 9, 2021
version 7
ea6a6896
7 commits,
Aug 9, 2021
version 6
8184e467
6 commits,
Aug 9, 2021
version 5
f91b9c31
5 commits,
Aug 9, 2021
version 4
a16f7da3
4 commits,
Aug 9, 2021
version 3
f0229882
3 commits,
Aug 9, 2021
version 2
4f9d37f3
2 commits,
Aug 9, 2021
version 1
f61e63bb
1 commit,
Aug 9, 2021
4 files
+
159
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
benchmarks/b0_tracker/scripts/gen_forward_protons.cxx
0 → 100644
+
85
−
0
View file @ 4f9d37f3
Edit in single-file editor
Open in Web IDE
#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"
#include
"common_bench/particles.h"
using
namespace
HepMC3
;
/** Generate electrons in the central region.
* This is for testing detectors in the "barrel" region.
*/
void
gen_forward_protons
(
int
n_events
=
100
,
const
char
*
out_fname
=
"forward_protons.hepmc"
)
{
double
cos_theta_min
=
std
::
cos
(
140.0
*
(
M_PI
/
180.0
));
double
cos_theta_max
=
std
::
cos
(
170.0
*
(
M_PI
/
180.0
));
const
double
M_p
=
common_bench
::
particleMap
.
at
(
2212
).
mass
;
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
GenParticlePtr
p1
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
0.0
,
0.0
,
10.0
,
10.0
),
2212
,
4
);
GenParticlePtr
p2
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
0.0
,
0.0
,
0.0
,
M_p
),
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
+
(
M_p
*
M_p
))),
2212
,
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