cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
CollinearFlux.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2022-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 <LHAPDF/LHAPDF.h>
20
21#include <numeric>
22
26#include "CepGen/Physics/PDG.h"
27
28namespace cepgen {
29 namespace lhapdf {
30 class CollinearFlux final : public cepgen::CollinearFlux {
31 public:
32 explicit CollinearFlux(const ParametersList& params)
33 : cepgen::CollinearFlux(params),
34 pdf_(LHAPDF::mkPDF(steer<std::string>("set"), steer<int>("member"))),
35 pdgid_(steerAs<int, pdgid_t>("partonPdgId")),
36 extrapolate_pdf_(steer<bool>("extrapolatePDF")) {
37 const auto& pdf_set = steer<std::string>("set");
38 if (!pdf_)
39 throw CG_FATAL("lhapdf:CollinearFlux") << "Failed to initialise the LHAPDF evaluator!\n"
40 << "Parameters: " << params_;
41 if (extrapolate_pdf_ && pdf_->hasFlavor(pdgid_))
42 CG_WARNING("lhapdf:CollinearFlux") << "Asked to retrieve distribution from sum imbalance of other "
43 "contributions although the distribution is present in the '"
44 << pdf_set << "' PDF set.\n\t"
45 << "You may want to steer the 'extrapolatePDF' parameter to 'false'?";
46 if (!extrapolate_pdf_ && !pdf_->hasFlavor(pdgid_))
47 throw CG_FATAL("lhapdf:CollinearFlux")
48 << "PDF set '" << pdf_set << "' does not contain parton with PDG identifier=" << pdgid_ << "!\n"
49 << "PDGs handled: " << pdf_->flavors() << ".";
50
51 CG_INFO("lhapdf:CollinearFlux") << "LHAPDF evaluator for collinear parton (" << (PDG::Id)pdgid_
52 << ") flux initialised.\n\t"
53 << "PDF set: " << steer<std::string>("set") << " (flavours: " << pdf_->flavors()
54 << "), member: " << steer<int>("member") << ".\n\t"
55 << "x range: " << Limits{pdf_->xMin(), pdf_->xMax()} << ", "
56 << "Q^2 range: " << Limits{pdf_->q2Min(), pdf_->q2Max()} << " GeV^2.\n\t"
57 << "Extrapolated from other flavours? " << extrapolate_pdf_ << ".";
58 }
59
62 desc.setDescription("LHAPDF coll.flux");
63 desc.add<std::string>("set", "LUXqed17_plus_PDF4LHC15_nnlo_100").setDescription("PDFset to use");
64 desc.add<int>("member", 0).setDescription("PDF member");
65 desc.addAs<int, pdgid_t>("partonPdgId", PDG::photon).setDescription("parton PDG identifier");
66 desc.add<bool>("extrapolatePDF", false)
67 .setDescription("has the PDF? or extrapolate distribution from sum imbalance of other contributions?");
68 return desc;
69 }
70
71 pdgid_t partonPdgId() const override { return pdgid_; }
72 bool fragmenting() const override { return true; }
73 double mass2() const override { return mp2_; }
74
75 double fluxQ2(double x, double q2) const override {
76 if (x == 0. || !pdf_->inPhysicalRangeXQ2(x, q2))
77 return 0.;
78 if (!extrapolate_pdf_) // has parton PDF
79 return pdf_->xfxQ2((int)pdgid_, x, q2);
80 // extrapolate from other flavours imbalance
81 double xf = 1.;
82 for (const auto& flav : pdf_->xfxQ2(x, q2))
83 if (flav.first != (int)pdgid_)
84 xf -= flav.second;
85 return xf;
86 }
87
88 private:
89 const std::unique_ptr<LHAPDF::PDF> pdf_;
90 const pdgid_t pdgid_;
91 const bool extrapolate_pdf_;
92 };
93 } // namespace lhapdf
94} // namespace cepgen
#define CG_FATAL(mod)
Definition Exception.h:61
#define CG_WARNING(mod)
Definition Message.h:228
#define CG_INFO(mod)
Definition Message.h:216
#define REGISTER_COLLINEAR_FLUX(name, obj)
Add a generic collinear parton flux evaluator builder definition.
static ParametersDescription description()
Validity interval for a variable.
Definition Limits.h:28
A class-in-the-middle PDG identifier for printout operations.
Definition PDG.h:55
@ photon
Definition PDG.h:41
A description object for parameters collection.
const double mp2_
Definition PartonFlux.h:39
U steerAs(const std::string &key) const
Retrieve a recasted parameters as previously steered.
Definition Steerable.h:44
ParametersList params_
Module parameters.
Definition Steerable.h:50
T steer(const std::string &key) const
Retrieve a parameters as previously steered.
Definition Steerable.h:39
bool fragmenting() const override
Is initiator particle fragmenting after parton emission?
double fluxQ2(double x, double q2) const override
Compute the collinear flux for this x value and virtuality.
static ParametersDescription description()
CollinearFlux(const ParametersList &params)
pdgid_t partonPdgId() const override
Parton PDG identifier.
double mass2() const override
Initiator particle squared mass (in )
Common namespace for this Monte Carlo generator.
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
lhapdf
Definition output.py:3