cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Cuts.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2017-2023 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 <algorithm>
20
21
#include "
CepGen/Event/Event.h
"
22
#include "
CepGen/Physics/Cuts.h
"
23
#include "
CepGen/Utils/Message.h
"
24
#include "
CepGen/Utils/String.h
"
25
26
namespace
cepgen
{
27
namespace
cuts {
28
//--------------------------------------------------------------------
29
// physics system kinematic properties
30
//--------------------------------------------------------------------
31
32
Central::Central
() :
SteeredObject
(
ParametersList
{}) {}
33
34
Central::Central
(
const
ParametersList
& params) :
SteeredObject
(params) {
35
(*this)
36
.add(
"pt"
,
pt_single
)
37
.add(
"eta"
,
eta_single
)
38
.add(
"rapidity"
,
rapidity_single
)
39
.add(
"energy"
,
energy_single
)
40
.add(
"mass"
,
mass_single
)
41
.add(
"ptsum"
,
pt_sum
)
42
.add(
"etasum"
,
eta_sum
)
43
.add(
"energysum"
,
energy_sum
)
44
.add(
"invmass"
,
mass_sum
)
45
.add(
"ptdiff"
,
pt_diff
)
46
.add(
"dphi"
,
phi_diff
)
47
.add(
"rapiditydiff"
,
rapidity_diff
);
48
if
(params.
has
<
Limits
>(
"phiptdiff"
)) {
49
CG_WARNING
(
"Central"
) <<
"\"phiptdiff\" parameter is deprecated! "
50
<<
"Please use \"phidiff\" instead."
;
51
params.
fill
(
"phiptdiff"
,
phi_diff
);
// legacy
52
}
53
}
54
55
bool
Central::contain
(
const
Particles
& parts,
const
Event
*)
const
{
56
Momentum
mom_sum;
57
for
(
const
auto
& part : parts) {
58
const
auto
& mom = part.momentum();
59
if
(!
pt_single
.
contains
(mom.pt()) || !
eta_single
.
contains
(mom.eta()) ||
60
!
rapidity_single
.
contains
(mom.rapidity()) || !
energy_single
.
contains
(mom.energy()) ||
61
!
mass_single
.
contains
(mom.mass()))
62
return
false
;
63
mom_sum += mom;
64
}
65
if
(!
pt_sum
.
contains
(mom_sum.
pt
()) || !
eta_sum
.
contains
(mom_sum.
eta
()) ||
66
!
energy_sum
.
contains
(mom_sum.
energy
()) || !
mass_sum
.
contains
(mom_sum.
mass
()))
67
return
false
;
68
if
(parts.size() > 1) {
// look at correlations
69
const
auto
&mom1 = parts.at(0).momentum(), &mom2 = parts.at(1).momentum();
70
if
(!
pt_diff
.
contains
(fabs(mom1.pt() - mom2.pt())) || !
phi_diff
.
contains
(mom1.deltaPhi(mom2)) ||
71
!
rapidity_diff
.
contains
(fabs(mom1.rapidity() - mom2.rapidity())))
72
return
false
;
73
}
74
return
true
;
75
}
76
77
ParametersDescription
Central::description
() {
78
auto
desc =
ParametersDescription
();
79
desc.add<
Limits
>(
"pt"
,
Limits
{0.}).setDescription(
"Single particle pt (GeV/c)"
);
80
desc.add<
Limits
>(
"eta"
,
Limits
{}).setDescription(
"Single particle eta"
);
81
desc.add<
Limits
>(
"rapidity"
,
Limits
{}).setDescription(
"Single particle rapidity"
);
82
desc.add<
Limits
>(
"energy"
,
Limits
{}).setDescription(
"Single particle energy (GeV)"
);
83
desc.add<
Limits
>(
"mass"
,
Limits
{}).setDescription(
"Single particle mass (GeV/c^2)"
);
84
desc.add<
Limits
>(
"ptsum"
,
Limits
{}).setDescription(
"System pt (GeV/c)"
);
85
desc.add<
Limits
>(
"etasum"
,
Limits
{}).setDescription(
"System eta"
);
86
desc.add<
Limits
>(
"energysum"
,
Limits
{}).setDescription(
"System energy (GeV)"
);
87
desc.add<
Limits
>(
"invmass"
,
Limits
{}).setDescription(
"System mass (GeV/c^2)"
);
88
desc.add<
Limits
>(
"ptdiff"
,
Limits
{}).setDescription(
"System D(pt) (GeV/c)"
);
89
desc.add<
Limits
>(
"dphi"
,
Limits
{}).setDescription(
"System D(phi) (rad)"
);
90
desc.add<
Limits
>(
"rapiditydiff"
,
Limits
{}).setDescription(
"System D(Y)"
);
91
return
desc;
92
}
93
94
//------------------------------------------------------------------
95
96
Initial::Initial
(
const
ParametersList
& params) :
SteeredObject
(params) {
97
(*this).add(
"q2"
,
q2
).add(
"qt"
,
qt
).add(
"phi"
,
phi
);
98
}
99
100
void
Initial::setParameters
(
const
ParametersList
& params) {
101
if
(params.
empty
())
102
return
;
103
SteeredObject::setParameters
(params);
104
if
(
const
auto
q2lim = params.
get
<
Limits
>(
"q2"
); q2lim.valid())
// symmetric Q^2 cut specified
105
q2
= {q2lim, q2lim};
106
for
(
auto
& q2lim :
q2
)
107
if
(q2lim.max() <= 0.) {
108
CG_WARNING
(
"Initial:setParameters"
) <<
"Maximum parton virtuality ("
<< q2lim <<
") is invalid. "
109
<<
"It is now set to "
<< 1.e4 <<
" GeV^2."
;
110
q2lim.max() = 1.e4;
111
}
112
}
113
114
bool
Initial::contain
(
const
Particles
& parts,
const
Event
*)
const
{
115
for
(
const
auto
& part : parts) {
116
const
auto
& mom = part.momentum();
117
if
(!
qt
.
contains
(mom.pt()))
118
return
false
;
119
}
120
if
(parts.size() == 2) {
121
for
(
size_t
i = 0; i < 2; ++i)
122
if
(!
q2
.at(i).contains(parts.at(i).momentum().mass2()))
123
return
false
;
124
if
(
phi
.
valid
() && !
phi
.
contains
(parts.at(0).momentum().deltaPhi(parts.at(1).momentum())))
125
return
false
;
126
}
127
return
true
;
128
}
129
130
ParametersDescription
Initial::description
() {
131
auto
desc =
ParametersDescription
();
132
desc.add(
"q2"
, std::vector<Limits>(2, {0., 1.e5})).setDescription(
"Parton virtuality(ies) (GeV^2)"
);
133
desc.add(
"qt"
,
Limits
{}).setDescription(
"Transverse virtuality (GeV)"
);
134
desc.add(
"phi"
,
Limits
{}).setDescription(
"Partons D(phi) (rad)"
);
135
return
desc;
136
}
137
138
//------------------------------------------------------------------
139
140
Remnants::Remnants
(
const
ParametersList
& params) :
SteeredObject
(params) {
141
(*this).add(
"mx"
,
mx
).add(
"yj"
,
yj
).add(
"xi"
,
xi
);
142
}
143
144
void
Remnants::setParameters
(
const
ParametersList
& params) {
145
if
(params.
empty
())
146
return
;
147
SteeredObject::setParameters
(params);
148
if
(
mx
.
min
() <
MX_MIN
) {
149
CG_WARNING
(
"CutsList:setParameters"
) <<
"Minimum diffractive mass range ("
<<
mx
<<
") is invalid. "
150
<<
"It is now set to "
<<
MX_MIN
<<
" GeV/c^2."
;
151
mx
.
min
() =
MX_MIN
;
152
}
153
}
154
155
bool
Remnants::contain
(
const
Particles
& parts,
const
Event
* evt)
const
{
156
for
(
const
auto
& part : parts) {
157
if
(part.status() !=
Particle::Status::FinalState
)
158
continue
;
159
if
(evt &&
xi
.
valid
() &&
160
!
xi
.
contains
(1. - part.momentum().pz() / (*evt)(*part.mothers().begin()).momentum().pz()))
161
return
false
;
162
if
(!
yj
.
contains
(fabs(part.momentum().rapidity())))
163
return
false
;
164
}
165
return
true
;
166
}
167
168
ParametersDescription
Remnants::description
() {
169
auto
desc =
ParametersDescription
();
170
desc.add<
Limits
>(
"mx"
,
Limits
{
Remnants::MX_MIN
, 1.e3}).setDescription(
"Diffractive mass (GeV/c^2)"
);
171
desc.add<
Limits
>(
"yj"
,
Limits
{}).setDescription(
"Diffractive jet rapidity"
);
172
desc.add<
Limits
>(
"xi"
,
Limits
{}).setDescription(
"Longit.fract.mom. loss (\"xi\")"
);
173
return
desc;
174
}
175
}
// namespace cuts
176
177
//--------------------------------------------------------------------
178
// List of kinematics limits
179
//--------------------------------------------------------------------
180
181
CutsList::CutsList
(
const
ParametersList
& params)
182
:
SteeredObject
(params),
183
initial(steer<
ParametersList
>(
"initial"
)),
184
central(steer<
ParametersList
>(
"central"
)),
185
remnants(steer<
ParametersList
>(
"remnants"
)) {}
186
187
void
CutsList::setParameters
(
const
ParametersList
& params) {
188
if
(params.
empty
())
189
return
;
190
initial
.
setDescribedParameters
(params);
191
central
.
setDescribedParameters
(params);
192
remnants
.
setDescribedParameters
(params);
193
if
(params.
has
<
ParametersList
>(
"cuts"
)) {
// per-particle cuts
194
const
auto
per_part_cuts = params.
get
<
ParametersList
>(
"cuts"
);
195
for
(
const
auto
& part : per_part_cuts.keys())
196
central_particles
[(
pdgid_t
)std::stoi(part)].setDescribedParameters(per_part_cuts.get<
ParametersList
>(part));
197
}
198
199
// override the parameters from sub-parameters content
200
params_
.
set
(
"initial"
,
initial
.
parameters
())
201
.
set
(
"central"
,
central
.
parameters
())
202
.
set
(
"remnants"
,
remnants
.
parameters
());
203
for
(
const
auto
& cuts_vs_part :
central_particles
)
// per-PDGid selection
204
params_
.operator[]<
ParametersList
>(
"cuts"
).
set
<
ParametersList
>(std::to_string(cuts_vs_part.first),
205
cuts_vs_part.second.parameters());
206
CG_DEBUG
(
"CutsList:setParameters"
) <<
"User specified the following cuts list:\n"
<< *
this
<<
"."
;
207
for
(
const
auto
& key :
params_
.
keys
()) {
208
if
(key ==
"initial"
|| key ==
"central"
|| key ==
"remnants"
|| key ==
"cuts"
) {
209
auto
& cuts =
params_
.operator[]<
ParametersList
>(key);
210
for
(
const
auto
& lim_key : cuts.keysOf<
Limits
>())
211
if
(
auto
& lim = cuts.operator[]<
Limits
>(lim_key); lim.
min
() == 0. && lim.max() == 0.) {
212
CG_WARNING
(
"CutsList:setParameters"
)
213
<<
"Unset the range for '"
<< key <<
"/"
<< lim_key <<
"' from "
<< lim <<
"."
;
214
lim =
Limits
{};
215
}
216
}
else
217
params_
.
erase
(key);
218
}
219
initial
.
setParameters
(steer<ParametersList>(
"initial"
));
220
central
.
setParameters
(steer<ParametersList>(
"central"
));
221
remnants
.
setParameters
(steer<ParametersList>(
"remnants"
));
222
}
223
224
ParametersDescription
CutsList::description
() {
225
auto
desc =
ParametersDescription
();
226
desc.add(
"initial"
,
cuts::Initial::description
());
227
desc.add(
"central"
,
cuts::Central::description
());
228
desc.add(
"remnants"
,
cuts::Remnants::description
());
229
return
desc;
230
}
231
232
std::ostream&
operator<<
(std::ostream& os,
const
CutsList
& cl) {
233
auto
dump_cuts = [&os](
const
auto
& obj) {
234
std::string sep;
235
for
(
const
auto
& lim : obj.parameters().template keysOf<Limits>()) {
236
const
auto
& limit = obj.parameters().template get<Limits>(lim);
237
if
(limit.valid() && obj.description().has(lim))
238
os << sep << obj.description().get(lim).description() <<
": "
<< limit, sep =
";"
;
239
}
240
};
241
os <<
"init.system{"
;
242
dump_cuts(cl.
initial
);
243
os <<
"}, cent.system{"
;
244
dump_cuts(cl.
central
);
245
os <<
"}, remnants{"
;
246
dump_cuts(cl.
remnants
);
247
return
os <<
"}"
;
248
}
249
}
// namespace cepgen
Cuts.h
Event.h
Message.h
CG_WARNING
#define CG_WARNING(mod)
Definition
Message.h:228
CG_DEBUG
#define CG_DEBUG(mod)
Definition
Message.h:220
String.h
cepgen::Event
Container for the information on the in- and outgoing particles' kinematics.
Definition
Event.h:28
cepgen::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::Limits::valid
bool valid() const
Is there a lower and upper limit?
Definition
Limits.cpp:85
cepgen::Limits::min
double min() const
Lower limit to apply on the variable.
Definition
Limits.h:52
cepgen::Limits::contains
bool contains(double val, bool exclude_boundaries=false) const
Check if value is inside limits' boundaries.
Definition
Limits.cpp:77
cepgen::Momentum
Container for a particle's 4-momentum, along with useful methods to ease the development of any matri...
Definition
Momentum.h:33
cepgen::Momentum::eta
double eta() const
Pseudo-rapidity.
Definition
Momentum.cpp:240
cepgen::Momentum::pt
double pt() const
Transverse momentum (in GeV)
Definition
Momentum.cpp:232
cepgen::Momentum::mass
double mass() const
Mass (in GeV) as computed from its energy and momentum.
Definition
Momentum.cpp:222
cepgen::Momentum::energy
double energy() const
Energy (in GeV)
Definition
Momentum.h:136
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::ParametersList::has
bool has(const std::string &key) const
Check if a given parameter is handled in this list.
Definition
ParametersList.cpp:386
cepgen::ParametersList::keys
std::vector< std::string > keys(bool name_key=true) const
Definition
ParametersList.cpp:298
cepgen::ParametersList::empty
bool empty() const
Is the list empty?
Definition
ParametersList.cpp:249
cepgen::ParametersList::erase
size_t erase(const std::string &)
Erase a parameter with key.
Definition
ParametersList.cpp:241
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::ParametersList::set
ParametersList & set(const std::string &, const T &)
Set a parameter value Set a recast parameter value.
Definition
ParametersList.cpp:401
cepgen::ParametersList::fill
const ParametersList & fill(const std::string &key, T &value) const
Fill a variable with the key content if exists.
Definition
ParametersList.h:92
cepgen::Particle::Status::FinalState
@ FinalState
Stable, final state particle.
cepgen::Steerable::params_
ParametersList params_
Module parameters.
Definition
Steerable.h:50
cepgen::SteeredObject
Base user-steerable object.
Definition
SteeredObject.h:41
cepgen::SteeredObject::setDescribedParameters
void setDescribedParameters(const ParametersList ¶ms_orig)
Set (documented) module parameters.
Definition
SteeredObject.h:73
cepgen::SteeredObject::setParameters
virtual void setParameters(const ParametersList ¶ms) override
Set module parameters.
Definition
SteeredObject.h:62
cepgen::SteeredObject::parameters
const ParametersList & parameters() const override
Module user-defined parameters.
Definition
SteeredObject.h:54
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::operator<<
std::ostream & operator<<(std::ostream &os, const Exception::Type &type)
Definition
Exception.cpp:59
cepgen::Particles
std::vector< Particle > Particles
List of Particle objects.
Definition
Particle.h:169
cepgen::CutsList
A collection of cuts to apply on the physical phase space.
Definition
Cuts.h:85
cepgen::CutsList::setParameters
void setParameters(const ParametersList &) override
Set module parameters.
Definition
Cuts.cpp:187
cepgen::CutsList::initial
cuts::Initial initial
Cuts on the initial particles kinematics.
Definition
Cuts.h:94
cepgen::CutsList::CutsList
CutsList(const ParametersList &)
Definition
Cuts.cpp:181
cepgen::CutsList::remnants
cuts::Remnants remnants
Cuts on the beam remnants system.
Definition
Cuts.h:97
cepgen::CutsList::central
cuts::Central central
Cuts on the central system produced.
Definition
Cuts.h:95
cepgen::CutsList::description
static ParametersDescription description()
Definition
Cuts.cpp:224
cepgen::CutsList::central_particles
PerIdCuts central_particles
Cuts on the central individual particles.
Definition
Cuts.h:96
cepgen::cuts::Central::energy_sum
Limits energy_sum
multiparticle system energy
Definition
Cuts.h:45
cepgen::cuts::Central::eta_single
Limits eta_single
single particle pseudo-rapidity
Definition
Cuts.h:39
cepgen::cuts::Central::energy_single
Limits energy_single
single particle energy
Definition
Cuts.h:41
cepgen::cuts::Central::mass_single
Limits mass_single
single particle mass
Definition
Cuts.h:42
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::pt_sum
Limits pt_sum
multiparticle system transverse momentum
Definition
Cuts.h:43
cepgen::cuts::Central::phi_diff
Limits phi_diff
azimuthal angles difference between the central particles
Definition
Cuts.h:48
cepgen::cuts::Central::mass_sum
Limits mass_sum
multiparticle system invariant mass
Definition
Cuts.h:46
cepgen::cuts::Central::contain
bool contain(const Particles &, const Event *evt=nullptr) const
Definition
Cuts.cpp:55
cepgen::cuts::Central::eta_sum
Limits eta_sum
multiparticle system pseudo-rapidity
Definition
Cuts.h:44
cepgen::cuts::Central::Central
Central()
Definition
Cuts.cpp:32
cepgen::cuts::Central::pt_single
Limits pt_single
single particle transverse momentum
Definition
Cuts.h:38
cepgen::cuts::Central::description
static ParametersDescription description()
Definition
Cuts.cpp:77
cepgen::cuts::Central::rapidity_diff
Limits rapidity_diff
rapidity balance between the central particles
Definition
Cuts.h:49
cepgen::cuts::Initial::phi
Limits phi
parton azimuthal angle
Definition
Cuts.h:63
cepgen::cuts::Initial::setParameters
void setParameters(const ParametersList &) override
Set module parameters.
Definition
Cuts.cpp:100
cepgen::cuts::Initial::contain
bool contain(const Particles &, const Event *evt=nullptr) const
Definition
Cuts.cpp:114
cepgen::cuts::Initial::q2
std::vector< Limits > q2
parton virtualities
Definition
Cuts.h:61
cepgen::cuts::Initial::description
static ParametersDescription description()
Definition
Cuts.cpp:130
cepgen::cuts::Initial::Initial
Initial(const ParametersList &)
Definition
Cuts.cpp:96
cepgen::cuts::Initial::qt
Limits qt
parton transverse virtuality
Definition
Cuts.h:62
cepgen::cuts::Remnants::mx
Limits mx
diffractive mass
Definition
Cuts.h:75
cepgen::cuts::Remnants::setParameters
void setParameters(const ParametersList &) override
Set module parameters.
Definition
Cuts.cpp:144
cepgen::cuts::Remnants::contain
bool contain(const Particles &, const Event *evt=nullptr) const
Definition
Cuts.cpp:155
cepgen::cuts::Remnants::Remnants
Remnants(const ParametersList &)
Definition
Cuts.cpp:140
cepgen::cuts::Remnants::xi
Limits xi
longitudinal momentum fraction
Definition
Cuts.h:77
cepgen::cuts::Remnants::description
static ParametersDescription description()
Definition
Cuts.cpp:168
cepgen::cuts::Remnants::yj
Limits yj
diffractive jet rapidity
Definition
Cuts.h:76
cepgen::cuts::Remnants::MX_MIN
static constexpr double MX_MIN
Minimal diffractive mass for dissociative proton treatment.
Definition
Cuts.h:79
CepGen
Physics
Cuts.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7