CbmRoot
Loading...
Searching...
No Matches
PadConfig.h
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#pragma once
11
12#include "Histogram.h"
13
14#include <string>
15#include <string_view>
16#include <utility>
17#include <vector>
18
19namespace cbm::algo::qa
20{
26 class PadConfig {
27 public:
29 PadConfig() = default;
30
37 PadConfig(bool gridX, bool gridY, bool logX, bool logY, bool logZ)
38 : fbGridX(gridX)
39 , fbGridY(gridY)
40 , fbLogX(logX)
41 , fbLogY(logY)
42 , fbLogZ(logZ)
43 {
44 }
45
46
48 PadConfig(const PadConfig&) = default;
49
51 PadConfig(PadConfig&&) = default;
52
54 PadConfig& operator=(const PadConfig&) = default;
55
58
60 ~PadConfig() = default;
61
65 void SetGrid(bool gridX, bool gridY = false);
66
71 void SetLog(bool logX, bool logY = false, bool logZ = false);
72
76 void RegisterObject(std::string_view name, std::string_view opt)
77 {
78 fvObjectList.emplace_back(std::make_pair(name, opt));
79 }
80
90 template<class Hist>
91 void RegisterHistogram(const Hist* hist, std::string_view opt)
92 {
93 // NOTE: SZh 21.06.2024:
94 const auto& metadata = hist->GetMetadata();
95 if (metadata.GetFlag(EHistFlag::StoreVsTsId)) {
96 RegisterObject(hist->GetName() + std::string(HistogramMetadata::ksTsIdSuffix), opt);
97 }
98 else if (!metadata.GetFlag(EHistFlag::OmitIntegrated)) {
99 RegisterObject(hist->GetName(), opt);
100 }
101 }
102
104 std::string ToString() const;
105
106 private:
107 bool fbGridX = false;
108 bool fbGridY = false;
109 bool fbLogX = false;
110 bool fbLogY = false;
111 bool fbLogZ = false;
112
113 std::vector<std::pair<std::string, std::string>> fvObjectList;
114 };
115
116
117} // namespace cbm::algo
ROOT-free implementation of a histogram.
static constexpr std::string_view ksTsIdSuffix
Suffix of additional histograms vs. TS index.
Definition Histogram.h:68
A pad configuration for the histogram server.
Definition PadConfig.h:26
PadConfig & operator=(const PadConfig &)=default
Copy assignment operator.
std::string ToString() const
Returns message config.
Definition PadConfig.cxx:37
std::vector< std::pair< std::string, std::string > > fvObjectList
List of objects on the pad.
Definition PadConfig.h:113
bool fbLogY
Log flag for y-axis.
Definition PadConfig.h:110
PadConfig(bool gridX, bool gridY, bool logX, bool logY, bool logZ)
Constructor from parameters.
Definition PadConfig.h:37
PadConfig(PadConfig &&)=default
Move constructor.
bool fbLogZ
Log flag for z-axis.
Definition PadConfig.h:111
void SetGrid(bool gridX, bool gridY=false)
Set grid flags.
Definition PadConfig.cxx:20
void RegisterHistogram(const Hist *hist, std::string_view opt)
Registers a histogram in the pad.
Definition PadConfig.h:91
void RegisterObject(std::string_view name, std::string_view opt)
Registers an object in the pad.
Definition PadConfig.h:76
bool fbGridY
Grid flag for y-axis.
Definition PadConfig.h:108
~PadConfig()=default
Destructor.
bool fbGridX
Grid flag for x-axis.
Definition PadConfig.h:107
PadConfig(const PadConfig &)=default
Copy constructor.
void SetLog(bool logX, bool logY=false, bool logZ=false)
Sets logarithm axis.
Definition PadConfig.cxx:28
PadConfig()=default
Constructor.
PadConfig & operator=(PadConfig &&)=default
Move assignment operator.
bool fbLogX
Log flag for x-axis.
Definition PadConfig.h:109
@ StoreVsTsId
Store the histogram vs timeslice index.
@ OmitIntegrated
Omits storing integrated histogram.