cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Drawer.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2022-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 <bitset>
20
#include <cstdint>
21
#include <iostream>
22
23
#include "
CepGen/Utils/Drawer.h
"
24
#include "
CepGen/Utils/Message.h
"
25
26
namespace
cepgen
{
27
namespace
utils {
28
Drawer::Drawer
(
const
ParametersList
& params) :
NamedModule
(params) {}
29
30
bool
operator&
(
const
Drawer::Mode
& lhs,
const
Drawer::Mode::value_t
& rhs) {
return
(
int
)lhs.value_ & (int)rhs; }
31
32
Drawer::Mode
operator|
(
const
Drawer::Mode
& lhs,
const
Drawer::Mode::value_t
& rhs) {
33
std::bitset<16> mod1((
int
)lhs.
value
()), mod2((
int
)rhs);
34
return
Drawer::Mode
((
Drawer::Mode::value_t
)(mod1 | mod2).to_ulong());
35
}
36
37
std::ostream&
operator<<
(std::ostream& os,
const
Drawer::Mode
& mode) {
38
if
(mode.
value
() ==
Drawer::Mode::none
)
39
return
os <<
"none"
;
40
std::string sep;
41
if
(mode &
Drawer::Mode::logx
)
42
os << sep <<
"logx"
, sep =
"|"
;
43
if
(mode &
Drawer::Mode::logy
)
44
os << sep <<
"logy"
, sep =
"|"
;
45
if
(mode &
Drawer::Mode::logz
)
46
os << sep <<
"logz"
, sep =
"|"
;
47
if
(mode &
Drawer::Mode::nostack
)
48
os << sep <<
"nostack"
, sep =
"|"
;
49
if
(mode &
Drawer::Mode::grid
)
50
os << sep <<
"grid"
, sep =
"|"
;
51
if
(mode &
Drawer::Mode::col
)
52
os << sep <<
"col"
, sep =
"|"
;
53
if
(mode &
Drawer::Mode::cont
)
54
os << sep <<
"cont"
, sep =
"|"
;
55
if
(mode &
Drawer::Mode::ratio
)
56
os << sep <<
"ratio"
, sep =
"|"
;
57
return
os;
58
}
59
}
// namespace utils
60
61
utils::Drawer::Mode
operator|
(
const
utils::Drawer::Mode::value_t
& lhs,
const
utils::Drawer::Mode::value_t
& rhs) {
62
std::bitset<16> mod1((
int
)lhs), mod2((
int
)rhs);
63
return
utils::Drawer::Mode
((mod1 | mod2).to_ulong());
64
}
65
}
// namespace cepgen
66
67
cepgen::utils::Drawer::Mode
&
operator|=
(
cepgen::utils::Drawer::Mode
& one,
68
const
cepgen::utils::Drawer::Mode::value_t
& oth) {
69
one = one | oth;
70
return
one;
71
}
Drawer.h
Message.h
operator|=
cepgen::utils::Drawer::Mode & operator|=(cepgen::utils::Drawer::Mode &one, const cepgen::utils::Drawer::Mode::value_t &oth)
Definition
Drawer.cpp:67
cepgen::NamedModule
Base runtime module object.
Definition
NamedModule.h:28
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::utils::Drawer::Mode
Definition
Drawer.h:41
cepgen::utils::Drawer::Mode::value_t
value_t
Definition
Drawer.h:43
cepgen::utils::Drawer::Mode::col
@ col
Definition
Drawer.h:50
cepgen::utils::Drawer::Mode::cont
@ cont
Definition
Drawer.h:51
cepgen::utils::Drawer::Mode::logz
@ logz
Definition
Drawer.h:47
cepgen::utils::Drawer::Mode::nostack
@ nostack
Definition
Drawer.h:48
cepgen::utils::Drawer::Mode::grid
@ grid
Definition
Drawer.h:49
cepgen::utils::Drawer::Mode::none
@ none
Definition
Drawer.h:44
cepgen::utils::Drawer::Mode::ratio
@ ratio
Definition
Drawer.h:52
cepgen::utils::Drawer::Mode::logx
@ logx
Definition
Drawer.h:45
cepgen::utils::Drawer::Mode::logy
@ logy
Definition
Drawer.h:46
cepgen::utils::Drawer::Mode::value
const value_t & value() const
Definition
Drawer.h:62
cepgen::utils::Drawer::Drawer
Drawer(const ParametersList ¶ms)
Build a drawing utility.
Definition
Drawer.cpp:28
cepgen::utils::operator<<
std::ostream & operator<<(std::ostream &os, const Drawer::Mode &mode)
Definition
Drawer.cpp:37
cepgen::utils::operator&
bool operator&(const Drawer::Mode &lhs, const Drawer::Mode::value_t &rhs)
Definition
Drawer.cpp:30
cepgen::utils::operator|
Drawer::Mode operator|(const Drawer::Mode &lhs, const Drawer::Mode::value_t &rhs)
Definition
Drawer.cpp:32
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
cepgen::operator|
utils::Drawer::Mode operator|(const utils::Drawer::Mode::value_t &lhs, const utils::Drawer::Mode::value_t &rhs)
Definition
Drawer.cpp:61
CepGen
Utils
Drawer.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7