cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Drawer.h
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#ifndef CepGen_Utils_Drawer_h
20#define CepGen_Utils_Drawer_h
21
22#include <cstdint>
23
25
26namespace cepgen {
27 namespace utils {
28 class Graph1D;
29 class Graph2D;
30 class Hist1D;
31 class Hist2D;
32 class Drawable;
34 typedef std::vector<const Drawable*> DrawableColl;
36 class Drawer : public NamedModule<Drawer> {
37 public:
39 explicit Drawer(const ParametersList& params);
40
41 class Mode {
42 public:
43 enum value_t : uint16_t {
44 none = 0,
45 logx = 1 << 0,
46 logy = 1 << 1,
47 logz = 1 << 2,
48 nostack = 1 << 3,
49 grid = 1 << 4,
50 col = 1 << 5,
51 cont = 1 << 6,
52 ratio = 1 << 7,
53 bar = 1 << 8
54 };
55 Mode() : value_(none) {}
56 Mode(int val) : value_((value_t)val) {}
57 Mode(const value_t& val) : value_(val) {}
58
59 friend std::ostream& operator<<(std::ostream&, const Mode&);
60 friend bool operator&(const Mode&, const Mode::value_t&);
61
62 const value_t& value() const { return value_; }
63
64 private:
65 value_t value_;
66 };
67
69 virtual const Drawer& draw(const Graph1D&, const Mode& mode = Mode::none) const = 0;
71 virtual const Drawer& draw(const Graph2D&, const Mode& mode = Mode::none) const = 0;
73 virtual const Drawer& draw(const Hist1D&, const Mode& mode = Mode::none) const = 0;
75 virtual const Drawer& draw(const Hist2D&, const Mode& mode = Mode::none) const = 0;
76
78 virtual const Drawer& draw(const DrawableColl&,
79 const std::string& name = "",
80 const std::string& title = "",
81 const Mode& mode = Mode::none) const = 0;
82
84 virtual std::ostream& operator<<(std::ostream& os) const { return os; }
85
86 protected:
87 friend class Drawable;
88 friend class Graph1D;
89 friend class Graph2D;
90 friend class Hist1D;
91 friend class Hist2D;
92 };
93 } // namespace utils
96} // namespace cepgen
98
99#endif
cepgen::utils::Drawer::Mode & operator|=(cepgen::utils::Drawer::Mode &, const cepgen::utils::Drawer::Mode::value_t &)
Definition Drawer.cpp:67
Base runtime module object.
Definition NamedModule.h:28
const std::string & name() const
Module unique indexing name.
Definition NamedModule.h:42
A generic object which can be drawn in the standard output.
Definition Drawable.h:31
Mode(const value_t &val)
Definition Drawer.h:57
friend bool operator&(const Mode &, const Mode::value_t &)
Definition Drawer.cpp:30
friend std::ostream & operator<<(std::ostream &, const Mode &)
Definition Drawer.cpp:37
const value_t & value() const
Definition Drawer.h:62
A generic drawing utility.
Definition Drawer.h:36
virtual const Drawer & draw(const Hist2D &, const Mode &mode=Mode::none) const =0
Draw a two-dimensional histogram.
virtual const Drawer & draw(const DrawableColl &, const std::string &name="", const std::string &title="", const Mode &mode=Mode::none) const =0
Draw a collection of drawables.
virtual const Drawer & draw(const Hist1D &, const Mode &mode=Mode::none) const =0
Draw a one-dimensional histogram.
virtual const Drawer & draw(const Graph2D &, const Mode &mode=Mode::none) const =0
Draw a two-dimensional graph.
virtual const Drawer & draw(const Graph1D &, const Mode &mode=Mode::none) const =0
Draw a one-dimensional graph.
virtual std::ostream & operator<<(std::ostream &os) const
Output operator (when necessary)
Definition Drawer.h:84
A one-dimensional graph object.
Definition Graph.h:29
A two-dimensional graph object.
Definition Graph.h:58
1D histogram container
Definition Histogram.h:72
2D histogram container
Definition Histogram.h:146
std::vector< const Drawable * > DrawableColl
A collection of drawable objects.
Definition Drawer.h:34
Common namespace for this Monte Carlo generator.
utils::Drawer::Mode operator|(const utils::Drawer::Mode::value_t &lhs, const utils::Drawer::Mode::value_t &rhs)
Definition Drawer.cpp:61