cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Drawable.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2022 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
#ifndef CepGen_Utils_Drawable_h
20
#define CepGen_Utils_Drawable_h
21
22
#include <map>
23
#include <string>
24
25
#include "
CepGen/Utils/Limits.h
"
26
#include "
CepGen/Utils/Value.h
"
27
28
namespace
cepgen
{
29
namespace
utils {
31
class
Drawable
{
32
public
:
33
explicit
Drawable
(
const
std::string&
name
=
""
,
const
std::string&
title
=
""
) :
name_
(
name
),
title_
(
title
) {}
34
virtual
~Drawable
() {}
35
37
const
std::string&
name
()
const
{
return
name_
; }
39
void
setName
(
const
std::string&
name
) {
name_
=
name
; }
40
42
const
std::string&
title
()
const
{
return
title_
; }
44
void
setTitle
(
const
std::string&
title
) {
title_
=
title
; }
45
47
class
AxisInfo
{
48
public
:
50
AxisInfo
&
setLabel
(
const
std::string&
label
) {
51
label_ =
label
;
52
return
*
this
;
53
}
55
const
std::string&
label
()
const
{
return
label_; }
57
AxisInfo
&
setMinimum
(
double
min) {
58
lim_.
min
() = min;
59
return
*
this
;
60
}
62
AxisInfo
&
setMaximum
(
double
max) {
63
lim_.
max
() = max;
64
return
*
this
;
65
}
67
AxisInfo
&
setRange
(
const
Limits
& lim) {
68
lim_ = lim;
69
return
*
this
;
70
}
72
const
Limits
&
range
()
const
{
return
lim_; }
73
74
private
:
75
std::string label_;
76
Limits
lim_;
77
};
78
79
AxisInfo
&
xAxis
() {
return
xaxis_
; }
80
const
AxisInfo
&
xAxis
()
const
{
return
xaxis_
; }
81
AxisInfo
&
yAxis
() {
return
yaxis_
; }
82
const
AxisInfo
&
yAxis
()
const
{
return
yaxis_
; }
83
AxisInfo
&
zAxis
() {
return
zaxis_
; }
84
const
AxisInfo
&
zAxis
()
const
{
return
zaxis_
; }
85
87
struct
coord_t
{
89
bool
operator<
(
const
coord_t
& oth)
const
{
return
value
< oth.
value
; }
90
double
value
{0.};
91
double
value_unc
= 0.;
92
std::string
label
=
""
;
93
};
95
typedef
std::map<coord_t, Value>
axis_t
;
97
struct
CompareAxisByValue
{
98
bool
operator()
(
const
std::pair<coord_t, Value>& lhs,
const
std::pair<coord_t, Value>& rhs) {
99
return
lhs.second < rhs.second;
100
}
101
};
103
typedef
std::map<coord_t, axis_t>
dualaxis_t
;
104
105
virtual
bool
isHist1D
()
const
{
return
false
; }
106
virtual
bool
isHist2D
()
const
{
return
false
; }
107
virtual
bool
isGraph1D
()
const
{
return
false
; }
108
virtual
bool
isGraph2D
()
const
{
return
false
; }
109
110
protected
:
111
std::string
name_
;
112
std::string
title_
;
113
AxisInfo
xaxis_
;
114
AxisInfo
yaxis_
;
115
AxisInfo
zaxis_
;
116
};
117
}
// namespace utils
118
}
// namespace cepgen
119
120
#endif
Limits.h
Value.h
cepgen::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::Limits::min
double min() const
Lower limit to apply on the variable.
Definition
Limits.h:52
cepgen::Limits::max
double max() const
Upper limit to apply on the variable.
Definition
Limits.h:54
cepgen::utils::Drawable::AxisInfo
Metadata for an axis.
Definition
Drawable.h:47
cepgen::utils::Drawable::AxisInfo::label
const std::string & label() const
Axis title.
Definition
Drawable.h:55
cepgen::utils::Drawable::AxisInfo::setMinimum
AxisInfo & setMinimum(double min)
Set the minimum range.
Definition
Drawable.h:57
cepgen::utils::Drawable::AxisInfo::setLabel
AxisInfo & setLabel(const std::string &label)
Set the axis title.
Definition
Drawable.h:50
cepgen::utils::Drawable::AxisInfo::setRange
AxisInfo & setRange(const Limits &lim)
Set the full axis range.
Definition
Drawable.h:67
cepgen::utils::Drawable::AxisInfo::setMaximum
AxisInfo & setMaximum(double max)
Set the maximum range.
Definition
Drawable.h:62
cepgen::utils::Drawable::AxisInfo::range
const Limits & range() const
Axis range.
Definition
Drawable.h:72
cepgen::utils::Drawable
A generic object which can be drawn in the standard output.
Definition
Drawable.h:31
cepgen::utils::Drawable::axis_t
std::map< coord_t, Value > axis_t
Metadata for an axis (coordinates and bins value)
Definition
Drawable.h:95
cepgen::utils::Drawable::Drawable
Drawable(const std::string &name="", const std::string &title="")
Definition
Drawable.h:33
cepgen::utils::Drawable::name
const std::string & name() const
Drawable name.
Definition
Drawable.h:37
cepgen::utils::Drawable::xAxis
const AxisInfo & xAxis() const
Definition
Drawable.h:80
cepgen::utils::Drawable::yAxis
AxisInfo & yAxis()
Definition
Drawable.h:81
cepgen::utils::Drawable::zAxis
AxisInfo & zAxis()
Definition
Drawable.h:83
cepgen::utils::Drawable::title
const std::string & title() const
Drawable name.
Definition
Drawable.h:42
cepgen::utils::Drawable::name_
std::string name_
Computer-readable name.
Definition
Drawable.h:111
cepgen::utils::Drawable::~Drawable
virtual ~Drawable()
Definition
Drawable.h:34
cepgen::utils::Drawable::yaxis_
AxisInfo yaxis_
y-axis metadata
Definition
Drawable.h:114
cepgen::utils::Drawable::isGraph2D
virtual bool isGraph2D() const
Is this drawable a two-dimensional graph?
Definition
Drawable.h:108
cepgen::utils::Drawable::xAxis
AxisInfo & xAxis()
Definition
Drawable.h:79
cepgen::utils::Drawable::yAxis
const AxisInfo & yAxis() const
Definition
Drawable.h:82
cepgen::utils::Drawable::title_
std::string title_
Human-readable title.
Definition
Drawable.h:112
cepgen::utils::Drawable::setName
void setName(const std::string &name)
Set the drawable name.
Definition
Drawable.h:39
cepgen::utils::Drawable::isHist1D
virtual bool isHist1D() const
Is this drawable a one-dimensional histogram?
Definition
Drawable.h:105
cepgen::utils::Drawable::isGraph1D
virtual bool isGraph1D() const
Is this drawable a one-dimensional graph?
Definition
Drawable.h:107
cepgen::utils::Drawable::isHist2D
virtual bool isHist2D() const
Is this drawable a two-dimensional histogram?
Definition
Drawable.h:106
cepgen::utils::Drawable::zAxis
const AxisInfo & zAxis() const
Definition
Drawable.h:84
cepgen::utils::Drawable::setTitle
void setTitle(const std::string &title)
Set the drawable title.
Definition
Drawable.h:44
cepgen::utils::Drawable::dualaxis_t
std::map< coord_t, axis_t > dualaxis_t
Metadata for a two-dimensional axis definition (coordinates and bins values)
Definition
Drawable.h:103
cepgen::utils::Drawable::xaxis_
AxisInfo xaxis_
x-axis metadata
Definition
Drawable.h:113
cepgen::utils::Drawable::zaxis_
AxisInfo zaxis_
z-axis metadata
Definition
Drawable.h:115
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
cepgen::utils::Drawable::CompareAxisByValue
Comparator of an axis by the values it holds.
Definition
Drawable.h:97
cepgen::utils::Drawable::CompareAxisByValue::operator()
bool operator()(const std::pair< coord_t, Value > &lhs, const std::pair< coord_t, Value > &rhs)
Definition
Drawable.h:98
cepgen::utils::Drawable::coord_t
Generic bin coordinate and its human-readable label.
Definition
Drawable.h:87
cepgen::utils::Drawable::coord_t::operator<
bool operator<(const coord_t &oth) const
Sorting helper for axis coordinates.
Definition
Drawable.h:89
cepgen::utils::Drawable::coord_t::label
std::string label
Human-readable description of the bin.
Definition
Drawable.h:92
cepgen::utils::Drawable::coord_t::value_unc
double value_unc
Bin uncertainty.
Definition
Drawable.h:91
cepgen::utils::Drawable::coord_t::value
double value
Bin central value.
Definition
Drawable.h:90
CepGen
Utils
Drawable.h
Generated on Mon Jul 29 2024 for CepGen by
1.9.7