cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches
Beam.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2013-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
23#include "CepGen/Physics/Beam.h"
25#include "CepGen/Physics/PDG.h"
26
27namespace cepgen {
29 : SteeredObject(params),
30 pdg_id_(steerAs<int, pdgid_t>("pdgId")),
31 momentum_(Momentum::fromPxPyPzM(0., 0., steer<double>("pz"), PDG::get().mass(pdg_id_))) {
32 (*this).add("formFactors", formfac_).add("partonFlux", flux_info_).add("elastic", elastic_);
33 }
34
36 auto desc = ParametersDescription();
37 desc.addAs<int, pdgid_t>("pdgId", PDG::proton);
38 desc.add<double>("pz", 0.);
39 return desc;
40 }
41
42 std::ostream& operator<<(std::ostream& os, const Beam& beam) {
43 os << (PDG::Id)beam.pdg_id_ << " (" << beam.momentum_.pz() << " GeV/c) "
44 << (beam.elastic_ ? "elastic" : "inelastic");
45 if (const auto& part_flux_name = beam.flux_info_.name(); !part_flux_name.empty())
46 os << " [parton flux: " << beam.flux_info_.print(true) << "]";
47 else if (const auto& formfac_name = beam.formfac_.name(); !formfac_name.empty())
48 os << " [form factors: " << beam.formfac_.print(true) << "]";
49 return os;
50 }
51} // namespace cepgen
Incoming beams characteristics.
Definition Beam.h:30
static ParametersDescription description()
Definition Beam.cpp:35
Beam(const ParametersList &)
Default constructor.
Definition Beam.cpp:28
Container for a particle's 4-momentum, along with useful methods to ease the development of any matri...
Definition Momentum.h:33
double pz() const
Longitudinal momentum (in GeV)
Definition Momentum.h:120
A class-in-the-middle PDG identifier for printout operations.
Definition PDG.h:55
A singleton holding all physics constants associated to particles.
Definition PDG.h:28
@ proton
Definition PDG.h:50
A description object for parameters collection.
std::string name(const std::string &def="") const
Retrieve the module name if any.
const ParametersList & print(std::ostream &) const
Debugging-like printout of a parameters container.
Base user-steerable object.
Common namespace for this Monte Carlo generator.
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
std::ostream & operator<<(std::ostream &os, const Exception::Type &type)
Definition Exception.cpp:59