cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Graph.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_Graph_h
20#define CepGen_Utils_Graph_h
21
22#include <set>
23
25
26namespace cepgen {
27 namespace utils {
29 class Graph1D final : public Drawable {
30 public:
31 explicit Graph1D(const std::string& name = "", const std::string& title = "");
32
34 Graph1D& addPoint(double x, double y);
36 Graph1D& addPoint(double x, double y, double ex, double ey);
38 const axis_t& points() const { return values_; }
40 double minimum() const;
42 double maximum() const;
44 double chi2(const Graph1D&) const;
45
47 std::set<double> xCoords() const;
49 const Value valueAt(double) const;
50
51 bool isGraph1D() const override { return true; }
52
53 private:
54 axis_t values_;
55 };
56
58 class Graph2D final : public Drawable {
59 public:
60 explicit Graph2D(const std::string& name = "", const std::string& title = "");
61
63 Graph2D& addPoint(double x, double y, double z);
65 Graph2D& addPoint(double x, double y, double z, double ex, double ey, double ez);
67 const dualaxis_t& points() const { return values_; }
69 void dumpPoints(std::ostream&) const;
70
72 std::set<double> xCoords() const;
74 std::set<double> yCoords() const;
76 const Value valueAt(double, double) const;
77
78 bool isGraph2D() const override { return true; }
79
80 private:
81 dualaxis_t values_;
82 };
83 } // namespace utils
84} // namespace cepgen
85
86#endif
A scalar value with its uncertainty.
Definition Value.h:26
A generic object which can be drawn in the standard output.
Definition Drawable.h:31
std::map< coord_t, Value > axis_t
Metadata for an axis (coordinates and bins value)
Definition Drawable.h:95
const std::string & name() const
Drawable name.
Definition Drawable.h:37
const std::string & title() const
Drawable name.
Definition Drawable.h:42
std::map< coord_t, axis_t > dualaxis_t
Metadata for a two-dimensional axis definition (coordinates and bins values)
Definition Drawable.h:103
A one-dimensional graph object.
Definition Graph.h:29
double minimum() const
Minimum value registered in this graph.
Definition Graph.cpp:40
double chi2(const Graph1D &) const
Compute the between this graph and another.
Definition Graph.cpp:48
Graph1D & addPoint(double x, double y)
Add one value to the graph.
Definition Graph.cpp:30
const axis_t & points() const
Retrieve all values in the graph.
Definition Graph.h:38
std::set< double > xCoords() const
List of horizontal axis coordinates.
Definition Graph.cpp:66
double maximum() const
Maximum value registered in this graph.
Definition Graph.cpp:44
const Value valueAt(double) const
Retrieve the value of the graph at a given coordinate.
Definition Graph.cpp:73
bool isGraph1D() const override
Is this drawable a one-dimensional graph?
Definition Graph.h:51
A two-dimensional graph object.
Definition Graph.h:58
Graph2D & addPoint(double x, double y, double z)
Add one value to the graph.
Definition Graph.cpp:82
std::set< double > yCoords() const
List of vertical axis coordinates.
Definition Graph.cpp:107
const dualaxis_t & points() const
Retrieve all values in the graph.
Definition Graph.h:67
std::set< double > xCoords() const
List of horizontal axis coordinates.
Definition Graph.cpp:100
bool isGraph2D() const override
Is this drawable a two-dimensional graph?
Definition Graph.h:78
void dumpPoints(std::ostream &) const
List all values registered in the graph.
Definition Graph.cpp:92
const Value valueAt(double, double) const
Retrieve the value of the graph at the given coordinates.
Definition Graph.cpp:115
Common namespace for this Monte Carlo generator.