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
50 template<class Hist>
51 PadConfig(const Hist* hist, std::string_view opt)
52 {
53 RegisterHistogram(hist, opt);
54 }
55
57 PadConfig(const PadConfig&) = default;
58
60 PadConfig(PadConfig&&) = default;
61
63 PadConfig& operator=(const PadConfig&) = default;
64
67
69 ~PadConfig() = default;
70
74 void SetGrid(bool gridX, bool gridY = false);
75
80 void SetLog(bool logX, bool logY = false, bool logZ = false);
81
85 void RegisterObject(std::string_view name, std::string_view opt)
86 {
87 fvObjectList.emplace_back(std::make_pair(name, opt));
88 }
89
99 template<class Hist>
100 void RegisterHistogram(const Hist* hist, std::string_view opt)
101 {
102 // NOTE: SZh 21.06.2024:
103 const auto& metadata = hist->GetMetadata();
104 if (metadata.GetFlag(EHistFlag::StoreVsTsId)) {
105 RegisterObject(hist->GetName() + std::string(HistogramMetadata::ksTsIdSuffix), opt);
106 }
107 else if (!metadata.GetFlag(EHistFlag::OmitIntegrated)) {
108 RegisterObject(hist->GetName(), opt);
109 }
110 }
111
113 std::string ToString() const;
114
115 private:
116 bool fbGridX{false};
117 bool fbGridY{false};
118 bool fbLogX{false};
119 bool fbLogY{false};
120 bool fbLogZ{false};
121
122 std::vector<std::pair<std::string, std::string>> fvObjectList;
123 };
124
125
126} // 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:69
A pad configuration for the histogram server.
Definition PadConfig.h:26
PadConfig & operator=(const PadConfig &)=default
Copy assignment operator.
PadConfig(const Hist *hist, std::string_view opt)
Constructor from a single histogram.
Definition PadConfig.h:51
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:122
bool fbLogY
Log flag for y-axis.
Definition PadConfig.h:119
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:120
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:100
void RegisterObject(std::string_view name, std::string_view opt)
Registers an object in the pad.
Definition PadConfig.h:85
bool fbGridY
Grid flag for y-axis.
Definition PadConfig.h:117
~PadConfig()=default
Destructor.
bool fbGridX
Grid flag for x-axis.
Definition PadConfig.h:116
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:118
@ StoreVsTsId
Store the histogram vs timeslice index.
@ OmitIntegrated
Omits storing integrated histogram.