Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
datasets
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
Container registry
Model registry
Operate
Environments
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
datasets
Merge requests
!14
Updated script. emcal_electron
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Updated script. emcal_electron
script_update
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Whitney Armstrong
requested to merge
script_update
into
master
4 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Script can take # of events and file name as arguments
root -b -q "emcal_electron.cxx(100,\"file_name.root\")"
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
5b3fecbb
1 commit,
4 years ago
1 file
+
49
−
40
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
emcal_electrons.cxx
+
49
−
40
Options
@@ -19,52 +19,61 @@
using
namespace
HepMC3
;
void
emcal_electrons
(){
WriterAscii
hepmc_output
(
"./data/emcal_electron_0GeVto30GeV_100kEvt.hepmc"
);
int
events_parsed
=
0
;
GenEvent
evt
(
Units
::
GEV
,
Units
::
MM
);
void
emcal_electrons
(
int
n_events
=
1e6
,
const
char
*
out_fname
=
"./data/emcal_electron_0GeVto30GeV_100kEvt.hepmc"
)
{
WriterAscii
hepmc_output
(
out_fname
);
int
events_parsed
=
0
;
GenEvent
evt
(
Units
::
GEV
,
Units
::
MM
);
// Random number generator
TRandom
*
r1
=
new
TRandom
();
// Random number generator
TRandom
*
r1
=
new
TRandom
();
for
(
events_parsed
=
0
;
events_parsed
<
100000
;
events_parsed
++
)
{
// FourVector(px,py,pz,e,pdgid,status)
// type 4 is beam
// pdgid 11 - electron
// pdgid 2212 - proton
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
);
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
),
11
,
4
);
GenParticlePtr
p2
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
0.0
,
0.0
,
0.0
,
0.938
),
2212
,
4
);
// Define momentum
Double_t
p
=
0.0
+
events_parsed
*
3.e-4
;
Double_t
px
;
Double_t
py
;
Double_t
pz
;
// Generates random vectors, uniformly distributed over the surface of a sphere of given radius, in this case momentum.
r1
->
Sphere
(
px
,
py
,
pz
,
p
);
// Define momentum
Double_t
p
=
0.0
+
events_parsed
*
3.e-4
;
Double_t
px
;
Double_t
py
;
Double_t
pz
;
// Generates random vectors, uniformly distributed over the surface of a
// sphere of given radius, in this case momentum.
r1
->
Sphere
(
px
,
py
,
pz
,
p
);
// type 1 is final state
// pdgid 11 - electron 0.510 MeV/c^2
GenParticlePtr
p3
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
((
px
*
px
)
+
(
py
*
py
)
+
(
pz
*
pz
)
+
(
0.000511
*
0.000511
))),
11
,
1
);
// type 1 is final state
// pdgid 11 - electron 0.510 MeV/c^2
GenParticlePtr
p3
=
std
::
make_shared
<
GenParticle
>
(
FourVector
(
px
,
py
,
pz
,
sqrt
((
px
*
px
)
+
(
py
*
py
)
+
(
pz
*
pz
)
+
(
0.000511
*
0.000511
))),
11
,
1
);
GenVertexPtr
v1
=
std
::
make_shared
<
GenVertex
>
();
v1
->
add_particle_in
(
p1
);
v1
->
add_particle_in
(
p2
);
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
);
v1
->
add_particle_out
(
p3
);
evt
.
add_vertex
(
v1
);
if
(
events_parsed
==
0
)
{
std
::
cout
<<
"First event: "
<<
std
::
endl
;
Print
::
listing
(
evt
);
}
if
(
events_parsed
==
0
)
{
std
::
cout
<<
"First event: "
<<
std
::
endl
;
Print
::
listing
(
evt
);
}
hepmc_output
.
write_event
(
evt
);
if
(
events_parsed
%
10
==
0
)
{
std
::
cout
<<
"Event: "
<<
events_parsed
<<
std
::
endl
;
}
evt
.
clear
();
}
hepmc_output
.
close
();
std
::
cout
<<
"Events parsed and written: "
<<
events_parsed
<<
std
::
endl
;
hepmc_output
.
write_event
(
evt
);
if
(
events_parsed
%
10
==
0
)
{
std
::
cout
<<
"Event: "
<<
events_parsed
<<
std
::
endl
;
}
evt
.
clear
();
}
hepmc_output
.
close
();
std
::
cout
<<
"Events parsed and written: "
<<
events_parsed
<<
std
::
endl
;
}
Loading