cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Pythia6Interface.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2024 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include "
CepGen/Core/Exception.h
"
20
#include "
CepGen/Event/Particle.h
"
21
#include "
CepGen/Physics/PDG.h
"
22
#include "
CepGen/Utils/String.h
"
23
#include "
CepGenAddOns/Pythia6Wrapper/Pythia6Interface.h
"
24
25
extern
"C"
{
26
double
pyalem_
(
double
& q2);
27
double
pyalps_
(
double
& q2);
28
extern
double
pymass_
(
int
&);
29
extern
void
pyexec_
();
30
extern
void
pygive_
(
const
char
*,
int
);
31
extern
void
pyckbd_
();
32
extern
void
pylist_
(
int
&);
33
extern
void
pyjoin_
(
int
&,
int
&);
34
extern
void
pyname_
(
int
&,
char
*,
int
);
35
extern
int
pyk_
(
int
&,
int
&);
36
extern
double
pyp_
(
int
&,
int
&);
37
extern
int
pychge_
(
int
&);
38
void
pystop_
() {
CG_INFO
(
"pythia6:pystop"
) <<
"End of run"
; }
39
}
40
41
namespace
cepgen
{
42
namespace
pythia6
{
43
double
pyalem
(
double
q2) {
return
pyalem_
(q2); }
44
45
double
pyalps
(
double
q2) {
return
pyalps_
(q2); }
46
47
void
pyexec
() {
pyexec_
(); }
48
49
int
pychge
(
int
pdgid) {
return
pychge_
(pdgid); }
50
51
void
pyckbd
() {
pyckbd_
(); }
52
53
void
pygive
(
const
std::string& line) {
pygive_
(line.c_str(), line.length()); }
54
55
void
pyjoin
(std::vector<int> join) {
56
int
njoin = join.size();
57
return
pyjoin_
(njoin, *join.data());
58
}
59
60
int
pyk
(
int
id
,
int
qty) {
return
pyk_
(
id
, qty); }
61
62
void
pylist
(
int
mlist) {
pylist_
(mlist); }
63
64
double
pymass
(
int
pdgid) {
return
pymass_
(pdgid); }
65
66
std::string
pyname
(
int
pdgid) {
67
// maximal number of characters to fetch for the particle's name
68
static
constexpr
unsigned
short
NAME_CHR = 16;
69
70
char
out[NAME_CHR];
71
std::string s;
72
pyname_
(pdgid, out, NAME_CHR);
73
s = std::string(out, NAME_CHR);
74
s.erase(remove(s.begin(), s.end(),
' '
), s.end());
75
return
s;
76
}
77
78
double
pyp
(
int
id
,
int
qty) {
return
pyp_
(
id
, qty); }
79
80
int
pythia6Status
(
int
cg_status) {
81
switch
(
static_cast<
cepgen::Particle::Status
>
(cg_status)) {
82
case
cepgen::Particle::Status::PrimordialIncoming
:
83
return
21;
84
case
cepgen::Particle::Status::FinalState
:
85
case
cepgen::Particle::Status::Undecayed
:
86
return
1;
87
case
cepgen::Particle::Status::Unfragmented
:
88
return
3;
89
case
cepgen::Particle::Status::Fragmented
:
90
case
cepgen::Particle::Status::Propagator
:
91
case
cepgen::Particle::Status::Incoming
:
92
return
11;
93
default
:
94
throw
CG_FATAL
(
"pythia6:status"
) <<
"No conversion rule for CepGen status code: "
<< cg_status <<
"."
;
95
}
96
}
97
98
int
cepgenStatus
(
int
py_status) {
99
switch
(py_status) {
100
case
1:
101
return
static_cast<
int
>
(
cepgen::Particle::Status::FinalState
);
102
case
3:
103
return
static_cast<
int
>
(
cepgen::Particle::Status::Propagator
);
104
case
11:
105
return
static_cast<
int
>
(
cepgen::Particle::Status::Fragmented
);
106
case
21:
107
return
static_cast<
int
>
(
cepgen::Particle::Status::PrimordialIncoming
);
108
default
:
109
return
py_status;
110
}
111
}
112
113
void
checkPDGid
(
int
pdg_id) {
114
if
(
cepgen::PDG::get
().has(pdg_id))
115
return
;
116
const
auto
name =
pythia6::pyname
(pdg_id);
117
cepgen::ParticleProperties
prop;
118
prop.
pdgid
= pdg_id;
119
prop.
name
= name;
120
prop.
descr
= name;
121
//prop.colours = pyk(p + 1, 12); // colour factor
122
prop.
mass
=
pymass
(pdg_id);
123
prop.
width
= -1.;
//pmas( pdg_id, 2 ),
124
if
(
const
auto
ch =
pychge
(pdg_id); std::fabs(ch) > 0)
125
prop.
charges
= {ch, -ch};
126
prop.fermion =
false
;
127
cepgen::PDG::get
().
define
(prop);
128
}
129
}
// namespace pythia6
130
}
// namespace cepgen
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
CG_INFO
#define CG_INFO(mod)
Definition
Message.h:216
PDG.h
Particle.h
pygive_
void pygive_(const char *, int)
Set a parameter value to the Pythia module.
pychge_
int pychge_(int &)
pyckbd_
void pyckbd_()
pyalem_
double pyalem_(double &q2)
pyname_
void pyname_(int &, char *, int)
Get a particle's human-readable name from Pythia.
pyp_
double pyp_(int &, int &)
Get real-valued event information from Pythia.
pylist_
void pylist_(int &)
List all the particles in the event in a human-readable format.
pymass_
double pymass_(int &)
Get the particle's mass in GeV from Pythia.
pyexec_
void pyexec_()
Launch the Pythia6 fragmentation.
pyjoin_
void pyjoin_(int &, int &)
Join two coloured particles in a colour singlet.
pyalps_
double pyalps_(double &q2)
pyk_
int pyk_(int &, int &)
Get integer-valued event information from Pythia.
pystop_
void pystop_()
Purely virtual method to call at the end of the run.
Definition
Pythia6Interface.cpp:38
Pythia6Interface.h
String.h
cepgen::PDG::define
void define(const ParticleProperties &)
Add a new particle definition to the library.
Definition
PDG.cpp:60
cepgen::PDG::get
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition
PDG.cpp:41
cepgen::Particle::Status
Status
Internal status code for a particle.
Definition
Particle.h:36
cepgen::Particle::Status::Undecayed
@ Undecayed
Particle to be decayed externally.
cepgen::Particle::Status::Fragmented
@ Fragmented
Already fragmented outgoing beam.
cepgen::Particle::Status::PrimordialIncoming
@ PrimordialIncoming
Incoming beam particle.
cepgen::Particle::Status::Incoming
@ Incoming
Incoming parton.
cepgen::Particle::Status::FinalState
@ FinalState
Stable, final state particle.
cepgen::Particle::Status::Unfragmented
@ Unfragmented
Particle to be hadronised externally.
cepgen::Particle::Status::Propagator
@ Propagator
Generic propagator.
cepgen::pythia6::pyalem
double pyalem(double q2)
Definition
Pythia6Interface.cpp:43
cepgen::pythia6::pyk
int pyk(int id, int qty)
Definition
Pythia6Interface.cpp:60
cepgen::pythia6::pyckbd
void pyckbd()
Definition
Pythia6Interface.cpp:51
cepgen::pythia6::cepgenStatus
int cepgenStatus(int py_status)
Definition
Pythia6Interface.cpp:98
cepgen::pythia6::pygive
void pygive(const std::string &line)
Definition
Pythia6Interface.cpp:53
cepgen::pythia6::pyexec
void pyexec()
Definition
Pythia6Interface.cpp:47
cepgen::pythia6::pymass
double pymass(int pdgid)
Definition
Pythia6Interface.cpp:64
cepgen::pythia6::pyp
double pyp(int id, int qty)
Definition
Pythia6Interface.cpp:78
cepgen::pythia6::pyjoin
void pyjoin(std::vector< int > join)
Connect entries with colour flow information.
Definition
Pythia6Interface.cpp:55
cepgen::pythia6::pylist
void pylist(int mlist)
Definition
Pythia6Interface.cpp:62
cepgen::pythia6::pyname
std::string pyname(int pdgid)
Definition
Pythia6Interface.cpp:66
cepgen::pythia6::pychge
int pychge(int pdgid)
Definition
Pythia6Interface.cpp:49
cepgen::pythia6::checkPDGid
void checkPDGid(int pdg_id)
Definition
Pythia6Interface.cpp:113
cepgen::pythia6::pyalps
double pyalps(double q2)
Definition
Pythia6Interface.cpp:45
cepgen::pythia6::pythia6Status
int pythia6Status(int cg_status)
Definition
Pythia6Interface.cpp:80
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
python.Config.Hadronisation.pythia6_cfi.pythia6
pythia6
Definition
pythia6_cfi.py:11
cepgen::ParticleProperties
A collection of physics constants associated to a single particle.
Definition
ParticleProperties.h:31
cepgen::ParticleProperties::descr
std::string descr
Human-readable name.
Definition
ParticleProperties.h:50
cepgen::ParticleProperties::mass
double mass
Mass, in GeV/c .
Definition
ParticleProperties.h:52
cepgen::ParticleProperties::pdgid
pdgid_t pdgid
PDG identifier.
Definition
ParticleProperties.h:48
cepgen::ParticleProperties::charges
std::vector< int > charges
Electric charges, in /3.
Definition
ParticleProperties.h:54
cepgen::ParticleProperties::name
std::string name
Particle name.
Definition
ParticleProperties.h:49
cepgen::ParticleProperties::width
double width
Decay width, in GeV/c .
Definition
ParticleProperties.h:53
CepGenAddOns
Pythia6Wrapper
Pythia6Interface.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7