cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches
FactorisedProcess.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2023-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
20#include "CepGen/Event/Event.h"
23#include "CepGen/Physics/Beam.h"
24#include "CepGen/Physics/PDG.h"
27#include "CepGen/Utils/Math.h"
28
29namespace cepgen {
30 namespace proc {
32 : Process(params),
33 psgen_(PhaseSpaceGeneratorFactory::get().build(
34 steer<ParametersList>("kinematicsGenerator")
35 .set("ids", std::vector<int>(central.begin(), central.end())))),
36 symmetrise_(steer<bool>("symmetrise")),
37 store_alphas_(steer<bool>("storeAlphas")) {
38 event().map()[Particle::CentralSystem].resize(central.size());
39 }
40
42 : Process(proc),
43 psgen_(PhaseSpaceGeneratorFactory::get().build(proc.psgen_->parameters())),
44 symmetrise_(proc.symmetrise_),
45 store_alphas_(proc.store_alphas_) {}
46
49 const auto cent_pdgids = psgen_->central();
54 {Particle::CentralSystem, spdgids_t(cent_pdgids.begin(), cent_pdgids.end())}});
55 }
56
58 if (!psgen_)
59 throw CG_FATAL("FactorisedProcess:prepareKinematics")
60 << "Phase space generator not set. Please check your process initialisation procedure, as you might "
61 "be doing something irregular.";
62 psgen_->initialise(this);
63
66
67 CG_DEBUG("FactorisedProcess:prepareKinematics") << "Partons: " << psgen_->partons() << ", "
68 << "central system: " << psgen_->central() << ". " << event();
69
70 // register all process-dependent variables
72
73 // register the outgoing remnants' variables
74 if (!kinematics().incomingBeams().positive().elastic())
75 defineVariable(mX2(), Mapping::square, kinematics().cuts().remnants.mx, "Positive-z beam remnant squared mass");
76 if (!kinematics().incomingBeams().negative().elastic())
77 defineVariable(mY2(), Mapping::square, kinematics().cuts().remnants.mx, "Negative-z beam remnant squared mass");
78 // symmetrisation of the phase space: factor 2 in Jacobian for single-dissociation
81 ? 2.
82 : 1.;
83 }
84
86 if (!psgen_->generate())
87 return 0.;
88 if (const auto cent_weight = computeFactorisedMatrixElement(); utils::positive(cent_weight))
89 return cent_weight * psgen_->weight() * kin_prefactor_;
90 return 0.;
91 }
92
94 // beam systems
95 if (!kinematics().incomingBeams().positive().elastic())
96 pX().setMass2(mX2());
97 if (!kinematics().incomingBeams().negative().elastic())
98 pY().setMass2(mY2());
99
100 // parton systems
101 auto& part1 = event().oneWithRole(Particle::Parton1);
102 auto& part2 = event().oneWithRole(Particle::Parton2);
103 part1.setMomentum(pA() - pX(), true);
104 part2.setMomentum(pB() - pY(), true);
105
106 if (symmetrise_ && rnd_gen_->uniformInt(0, 1) == 1) { // symmetrise the el-in and in-el cases
107 std::swap(pX(), pY());
108 std::swap(q1(), q2());
109 std::swap(pc(0), pc(1));
110 for (auto* mom : {&q1(), &q2(), &pX(), &pY(), &pc(0), &pc(1)})
111 mom->mirrorZ();
112 }
113
114 // add couplings to metadata
115 if (store_alphas_) {
116 const auto two_part_mass = (part1.momentum() + part2.momentum()).mass();
117 event().metadata["alphaEM"] = alphaEM(two_part_mass);
118 event().metadata["alphaS"] = alphaS(two_part_mass);
119 }
120 }
121
122 //----- utilities
123
124 double FactorisedProcess::that() const { return psgen_->that(); }
125
126 double FactorisedProcess::uhat() const { return psgen_->uhat(); }
127
129 auto desc = Process::description();
130 desc.setDescription("Unnamed factorised process");
131 desc.add("kinematics",
133 .addParametersDescriptionVector(
134 "partonFluxes",
135 PartonFluxFactory::get().describeParameters("BudnevElastic"),
136 std::vector<ParametersList>(
137 2, PartonFluxFactory::get().describeParameters("BudnevElastic").parameters()))
138 .setDescription("Parton fluxes modelling"));
139 desc.add("kinematicsGenerator", PhaseSpaceGeneratorFactory::get().describeParameters("kt2to4"));
140 desc.add<bool>("symmetrise", false).setDescription("Symmetrise along z the central system?");
141 desc.add<bool>("storeAlphas", false)
142 .setDescription("store the electromagnetic and strong coupling constants to the event content?");
143 return desc;
144 }
145 } // namespace proc
146} // namespace cepgen
#define CG_FATAL(mod)
Definition Exception.h:61
#define CG_ASSERT(assertion)
Definition Exception.h:62
#define CG_DEBUG(mod)
Definition Message.h:220
spdgid_t integerPdgId() const
Beam particle PDG id Set the beam particle PDG id.
Definition Beam.h:47
ParticlesMap & map()
Internal particles map retrieval operator.
Definition Event.h:69
Particle & oneWithRole(Particle::Role role)
First Particle object with a given role in the event.
Definition Event.cpp:181
EventMetadata metadata
List of auxiliary information.
Definition Event.h:129
const Beam & positive() const
Reference to the positive-z beam information.
const Beam & negative() const
Reference to the negative-z beam information.
mode::Kinematics mode() const
Type of kinematics to consider for the phase space.
IncomingBeams & incomingBeams()
Beam/primary particle kinematics.
Definition Kinematics.h:36
static ParametersDescription description()
Momentum & setMass2(double)
Compute the energy from the mass.
Definition Momentum.cpp:179
A description object for parameters collection.
Particle & setMomentum(const Momentum &, bool offshell=false)
Associate a momentum object to this particle.
Definition Particle.cpp:104
Particle & setIntegerPdgId(long pdg_id)
Definition Particle.cpp:122
@ IncomingBeam2
incoming beam particle
Definition Particle.h:53
@ Parton2
beam incoming parton
Definition Particle.h:59
@ OutgoingBeam1
outgoing beam state/particle
Definition Particle.h:54
@ IncomingBeam1
incoming beam particle
Definition Particle.h:52
@ OutgoingBeam2
outgoing beam state/particle
Definition Particle.h:55
@ Parton1
beam incoming parton
Definition Particle.h:58
@ CentralSystem
Central particles system.
Definition Particle.h:56
const ParametersList & parameters() const override
Module user-defined parameters.
Generic parton emission-factorised process.
FactorisedProcess(const ParametersList &params, const spdgids_t &output)
Class constructor.
virtual void prepareFactorisedPhaseSpace()=0
Prepare central part of the Jacobian after kinematics is set.
const std::unique_ptr< PhaseSpaceGenerator > psgen_
Kinematic variables generator for the phase space coverage.
void fillKinematics() override final
Fill the Event object with the particles' kinematics.
void prepareKinematics() override final
Compute the incoming state kinematics.
static ParametersDescription description()
virtual double computeFactorisedMatrixElement()=0
Factorised matrix element (event weight)
void addEventContent() override
Set the incoming and outgoing state to be expected in the process.
double computeWeight() override
Compute the phase space point weight.
Class template to define any process to compute using this MC integrator/events generator.
Definition Process.h:34
const Kinematics & kinematics() const
Constant reference to the process kinematics.
Definition Process.h:50
const Momentum & pA() const
Positive-z incoming beam particle's 4-momentum.
Definition Process.cpp:91
const Momentum & pX() const
Positive-z outgoing beam particle's 4-momentum.
Definition Process.cpp:99
const Momentum & q2() const
Negative-z incoming parton's 4-momentum.
Definition Process.cpp:111
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
double mY2() const
Negative-z outgoing beam particle's squared mass.
Definition Process.h:77
double alphaEM(double q) const
Compute the electromagnetic running coupling algorithm at a given scale.
Definition Process.cpp:350
const Momentum & pB() const
Negative-z incoming beam particle's 4-momentum.
Definition Process.cpp:95
void setEventContent(const std::unordered_map< Particle::Role, spdgids_t > &)
Set the incoming and outgoing states to be defined in this process (and prepare the Event object acco...
Definition Process.cpp:374
Momentum & pc(size_t)
Central particle's 4-momentum.
Definition Process.cpp:113
const Momentum & pY() const
Negative-z outgoing beam particle's 4-momentum.
Definition Process.cpp:103
std::unique_ptr< utils::RandomGenerator > rnd_gen_
Process-local random number generator engine.
Definition Process.h:161
static ParametersDescription description()
Definition Process.cpp:407
double mX2() const
Positive-z outgoing beam particle's squared mass.
Definition Process.h:74
const Event & event() const
Handled particles objects and their relationships.
Definition Process.cpp:269
double alphaS(double q) const
Compute the strong coupling algorithm at a given scale.
Definition Process.cpp:357
const Momentum & q1() const
Positive-z incoming parton's 4-momentum.
Definition Process.cpp:107
@ InelasticElastic
proton-proton single-dissociative (or elastic-inelastic) case
@ ElasticInelastic
proton-proton single-dissociative (or inelastic-elastic) case
bool positive(const T &val)
Check if a number is positive and finite.
Definition Math.cpp:26
Common namespace for this Monte Carlo generator.
std::vector< spdgid_t > spdgids_t
static PartonFluxFactory & get()