cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
PartonFluxFactory.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
24#include "CepGen/Utils/String.h"
25
26namespace cepgen {
28 const ParametersList& params) const {
29 if (name.empty())
30 throw CG_FATAL("PartonFluxFactory:describeParameters") << "No name given to describe parton flux modelling.";
31 if (utils::contains(CollinearFluxFactory::get().modules(), name))
32 return CollinearFluxFactory::get().describeParameters(name, params);
33 if (utils::contains(KTFluxFactory::get().modules(), name))
34 return KTFluxFactory::get().describeParameters(name, params);
35 return ParametersDescription().setName(name);
36 }
37
38 bool PartonFluxFactory::elastic(const ParametersList& params) const {
39 const auto& name = params.name();
40 if (name.empty())
41 throw CG_FATAL("PartonFluxFactory:elastic") << "No name given to get parton flux modelling elasticity.";
42 if (utils::contains(CollinearFluxFactory::get().modules(), name))
43 return !CollinearFluxFactory::get().build(name, params)->fragmenting();
44 if (utils::contains(KTFluxFactory::get().modules(), name))
45 return !KTFluxFactory::get().build(name, params)->fragmenting();
46 throw CG_FATAL("PartonFluxFactory:elastic") << "Failed to find a parton flux with name '" << name << "'.";
47 }
48
50 const auto& name = params.name();
51 if (name.empty())
52 throw CG_FATAL("PartonFluxFactory:partonPdgId") << "No name given to get parton flux modelling PDG id.";
53 if (utils::contains(CollinearFluxFactory::get().modules(), name))
54 return CollinearFluxFactory::get().build(name, params)->partonPdgId();
55 if (utils::contains(KTFluxFactory::get().modules(), name))
56 return KTFluxFactory::get().build(name, params)->partonPdgId();
57 throw CG_FATAL("PartonFluxFactory:partonPdgId") << "Failed to find a parton flux with name '" << name << "'.";
58 }
59} // namespace cepgen
#define CG_FATAL(mod)
Definition Exception.h:61
A description object for parameters collection.
ParametersDescription & setName(const std::string &name)
Set the module name.
std::string name(const std::string &def="") const
Retrieve the module name if any.
bool contains(const std::vector< T > &coll, const T &item)
Check if a vector contains an item.
Definition Collections.h:47
Common namespace for this Monte Carlo generator.
int partonPdgId(const ParametersList &) const
Type of parton exchanged.
bool elastic(const ParametersList &) const
Is the beam modelling elastic?
ParametersDescription describeParameters(const std::string &name, const ParametersList &params=ParametersList()) const