ATLAS Offline Software
SinglePlotDefinition.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETTRACKPERFMON_SINGLEPLOTDEFINITION_H
6 #define INDETTRACKPERFMON_SINGLEPLOTDEFINITION_H
7 
17 #include <string>
19 #include <vector>
20 #include <utility> // std::pair
21 
22 
23 namespace IDTPM {
24 
26 
27  public:
28 
30  typedef std::pair< float, float > axesLimits_t;
31 
34  const std::string& name = "", const std::string& type = "", const std::string& title = "",
35  const std::string& xTitle = "",
36  unsigned int nBinsX = 0, float xLow = 0., float xHigh = 0.,
37  bool doLogLinBinsX = false, const std::vector<float>& xBinsVec = {},
38  const std::string& yTitle = "",
39  unsigned int nBinsY = 0, float yLow = 0., float yHigh = 0.,
40  bool doLogLinBinsY = false, const std::vector<float>& yBinsVec = {},
41  const std::string& zTitle = "",
42  unsigned int nBinsZ = 0, float zLow = 0., float zHigh = 0.,
43  bool doLogLinBinsZ = false, const std::vector<float>& zBinsVec = {},
44  const std::string& folder = "" );
45 
47  ~SinglePlotDefinition() = default;
48 
51 
55  const std::string& name() const { return m_name; }
56  const std::string& type() const { return m_type; }
57  const std::string& title() const { return m_title; }
58  const std::string& xTitle() const { return m_xTitle; }
59  const std::string& yTitle() const { return m_yTitle; }
60  const std::string& zTitle() const { return m_zTitle; }
61  unsigned int nBinsX() const { return m_nBinsX; }
62  unsigned int nBinsY() const { return m_nBinsY; }
63  unsigned int nBinsZ() const { return m_nBinsZ; }
64  float xLow() const { return m_xAxis.first; }
65  float xHigh() const { return m_xAxis.second; }
66  float yLow() const { return m_yAxis.first; }
67  float yHigh() const { return m_yAxis.second; }
68  float zLow() const { return m_zAxis.first; }
69  float zHigh() const { return m_zAxis.second; }
70  bool doLogLinBinsX() const { return m_doLogLinBinsX; }
71  bool doLogLinBinsY() const { return m_doLogLinBinsY; }
72  bool doLogLinBinsZ() const { return m_doLogLinBinsZ; }
73  const std::vector<float>& xBinsVec() const { return m_xBinsVec; }
74  const std::vector<float>& yBinsVec() const { return m_yBinsVec; }
75  const std::vector<float>& zBinsVec() const { return m_zBinsVec; }
76  bool doVarBinsX() const { return ( not m_xBinsVec.empty() ); }
77  bool doVarBinsY() const { return ( not m_yBinsVec.empty() ); }
78  bool doVarBinsZ() const { return ( not m_zBinsVec.empty() ); }
79  const std::string& folder() const { return m_folder; }
80  bool isEmpty() const { return m_empty; }
81  const std::string& identifier() const { return m_identifier; }
82  const std::string& plotDigest() const { return m_plotDigest; }
83  const std::string& titleDigest() const { return m_titleDigest; }
84 
85  bool isValid() const;
86 
91  void name( std::string_view name_s ) { m_name = name_s; digest(); }
92  void type( std::string_view type_s ) { m_type = type_s; digest(); }
93  void title( std::string_view title_s ) { m_title = title_s; digest(); }
94  void xTitle( std::string_view xTitle_s ) { m_xTitle = xTitle_s; digest(); }
95  void yTitle( std::string_view yTitle_s ) { m_yTitle = yTitle_s; digest(); }
96  void zTitle( std::string_view zTitle_s ) { m_zTitle = zTitle_s; digest(); }
97  void nBinsX( float nBinsX_f ) { m_nBinsX = nBinsX_f; digest(); }
98  void nBinsY( float nBinsY_f ) { m_nBinsY = nBinsY_f; digest(); }
99  void nBinsZ( float nBinsZ_f ) { m_nBinsZ = nBinsZ_f; digest(); }
100  void xLimits( float xLow, float xHigh ) { m_xAxis = std::make_pair( xLow, xHigh ); digest(); }
101  void yLimits( float yLow, float yHigh ) { m_yAxis = std::make_pair( yLow, yHigh ); digest(); }
102  void zLimits( float zLow, float zHigh ) { m_zAxis = std::make_pair( zLow, zHigh ); digest(); }
103  void doLogLinBinsX( bool doLogLinBinsX_b ) { m_doLogLinBinsX = doLogLinBinsX_b; }
104  void doLogLinBinsY( bool doLogLinBinsY_b ) { m_doLogLinBinsY = doLogLinBinsY_b; }
105  void doLogLinBinsZ( bool doLogLinBinsZ_b ) { m_doLogLinBinsZ = doLogLinBinsZ_b; }
106  void setxBinsVec( const std::vector<float>& vec ) { if( not vec.empty() ) {
107  m_xBinsVec = vec; m_nBinsX = vec.size() - 1;
108  m_xAxis = std::make_pair( vec.front(), vec.back() ); digest(); } }
109  void setyBinsVec( const std::vector<float>& vec ) { if( not vec.empty() ) {
110  m_yBinsVec = vec; m_nBinsY = vec.size() - 1;
111  m_yAxis = std::make_pair( vec.front(), vec.back() ); digest(); } }
112  void setzBinsVec( const std::vector<float>& vec ) { if( not vec.empty() ) {
113  m_zBinsVec = vec; m_nBinsZ = vec.size() - 1;
114  m_zAxis = std::make_pair( vec.front(), vec.back() ); digest(); } }
115  void folder( std::string_view folder_s ) { m_folder = folder_s; digest(); }
116  void setEmpty( bool empty = true ) { m_empty = empty; }
117 
119  void redoIdDigest();
120 
122  void redoPlotDigest();
123 
125  void redoTitleDigest();
126 
128  void redoTypeDigest();
129 
131  void digest() {
132  redoIdDigest();
133  redoPlotDigest();
134  redoTitleDigest();
135  redoTypeDigest();
136  }
137 
138  private:
139 
141  std::string m_name;
142  std::string m_type;
144  unsigned int m_nBinsX, m_nBinsY, m_nBinsZ;
147  std::vector<float> m_xBinsVec, m_yBinsVec, m_zBinsVec;
148  std::string m_folder;
149 
151  bool m_empty;
152 
154  std::string m_identifier;
155  std::string m_plotDigest;
156  std::string m_titleDigest;
158 
159  }; // class SinglePlotDefinition
160 
161 } // namespace IDTPM
162 
163 #endif // > !INDETTRACKPERFMON_SINGLEPLOTDEFINITION_H
IDTPM::SinglePlotDefinition::setxBinsVec
void setxBinsVec(const std::vector< float > &vec)
Definition: SinglePlotDefinition.h:106
IDTPM::SinglePlotDefinition::m_zTitle
std::string m_zTitle
Definition: SinglePlotDefinition.h:143
IDTPM::SinglePlotDefinition::setzBinsVec
void setzBinsVec(const std::vector< float > &vec)
Definition: SinglePlotDefinition.h:112
IDTPM::SinglePlotDefinition::name
void name(std::string_view name_s)
Definition: SinglePlotDefinition.h:91
IDTPM::SinglePlotDefinition::zBinsVec
const std::vector< float > & zBinsVec() const
Definition: SinglePlotDefinition.h:75
IDTPM::SinglePlotDefinition::m_nBinsX
unsigned int m_nBinsX
Definition: SinglePlotDefinition.h:144
IDTPM::SinglePlotDefinition::m_folder
std::string m_folder
Definition: SinglePlotDefinition.h:148
IDTPM::SinglePlotDefinition::m_type
std::string m_type
Definition: SinglePlotDefinition.h:142
IDTPM::SinglePlotDefinition::m_doLogLinBinsZ
bool m_doLogLinBinsZ
Definition: SinglePlotDefinition.h:146
IDTPM::SinglePlotDefinition::m_xBinsVec
std::vector< float > m_xBinsVec
Definition: SinglePlotDefinition.h:147
IDTPM::SinglePlotDefinition::doVarBinsZ
bool doVarBinsZ() const
Definition: SinglePlotDefinition.h:78
IDTPM::SinglePlotDefinition::type
void type(std::string_view type_s)
Definition: SinglePlotDefinition.h:92
IDTPM::SinglePlotDefinition::redoPlotDigest
void redoPlotDigest()
recompute m_plotDigest
Definition: SinglePlotDefinition.cxx:150
IDTPM::SinglePlotDefinition::digest
void digest()
recompute m_identifier, m_plotDigest, m_titleDigest, m_is*D
Definition: SinglePlotDefinition.h:131
IDTPM::SinglePlotDefinition::redoIdDigest
void redoIdDigest()
recompute m_identifier
Definition: SinglePlotDefinition.cxx:130
IDTPM::SinglePlotDefinition::m_name
std::string m_name
main members
Definition: SinglePlotDefinition.h:141
IDTPM::SinglePlotDefinition::axesLimits_t
std::pair< float, float > axesLimits_t
typedef for axes limits: (lower bound, upper bound)
Definition: SinglePlotDefinition.h:30
IDTPM::SinglePlotDefinition::doLogLinBinsZ
void doLogLinBinsZ(bool doLogLinBinsZ_b)
Definition: SinglePlotDefinition.h:105
IDTPM::SinglePlotDefinition::name
const std::string & name() const
Definition: SinglePlotDefinition.h:55
IDTPM::SinglePlotDefinition::isEmpty
bool isEmpty() const
Definition: SinglePlotDefinition.h:80
IDTPM::SinglePlotDefinition::isValid
bool isValid() const
Definition: SinglePlotDefinition.cxx:72
IDTPM::SinglePlotDefinition::doVarBinsX
bool doVarBinsX() const
Definition: SinglePlotDefinition.h:76
IDTPM::SinglePlotDefinition::m_doLogLinBinsY
bool m_doLogLinBinsY
Definition: SinglePlotDefinition.h:146
IDTPM::SinglePlotDefinition::~SinglePlotDefinition
~SinglePlotDefinition()=default
Default destructor.
IDTPM::SinglePlotDefinition::yLow
float yLow() const
Definition: SinglePlotDefinition.h:66
IDTPM::SinglePlotDefinition
Definition: SinglePlotDefinition.h:25
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
IDTPM::SinglePlotDefinition::m_empty
bool m_empty
status member
Definition: SinglePlotDefinition.h:151
IDTPM::SinglePlotDefinition::SinglePlotDefinition
SinglePlotDefinition(const std::string &name="", const std::string &type="", const std::string &title="", const std::string &xTitle="", unsigned int nBinsX=0, float xLow=0., float xHigh=0., bool doLogLinBinsX=false, const std::vector< float > &xBinsVec={}, const std::string &yTitle="", unsigned int nBinsY=0, float yLow=0., float yHigh=0., bool doLogLinBinsY=false, const std::vector< float > &yBinsVec={}, const std::string &zTitle="", unsigned int nBinsZ=0, float zLow=0., float zHigh=0., bool doLogLinBinsZ=false, const std::vector< float > &zBinsVec={}, const std::string &folder="")
Parametrised Constructor.
Definition: SinglePlotDefinition.cxx:23
IDTPM::SinglePlotDefinition::m_xTitle
std::string m_xTitle
Definition: SinglePlotDefinition.h:143
IDTPM::SinglePlotDefinition::m_yAxis
axesLimits_t m_yAxis
Definition: SinglePlotDefinition.h:145
IDTPM::SinglePlotDefinition::doLogLinBinsY
bool doLogLinBinsY() const
Definition: SinglePlotDefinition.h:71
IDTPM::SinglePlotDefinition::nBinsX
unsigned int nBinsX() const
Definition: SinglePlotDefinition.h:61
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
IDTPM::SinglePlotDefinition::identifier
const std::string & identifier() const
Definition: SinglePlotDefinition.h:81
IDTPM::SinglePlotDefinition::yTitle
void yTitle(std::string_view yTitle_s)
Definition: SinglePlotDefinition.h:95
IDTPM::SinglePlotDefinition::yBinsVec
const std::vector< float > & yBinsVec() const
Definition: SinglePlotDefinition.h:74
IDTPM::SinglePlotDefinition::title
void title(std::string_view title_s)
Definition: SinglePlotDefinition.h:93
IDTPM::SinglePlotDefinition::folder
void folder(std::string_view folder_s)
Definition: SinglePlotDefinition.h:115
IDTPM::SinglePlotDefinition::doLogLinBinsY
void doLogLinBinsY(bool doLogLinBinsY_b)
Definition: SinglePlotDefinition.h:104
IDTPM::SinglePlotDefinition::xHigh
float xHigh() const
Definition: SinglePlotDefinition.h:65
IDTPM::SinglePlotDefinition::m_plotDigest
std::string m_plotDigest
Definition: SinglePlotDefinition.h:155
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
IDTPM::SinglePlotDefinition::m_title
std::string m_title
Definition: SinglePlotDefinition.h:143
IDTPM::SinglePlotDefinition::title
const std::string & title() const
Definition: SinglePlotDefinition.h:57
IDTPM::SinglePlotDefinition::m_identifier
std::string m_identifier
derived members, i.e. dependant on main members
Definition: SinglePlotDefinition.h:154
IDTPM::SinglePlotDefinition::nBinsZ
unsigned int nBinsZ() const
Definition: SinglePlotDefinition.h:63
IDTPM::SinglePlotDefinition::doVarBinsY
bool doVarBinsY() const
Definition: SinglePlotDefinition.h:77
IDTPM::SinglePlotDefinition::type
const std::string & type() const
Definition: SinglePlotDefinition.h:56
IDTPM::SinglePlotDefinition::m_titleDigest
std::string m_titleDigest
Definition: SinglePlotDefinition.h:156
IDTPM::SinglePlotDefinition::yLimits
void yLimits(float yLow, float yHigh)
Definition: SinglePlotDefinition.h:101
IDTPM::SinglePlotDefinition::xTitle
void xTitle(std::string_view xTitle_s)
Definition: SinglePlotDefinition.h:94
IDTPM::SinglePlotDefinition::zHigh
float zHigh() const
Definition: SinglePlotDefinition.h:69
IDTPM::SinglePlotDefinition::nBinsY
unsigned int nBinsY() const
Definition: SinglePlotDefinition.h:62
IDTPM::SinglePlotDefinition::zLimits
void zLimits(float zLow, float zHigh)
Definition: SinglePlotDefinition.h:102
IDTPM::SinglePlotDefinition::yHigh
float yHigh() const
Definition: SinglePlotDefinition.h:67
IDTPM::SinglePlotDefinition::m_nBinsY
unsigned int m_nBinsY
Definition: SinglePlotDefinition.h:144
IDTPM::SinglePlotDefinition::xBinsVec
const std::vector< float > & xBinsVec() const
Definition: SinglePlotDefinition.h:73
IDTPM::SinglePlotDefinition::xLow
float xLow() const
Definition: SinglePlotDefinition.h:64
IDTPM::SinglePlotDefinition::doLogLinBinsZ
bool doLogLinBinsZ() const
Definition: SinglePlotDefinition.h:72
IDTPM::SinglePlotDefinition::m_xAxis
axesLimits_t m_xAxis
Definition: SinglePlotDefinition.h:145
IDTPM::SinglePlotDefinition::setEmpty
void setEmpty(bool empty=true)
Definition: SinglePlotDefinition.h:116
IDTPM::SinglePlotDefinition::nBinsX
void nBinsX(float nBinsX_f)
Definition: SinglePlotDefinition.h:97
IDTPM::SinglePlotDefinition::m_is2D
bool m_is2D
Definition: SinglePlotDefinition.h:157
IDTPM::SinglePlotDefinition::m_zBinsVec
std::vector< float > m_zBinsVec
Definition: SinglePlotDefinition.h:147
IDTPM::SinglePlotDefinition::redoTitleDigest
void redoTitleDigest()
recompute m_titleDigest
Definition: SinglePlotDefinition.cxx:167
IDTPM::SinglePlotDefinition::m_is3D
bool m_is3D
Definition: SinglePlotDefinition.h:157
IDTPM::SinglePlotDefinition::titleDigest
const std::string & titleDigest() const
Definition: SinglePlotDefinition.h:83
IDTPM::SinglePlotDefinition::plotDigest
const std::string & plotDigest() const
Definition: SinglePlotDefinition.h:82
IDTPM::SinglePlotDefinition::zTitle
void zTitle(std::string_view zTitle_s)
Definition: SinglePlotDefinition.h:96
IDTPM::SinglePlotDefinition::m_is1D
bool m_is1D
Definition: SinglePlotDefinition.h:157
IDTPM::SinglePlotDefinition::xLimits
void xLimits(float xLow, float xHigh)
Definition: SinglePlotDefinition.h:100
IDTPM::SinglePlotDefinition::operator=
SinglePlotDefinition & operator=(const SinglePlotDefinition &)=default
= operator
IDTPM::SinglePlotDefinition::setyBinsVec
void setyBinsVec(const std::vector< float > &vec)
Definition: SinglePlotDefinition.h:109
IDTPM::SinglePlotDefinition::xTitle
const std::string & xTitle() const
Definition: SinglePlotDefinition.h:58
IDTPM::SinglePlotDefinition::m_yBinsVec
std::vector< float > m_yBinsVec
Definition: SinglePlotDefinition.h:147
IDTPM::SinglePlotDefinition::m_zAxis
axesLimits_t m_zAxis
Definition: SinglePlotDefinition.h:145
IDTPM::SinglePlotDefinition::m_nBinsZ
unsigned int m_nBinsZ
Definition: SinglePlotDefinition.h:144
IDTPM::SinglePlotDefinition::zLow
float zLow() const
Definition: SinglePlotDefinition.h:68
IDTPM::SinglePlotDefinition::m_yTitle
std::string m_yTitle
Definition: SinglePlotDefinition.h:143
IDTPM::SinglePlotDefinition::nBinsY
void nBinsY(float nBinsY_f)
Definition: SinglePlotDefinition.h:98
IDTPM::SinglePlotDefinition::m_doLogLinBinsX
bool m_doLogLinBinsX
Definition: SinglePlotDefinition.h:146
IDTPM::SinglePlotDefinition::yTitle
const std::string & yTitle() const
Definition: SinglePlotDefinition.h:59
IDTPM::SinglePlotDefinition::folder
const std::string & folder() const
Definition: SinglePlotDefinition.h:79
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
IDTPM::SinglePlotDefinition::doLogLinBinsX
bool doLogLinBinsX() const
Definition: SinglePlotDefinition.h:70
IDTPM::SinglePlotDefinition::doLogLinBinsX
void doLogLinBinsX(bool doLogLinBinsX_b)
Definition: SinglePlotDefinition.h:103
IDTPM::SinglePlotDefinition::nBinsZ
void nBinsZ(float nBinsZ_f)
Definition: SinglePlotDefinition.h:99
IDTPM::SinglePlotDefinition::redoTypeDigest
void redoTypeDigest()
recompute m_is*D
Definition: SinglePlotDefinition.cxx:180
IDTPM::SinglePlotDefinition::zTitle
const std::string & zTitle() const
Definition: SinglePlotDefinition.h:60