cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Utils.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2020-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 <cmath>
20
22#include "CepGen/Utils/Limits.h"
23#include "CepGen/Utils/Math.h"
24
25namespace cepgen {
26 namespace utils {
27 static const Limits x_limits{0., 1.};
28
29 double mX2(double xbj, double q2, double mp2) {
30 if (!x_limits.contains(xbj))
31 return 0.;
32 return mp2 + q2 * (1. - xbj) / xbj;
33 }
34
35 double q2(double xbj, double mp2, double mx2) {
36 if (!x_limits.contains(xbj))
37 return 0.;
38 return xbj / (1. - xbj) * (mx2 - mp2);
39 }
40
41 double xBj(double q2, double mp2, double mx2) {
42 if (!positive(q2))
43 return 0.;
44 return q2 / (q2 + mx2 - mp2);
45 }
46
47 double energyFromW(double w, double mp2, double m2) {
48 if (!positive(w))
49 return 0.;
50 return 0.5 * (w * w - mp2 + m2) / w;
51 }
52
53 namespace kt {
54 double mX2(double x, double kt2, double q2, double mi2) {
55 if (!positive(x))
56 return 0.;
57 return mi2 + (q2 * (1. - x) - kt2 - x * x * mi2) / x;
58 }
59
60 double q2(double x, double kt2, double mi2, double mx2) {
61 if (!x_limits.contains(x))
62 return 0.;
63 if (mx2 < 0.) // mx2 = mi2
64 return (kt2 + x * x * mi2) / (1. - x);
65 return (kt2 + x * (mx2 - mi2) + x * x * mi2) / (1. - x);
66 }
67 } // namespace kt
68 } // namespace utils
69} // namespace cepgen
Validity interval for a variable.
Definition Limits.h:28
bool contains(double val, bool exclude_boundaries=false) const
Check if value is inside limits' boundaries.
Definition Limits.cpp:77
double mX2(double x, double kt2, double q2, double mi2)
Compute the diffractive mass from longitudinal loss/transverse virtuality/virtuality.
Definition Utils.cpp:54
double q2(double x, double kt2, double mi2, double mx2)
Compute the virtuality from longitudinal loss/transverse virtuality/diffractive mass.
Definition Utils.cpp:60
double xBj(double q2, double mp2, double mx2)
Compute Bjorken x from virtuality/diffractive mass.
Definition Utils.cpp:41
double q2(double xbj, double mp2, double mx2)
Compute the virtuality from Bjorken x/diffractive mass.
Definition Utils.cpp:35
static const Limits x_limits
Definition Utils.cpp:27
bool positive(const T &val)
Check if a number is positive and finite.
Definition Math.cpp:26
double energyFromW(double w, double mp2, double m2)
Compute energy from mass and emitted mass.
Definition Utils.cpp:47
double mX2(double xbj, double q2, double mp2)
Compute the diffractive mass from virtuality/Bjorken x.
Definition Utils.cpp:29
Common namespace for this Monte Carlo generator.