cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
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
19
#include "
CepGen/Core/Exception.h
"
20
#include "
CepGen/Physics/PolarisationState.h
"
21
22
namespace
cepgen
{
23
PolarisationState::PolarisationState
(
const
ParametersList
& params)
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
47
ParametersDescription
PolarisationState::description
() {
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) {
57
case
PolarisationState::Mode::invalid
:
58
default
:
59
return
os <<
"invalid"
;
60
case
PolarisationState::Mode::full
:
61
return
os <<
"full"
;
62
case
PolarisationState::Mode::LT
:
63
return
os <<
"long-trans"
;
64
case
PolarisationState::Mode::TL
:
65
return
os <<
"trans-long"
;
66
case
PolarisationState::Mode::TT
:
67
return
os <<
"trans-trans"
;
68
case
PolarisationState::Mode::LL
:
69
return
os <<
"long-long"
;
70
}
71
}
72
}
// namespace cepgen
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
PolarisationState.h
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::PolarisationState::PolarisationState
PolarisationState(const ParametersList &)
Definition
PolarisationState.cpp:23
cepgen::PolarisationState::Polarisation
std::vector< int > Polarisation
Definition
PolarisationState.h:33
cepgen::PolarisationState::Mode
Mode
Definition
PolarisationState.h:31
cepgen::PolarisationState::Mode::LL
@ LL
cepgen::PolarisationState::Mode::TL
@ TL
cepgen::PolarisationState::Mode::LT
@ LT
cepgen::PolarisationState::Mode::TT
@ TT
cepgen::PolarisationState::Mode::full
@ full
cepgen::PolarisationState::Mode::invalid
@ invalid
cepgen::PolarisationState::Polarisations
std::pair< Polarisation, Polarisation > Polarisations
Definition
PolarisationState.h:34
cepgen::PolarisationState::mode
const Mode & mode() const
Definition
PolarisationState.h:36
cepgen::PolarisationState::description
static ParametersDescription description()
Definition
PolarisationState.cpp:47
cepgen::SteeredObject
Base user-steerable object.
Definition
SteeredObject.h:41
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
cepgen::Element::invalid
@ invalid
cepgen::operator<<
std::ostream & operator<<(std::ostream &os, const Exception::Type &type)
Definition
Exception.cpp:59
CepGen
Physics
PolarisationState.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7