IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Antonio Augusto Alves Junior
corsika
Commits
b971b99c
Commit
b971b99c
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
improved code generation script a bit
parent
1c626153
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Particles/pdxml_reader.py
+25
-27
25 additions, 27 deletions
Framework/Particles/pdxml_reader.py
Framework/Units/PhysicalUnits.h
+1
-0
1 addition, 0 deletions
Framework/Units/PhysicalUnits.h
with
26 additions
and
27 deletions
Framework/Particles/pdxml_reader.py
+
25
−
27
View file @
b971b99c
...
@@ -92,7 +92,7 @@ def c_identifier(name):
...
@@ -92,7 +92,7 @@ def c_identifier(name):
#
########################################################
#########################################################
#
#
# returns dict containing all data from pythia-xml input
# returns dict containing all data from pythia-xml input
#
#
...
@@ -203,17 +203,17 @@ def gen_classes(pythia_db):
...
@@ -203,17 +203,17 @@ def gen_classes(pythia_db):
break
break
string
+=
"
\n
"
;
string
+=
"
\n
"
;
string
+=
"
struct
"
+
cname
+
"
{
\n
"
string
+=
(
"
struct
"
+
cname
+
"
{
\n
"
string
+=
"
static InternalParticleCode GetType() { return Type; }
\n
"
"
static
constexpr
InternalParticleCode GetType() { return Type; }
\n
"
string
+=
"
static
quantity<energy_d>
GetMass() { return masses[TypeIndex]; }
\n
"
"
static
auto constexpr
GetMass() { return masses[TypeIndex]; }
\n
"
string
+=
"
static
quantity<electric_charge_d>
GetCharge() { return phys::units::e*electric_charge[TypeIndex]/3; }
\n
"
"
static
auto constexpr
GetCharge() { return phys::units::e*electric_charge[TypeIndex]/3; }
\n
"
string
+=
"
static
std::string
GetName() { return names[TypeIndex]; }
\n
"
"
static
auto const
GetName() { return names[TypeIndex]; }
\n
"
string
+=
"
static
InternalParticleCode
GetAntiParticle() { return AntiType; }
\n
"
"
static
auto constexpr
GetAntiParticle() { return AntiType; }
\n
"
string
+=
"
static
const InternalParticleCode
Type = InternalParticleCode::
"
+
cname
+
"
;
\n
"
"
static
auto constexpr
Type = InternalParticleCode::
"
)
+
cname
+
"
;
\n
"
+
\
string
+=
"
static const
InternalParticleCode
AntiType = InternalParticleCode::
"
+
antiP
+
"
;
\n
"
"
static
auto
const
expr
AntiType = InternalParticleCode::
"
+
antiP
+
"
;
\n
"
+
\
string
+=
"
private:
\n
"
(
"
private:
\n
"
string
+=
"
static const uint8_t TypeIndex = static_cast<uint8_t const>(Type);
\n
"
"
static const
expr
uint8_t TypeIndex = static_cast<uint8_t const>(Type);
\n
"
string
+=
"
};
\n
"
"
};
\n
"
)
return
string
return
string
...
@@ -223,16 +223,16 @@ def gen_classes(pythia_db):
...
@@ -223,16 +223,16 @@ def gen_classes(pythia_db):
#
#
def
inc_start
():
def
inc_start
():
string
=
""
string
=
(
""
string
+=
"
#ifndef _include_GeneratedParticleDataTable_h_
\n
"
"
#ifndef _include_GeneratedParticleDataTable_h_
\n
"
string
+=
"
#define _include_GeneratedParticleDataTable_h_
\n\n
"
"
#define _include_GeneratedParticleDataTable_h_
\n\n
"
string
+=
"
#include <array>
\n
"
"
#include <array>
\n
"
string
+=
"
#include <cstdint>
\n
"
"
#include <cstdint>
\n
"
string
+=
"
#include <iostream>
\n\n
"
"
#include <iostream>
\n\n
"
string
+=
"
using namespace phys::units;
\n
"
"
using namespace phys::units;
\n
"
string
+=
"
using namespace phys::units::literals;
\n\n
"
"
using namespace phys::units::literals;
\n\n
"
string
+=
"
namespace ParticleProperties {
\n\n
"
"
namespace ParticleProperties {
\n\n
"
string
+=
"
typedef int16_t PDGCode;
\n\n
"
"
typedef int16_t PDGCode;
\n\n
"
)
return
string
return
string
...
@@ -254,18 +254,16 @@ def inc_end():
...
@@ -254,18 +254,16 @@ def inc_end():
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
if
(
len
(
sys
.
argv
)
!=
3
)
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
"
pdxml_reader.py Pythia8.xml ClassNames.xml
"
)
print
(
"
usage:
pdxml_reader.py Pythia8.xml ClassNames.xml
"
,
file
=
sys
.
stderr
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
names
=
class_names
(
sys
.
argv
[
2
])
names
=
class_names
(
sys
.
argv
[
2
])
pythia_db
=
build_pythia_db
(
sys
.
argv
[
1
],
names
)
pythia_db
=
build_pythia_db
(
sys
.
argv
[
1
],
names
)
print
(
"
\n
pdxml_reader.py:
A
utomatically produce particle
-
properties from PYTHIA8 xml file
\n
"
)
print
(
"
\n
pdxml_reader.py:
a
utomatically produce particle
properties from PYTHIA8 xml file
\n
"
)
counter
=
itertools
.
count
(
0
)
counter
=
itertools
.
count
(
0
)
not_modeled
=
[]
for
p
in
pythia_db
:
for
p
in
pythia_db
:
pythia_db
[
p
][
'
ngc_code
'
]
=
next
(
counter
)
pythia_db
[
p
][
'
ngc_code
'
]
=
next
(
counter
)
...
...
This diff is collapsed.
Click to expand it.
Framework/Units/PhysicalUnits.h
+
1
−
0
View file @
b971b99c
...
@@ -27,6 +27,7 @@ using Time = phys::units::quantity<phys::units::time_interval_d, double>;
...
@@ -27,6 +27,7 @@ using Time = phys::units::quantity<phys::units::time_interval_d, double>;
using
Speed
=
phys
::
units
::
quantity
<
phys
::
units
::
speed_d
,
double
>
;
using
Speed
=
phys
::
units
::
quantity
<
phys
::
units
::
speed_d
,
double
>
;
using
Frequency
=
phys
::
units
::
quantity
<
phys
::
units
::
frequency_d
,
double
>
;
using
Frequency
=
phys
::
units
::
quantity
<
phys
::
units
::
frequency_d
,
double
>
;
using
ElectricCharge
=
phys
::
units
::
quantity
<
phys
::
units
::
electric_charge_d
,
double
>
;
using
ElectricCharge
=
phys
::
units
::
quantity
<
phys
::
units
::
electric_charge_d
,
double
>
;
using
Energy
=
phys
::
units
::
quantity
<
phys
::
units
::
energy_d
,
double
>
;
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment