cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic 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"
25
26namespace 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
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
62 std::bitset<16> mod1((int)lhs), mod2((int)rhs);
63 return utils::Drawer::Mode((mod1 | mod2).to_ulong());
64 }
65} // namespace cepgen
66
69 one = one | oth;
70 return one;
71}
cepgen::utils::Drawer::Mode & operator|=(cepgen::utils::Drawer::Mode &one, const cepgen::utils::Drawer::Mode::value_t &oth)
Definition Drawer.cpp:67
Base runtime module object.
Definition NamedModule.h:28
const value_t & value() const
Definition Drawer.h:62
Drawer(const ParametersList &params)
Build a drawing utility.
Definition Drawer.cpp:28
std::ostream & operator<<(std::ostream &os, const Drawer::Mode &mode)
Definition Drawer.cpp:37
bool operator&(const Drawer::Mode &lhs, const Drawer::Mode::value_t &rhs)
Definition Drawer.cpp:30
Drawer::Mode operator|(const Drawer::Mode &lhs, const Drawer::Mode::value_t &rhs)
Definition Drawer.cpp:32
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