cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
FortranFactorisedProcess.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2018-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/ParametersList.h
"
20
#include "
CepGen/Event/Event.h
"
21
#include "
CepGen/Modules/PartonFluxFactory.h
"
22
#include "
CepGen/Physics/Constants.h
"
23
#include "
CepGen/Physics/HeavyIon.h
"
24
#include "
CepGen/Physics/PDG.h
"
25
#include "
CepGen/Process/Fortran/KTStructures.h
"
26
#include "
CepGen/Process/FortranFactorisedProcess.h
"
27
#include "
CepGen/Utils/Message.h
"
28
29
namespace
{
30
extern
"C"
{
31
extern
cepgen::ktblock::Constants
constants_;
32
extern
cepgen::ktblock::GenParameters
genparams_;
33
extern
cepgen::ktblock::KTKinematics
ktkin_;
34
extern
cepgen::ktblock::KinCuts
kincuts_;
35
extern
cepgen::ktblock::EventKinematics
evtkin_;
36
}
37
}
// namespace
38
39
extern
"C"
{
41
void
cepgen_list_params_
() {
42
CG_LOG
<<
"\t"
<<
cepgen::ParametersDescription
(
cepgen::proc::FortranFactorisedProcess::kProcParameters
).
describe
(1);
43
}
44
48
int
cepgen_param_int_
(
char
* pname,
int
& def) {
49
//--- first check if the "integer" is a particle id
50
if
(
cepgen::proc::FortranFactorisedProcess::kProcParameters
.has<cepgen::ParticleProperties>(pname))
51
return
cepgen::proc::FortranFactorisedProcess::kProcParameters
.
get
<
cepgen::ParticleProperties
>(pname).pdgid;
52
if
(
cepgen::proc::FortranFactorisedProcess::kProcParameters
.has<unsigned long long>(pname)) {
53
unsigned
long
long
ulong_def = def;
54
return
cepgen::proc::FortranFactorisedProcess::kProcParameters
.
get
<
unsigned
long
long
>(pname, ulong_def);
55
}
56
//--- if not, proceed with retrieving the integer value
57
return
cepgen::proc::FortranFactorisedProcess::kProcParameters
.
get
<
int
>(pname, def);
58
}
59
63
double
cepgen_param_real_
(
char
* pname,
double
& def) {
64
return
cepgen::proc::FortranFactorisedProcess::kProcParameters
.
get
<
double
>(pname, def);
65
}
66
}
67
68
namespace
cepgen
{
69
namespace
proc {
70
ParametersList
FortranFactorisedProcess::kProcParameters
;
71
72
FortranFactorisedProcess::FortranFactorisedProcess
(
const
ParametersList
& params,
73
const
std::function<
double
(
void
)>& func)
74
:
FactorisedProcess
(params, {
PDG::muon
,
PDG::muon
}), func_(func) {
75
constants_.m_p =
Process::mp_
;
76
constants_.units =
constants::GEVM2_TO_PB
;
77
constants_.pi = M_PI;
78
}
79
80
void
FortranFactorisedProcess::prepareFactorisedPhaseSpace() {
81
const
auto
lim_rap =
kinematics
().
cuts
().
central
.
rapidity_single
.
truncate
(
Limits
{-6., 6.});
82
defineVariable
(m_y1_,
Mapping::linear
, lim_rap,
"y1"
,
"First central particle rapidity"
);
83
defineVariable
(m_y2_,
Mapping::linear
, lim_rap,
"y2"
,
"Second central particle rapidity"
);
84
85
const
auto
lim_pt_diff =
kinematics
().
cuts
().
central
.
pt_diff
.
truncate
(Limits{0., 50.});
86
defineVariable
(
87
m_pt_diff_,
Mapping::linear
, lim_pt_diff,
"pt_diff"
,
"Central particles transverse momentum difference"
);
88
89
const
auto
lim_phi_diff =
kinematics
().
cuts
().
central
.
phi_diff
.
truncate
(Limits{0., 2. * M_PI});
90
defineVariable
(
91
m_phi_pt_diff_,
Mapping::linear
, lim_phi_diff,
"phi_diff"
,
"Central particles azimuthal angle difference"
);
92
93
//===========================================================================================
94
// feed phase space cuts to the common block
95
//===========================================================================================
96
97
// export the limits into external variables
98
auto
save_lim = [](
const
Limits& lim,
int
& on,
double
& min,
double
& max) {
99
on = lim.valid();
100
min = lim.hasMin() ? lim.min() : -9999.999;
101
max = lim.hasMax() ? lim.max() : +9999.999;
102
};
103
104
save_lim(
kinematics
().cuts().central.pt_single, kincuts_.ipt, kincuts_.pt_min, kincuts_.pt_max);
105
save_lim(
kinematics
().cuts().central.energy_single, kincuts_.iene, kincuts_.ene_min, kincuts_.ene_max);
106
save_lim(
kinematics
().cuts().central.eta_single, kincuts_.ieta, kincuts_.eta_min, kincuts_.eta_max);
107
save_lim(
kinematics
().cuts().central.mass_sum, kincuts_.iinvm, kincuts_.invm_min, kincuts_.invm_max);
108
save_lim(
kinematics
().cuts().central.pt_sum, kincuts_.iptsum, kincuts_.ptsum_min, kincuts_.ptsum_max);
109
save_lim(
kinematics
().cuts().central.rapidity_diff, kincuts_.idely, kincuts_.dely_min, kincuts_.dely_max);
110
111
//===========================================================================================
112
// feed run parameters to the common block
113
//===========================================================================================
114
115
genparams_.icontri = (int)
kinematics
().
incomingBeams
().
mode
();
116
117
//-------------------------------------------------------------------------------------------
118
// incoming beams information
119
//-------------------------------------------------------------------------------------------
120
121
//--- positive-z incoming beam
122
genparams_.inp1 =
kinematics
().
incomingBeams
().
positive
().
momentum
().
pz
();
123
//--- check if first incoming beam is a heavy ion
124
if
(
HeavyIon::isHI
(
kinematics
().incomingBeams().
positive
().integerPdgId())) {
125
const
auto
in1 =
HeavyIon::fromPdgId
(
kinematics
().incomingBeams().
positive
().integerPdgId());
126
genparams_.a_nuc1 = in1.A;
127
genparams_.z_nuc1 = (
unsigned
short)in1.Z;
128
if
(genparams_.z_nuc1 > 1) {
129
event
().
oneWithRole
(
Particle::IncomingBeam1
).
setPdgId
((
pdgid_t
)in1);
130
event
().
oneWithRole
(
Particle::OutgoingBeam1
).
setPdgId
((
pdgid_t
)in1);
131
}
132
}
else
133
genparams_.a_nuc1 = genparams_.z_nuc1 = 1;
134
135
//--- negative-z incoming beam
136
genparams_.inp2 =
kinematics
().
incomingBeams
().
negative
().
momentum
().
pz
();
137
//--- check if second incoming beam is a heavy ion
138
if
(
HeavyIon::isHI
(
kinematics
().incomingBeams().negative().integerPdgId())) {
139
const
auto
in2 =
HeavyIon::fromPdgId
(
kinematics
().incomingBeams().negative().integerPdgId());
140
genparams_.a_nuc2 = in2.A;
141
genparams_.z_nuc2 = (
unsigned
short)in2.Z;
142
if
(genparams_.z_nuc2 > 1) {
143
event
().
oneWithRole
(
Particle::IncomingBeam2
).
setPdgId
((
pdgid_t
)in2);
144
event
().
oneWithRole
(
Particle::OutgoingBeam2
).
setPdgId
((
pdgid_t
)in2);
145
}
146
}
else
147
genparams_.a_nuc2 = genparams_.z_nuc2 = 1;
148
149
// intermediate partons information
150
genparams_.iflux1 = (int)
psgen_
->partons().at(0);
151
genparams_.iflux2 = (int)
psgen_
->partons().at(1);
152
}
153
154
double
FortranFactorisedProcess::computeFactorisedMatrixElement() {
155
//===========================================================================================
156
// outgoing beam remnants
157
//===========================================================================================
158
159
pX
() = Momentum(evtkin_.px);
160
pY
() = Momentum(evtkin_.py);
161
// express these momenta per nucleon
162
pX
() *= 1. / genparams_.a_nuc1;
163
pY
() *= 1. / genparams_.a_nuc2;
164
165
//===========================================================================================
166
// intermediate partons
167
//===========================================================================================
168
169
q1
() =
pA
() -
pX
();
170
q2
() =
pB
() -
pY
();
171
event
().
oneWithRole
(
Particle::Intermediate
).
setMomentum
(
q1
() +
q2
());
172
173
//===========================================================================================
174
// central system
175
//===========================================================================================
176
177
auto
oc =
event
()[
Particle::CentralSystem
];
// retrieve all references
178
// to central system particles
179
for
(
int
i = 0; i < evtkin_.nout; ++i) {
180
auto
& p = oc[i].get();
// retrieve a reference to the specific particle
181
p.setPdgId((
long
)evtkin_.pdg[i]);
182
p.setStatus(
Particle::Status::FinalState
);
183
p.setMomentum(Momentum(evtkin_.pc[i]));
184
}
185
// set all kinematics variables for this phase space point
186
ktkin_.q1t =
q1
().
p
();
187
ktkin_.q2t =
q2
().
p
();
188
ktkin_.phiq1t =
q1
().
phi
();
189
ktkin_.phiq2t =
q2
().
phi
();
190
ktkin_.y1 = m_y1_;
191
ktkin_.y2 = m_y2_;
192
ktkin_.ptdiff = m_pt_diff_;
193
ktkin_.phiptdiff = m_phi_pt_diff_;
194
ktkin_.m_x =
mX
();
195
ktkin_.m_y =
mY
();
196
197
// compute the event weight
198
return
func_();
199
}
200
}
// namespace proc
201
}
// namespace cepgen
Constants.h
Event.h
cepgen_list_params_
void cepgen_list_params_()
Print the full list of parameters in the runtime process parameters collection.
Definition
FortranFactorisedProcess.cpp:41
cepgen_param_real_
double cepgen_param_real_(char *pname, double &def)
Retrieve a double precision floating point process parameter from runtime parameters collection.
Definition
FortranFactorisedProcess.cpp:63
cepgen_param_int_
int cepgen_param_int_(char *pname, int &def)
Retrieve an integer process parameter from runtime parameters collection.
Definition
FortranFactorisedProcess.cpp:48
FortranFactorisedProcess.h
HeavyIon.h
KTStructures.h
Message.h
CG_LOG
#define CG_LOG
Definition
Message.h:212
PDG.h
ParametersList.h
PartonFluxFactory.h
cepgen::Beam::momentum
const Momentum & momentum() const
Beam particle 4-momentum Set the beam particle 4-momentum.
Definition
Beam.h:54
cepgen::Event::oneWithRole
Particle & oneWithRole(Particle::Role role)
First Particle object with a given role in the event.
Definition
Event.cpp:190
cepgen::IncomingBeams::positive
const Beam & positive() const
Reference to the positive-z beam information.
Definition
IncomingBeams.h:38
cepgen::IncomingBeams::negative
const Beam & negative() const
Reference to the negative-z beam information.
Definition
IncomingBeams.h:40
cepgen::IncomingBeams::mode
mode::Kinematics mode() const
Type of kinematics to consider for the phase space.
Definition
IncomingBeams.cpp:204
cepgen::Kinematics::cuts
CutsList & cuts()
Phase space cuts.
Definition
Kinematics.h:41
cepgen::Kinematics::incomingBeams
IncomingBeams & incomingBeams()
Beam/primary particle kinematics.
Definition
Kinematics.h:36
cepgen::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::Limits::truncate
Limits truncate(const Limits &) const
Truncate limits to minimal/maximal values.
Definition
Limits.cpp:130
cepgen::Momentum::pz
double pz() const
Longitudinal momentum (in GeV)
Definition
Momentum.h:120
cepgen::Momentum::phi
double phi() const
Azimuthal angle (angle in the transverse plane)
Definition
Momentum.cpp:230
cepgen::Momentum::p
double p() const
3-momentum norm (in GeV)
Definition
Momentum.h:130
cepgen::PDG::muon
@ muon
Definition
PDG.h:38
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersDescription::describe
std::string describe(size_t offset=0) const
Human-readable description of parameters and their default value.
Definition
ParametersDescription.cpp:96
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::ParametersList::get
T get(const std::string &key, const T &def=default_arg< T >::get()) const
Get a parameter value.
Definition
ParametersList.cpp:391
cepgen::Particle::setMomentum
Particle & setMomentum(const Momentum &, bool offshell=false)
Associate a momentum object to this particle.
Definition
Particle.cpp:77
cepgen::Particle::Status::FinalState
@ FinalState
Stable, final state particle.
cepgen::Particle::IncomingBeam2
@ IncomingBeam2
incoming beam particle
Definition
Particle.h:53
cepgen::Particle::OutgoingBeam1
@ OutgoingBeam1
outgoing beam state/particle
Definition
Particle.h:54
cepgen::Particle::IncomingBeam1
@ IncomingBeam1
incoming beam particle
Definition
Particle.h:52
cepgen::Particle::OutgoingBeam2
@ OutgoingBeam2
outgoing beam state/particle
Definition
Particle.h:55
cepgen::Particle::CentralSystem
@ CentralSystem
Central particles system.
Definition
Particle.h:56
cepgen::Particle::Intermediate
@ Intermediate
Intermediate two-parton system.
Definition
Particle.h:57
cepgen::Particle::setPdgId
Particle & setPdgId(pdgid_t pdg, short ch=0)
Set the PDG identifier (along with the particle's electric charge)
Definition
Particle.cpp:93
cepgen::proc::FactorisedProcess
Generic parton emission-factorised process.
Definition
FactorisedProcess.h:33
cepgen::proc::FactorisedProcess::psgen_
const std::unique_ptr< PhaseSpaceGenerator > psgen_
Kinematic variables generator for the phase space coverage.
Definition
FactorisedProcess.h:58
cepgen::proc::FortranFactorisedProcess::FortranFactorisedProcess
FortranFactorisedProcess(const ParametersList &, const std::function< double(void)> &func)
Construct a Fortran-CepGen interface object using a double precision argument-less F77 function.
Definition
FortranFactorisedProcess.cpp:72
cepgen::proc::FortranFactorisedProcess::kProcParameters
static ParametersList kProcParameters
List of parameters to steer the process.
Definition
FortranFactorisedProcess.h:34
cepgen::proc::Process::kinematics
const Kinematics & kinematics() const
Constant reference to the process kinematics.
Definition
Process.h:50
cepgen::proc::Process::pA
const Momentum & pA() const
Positive-z incoming beam particle's 4-momentum.
Definition
Process.cpp:91
cepgen::proc::Process::pX
const Momentum & pX() const
Positive-z outgoing beam particle's 4-momentum.
Definition
Process.cpp:99
cepgen::proc::Process::mp_
double mp_
Proton mass, in GeV/c .
Definition
Process.h:121
cepgen::proc::Process::mX
double mX() const
Positive-z outgoing beam particle's mass.
Definition
Process.h:75
cepgen::proc::Process::q2
const Momentum & q2() const
Negative-z incoming parton's 4-momentum.
Definition
Process.cpp:111
cepgen::proc::Process::defineVariable
Process & defineVariable(double &out, const Mapping &type, const Limits &lim, const std::string &name, const std::string &description="")
Register a variable to be handled and populated whenever a new phase space point weight is to be calc...
Definition
Process.cpp:149
cepgen::proc::Process::Mapping::linear
@ linear
a linear mapping
cepgen::proc::Process::pB
const Momentum & pB() const
Negative-z incoming beam particle's 4-momentum.
Definition
Process.cpp:95
cepgen::proc::Process::mY
double mY() const
Negative-z outgoing beam particle's mass.
Definition
Process.h:78
cepgen::proc::Process::pY
const Momentum & pY() const
Negative-z outgoing beam particle's 4-momentum.
Definition
Process.cpp:103
cepgen::proc::Process::event
const Event & event() const
Handled particles objects and their relationships.
Definition
Process.cpp:267
cepgen::proc::Process::q1
const Momentum & q1() const
Positive-z incoming parton's 4-momentum.
Definition
Process.cpp:107
cepgen::constants::GEVM2_TO_PB
constexpr double GEVM2_TO_PB
Conversion factor between GeV and barn i.e. in GeV .
Definition
Constants.h:37
cepgen::ktblock::Constants
General physics constants.
Definition
KTStructures.h:26
cepgen::ktblock::GenParameters
Generic run parameters.
Definition
KTStructures.h:32
cepgen::ktblock::KTKinematics
Kinematics properties of the -factorised process.
Definition
KTStructures.h:45
cepgen::ktblock::KinCuts
Phase space cuts for event kinematics.
Definition
KTStructures.h:58
cepgen::utils::positive
bool positive(const T &val)
Check if a number is positive and finite.
Definition
Math.cpp:26
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
cepgen::pdgid_t
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
Definition
ParticleProperties.h:26
cepgen::CutsList::central
cuts::Central central
Cuts on the central system produced.
Definition
Cuts.h:95
cepgen::HeavyIon::fromPdgId
static HeavyIon fromPdgId(pdgid_t)
Build from a custom PDG id.
Definition
HeavyIon.cpp:34
cepgen::HeavyIon::isHI
static bool isHI(const spdgid_t &)
Check if the PDG id is compatible with a HI.
Definition
HeavyIon.cpp:54
cepgen::ParticleProperties
A collection of physics constants associated to a single particle.
Definition
ParticleProperties.h:31
cepgen::cuts::Central::pt_diff
Limits pt_diff
transverse momentum balance between the central particles
Definition
Cuts.h:47
cepgen::cuts::Central::rapidity_single
Limits rapidity_single
single particle rapidity
Definition
Cuts.h:40
cepgen::cuts::Central::phi_diff
Limits phi_diff
azimuthal angles difference between the central particles
Definition
Cuts.h:48
cepgen::ktblock::EventKinematics
Single event kinematics.
Definition
KTStructures.h:79
CepGen
Process
FortranFactorisedProcess.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7