cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches
PolarisationState.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2023 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
21
22namespace cepgen {
24 : SteeredObject(params),
25 mode_(params_.has<int>("mode") ? steerAs<int, Mode>("mode") : Mode::invalid),
26 pol_(mode_ == Mode::invalid ? std::make_pair(steer<std::vector<int> >("W1"), steer<std::vector<int> >("W2"))
27 : computePolarisations(mode_)) {}
28
29 PolarisationState::Polarisations PolarisationState::computePolarisations(const Mode& mode) {
30 switch (mode) {
31 case Mode::LL:
32 return std::make_pair(Polarisation{0}, Polarisation{0});
33 case Mode::LT:
34 return std::make_pair(Polarisation{0}, Polarisation{-1, 1});
35 case Mode::TL:
36 return std::make_pair(Polarisation{-1, 1}, Polarisation{0});
37 case Mode::TT:
38 return std::make_pair(Polarisation{-1, 1}, Polarisation{-1, 1});
39 case Mode::full:
40 return std::make_pair(Polarisation{-1, 0, 1}, Polarisation{-1, 0, 1});
41 default:
42 throw CG_FATAL("PolarisationState:computePolarisations")
43 << "Invalid mode for polarisation states computation: " << mode << ".";
44 }
45 }
46
48 auto desc = ParametersDescription();
49 desc.addAs<int, Mode>("mode", Mode::invalid);
50 desc.add<std::vector<int> >("W1", {-1, 0, 1}).setDescription("First polarisation states");
51 desc.add<std::vector<int> >("W2", {-1, 0, 1}).setDescription("Second polarisation states");
52 return desc;
53 }
54
55 std::ostream& operator<<(std::ostream& os, const PolarisationState::Mode& mode) {
56 switch (mode) {
58 default:
59 return os << "invalid";
61 return os << "full";
63 return os << "long-trans";
65 return os << "trans-long";
67 return os << "trans-trans";
69 return os << "long-long";
70 }
71 }
72} // namespace cepgen
#define CG_FATAL(mod)
Definition Exception.h:61
A description object for parameters collection.
PolarisationState(const ParametersList &)
std::vector< int > Polarisation
std::pair< Polarisation, Polarisation > Polarisations
const Mode & mode() const
static ParametersDescription description()
Base user-steerable object.
Common namespace for this Monte Carlo generator.
std::ostream & operator<<(std::ostream &os, const Exception::Type &type)
Definition Exception.cpp:59