Belle II Software light-2406-ragdoll
PIDPriors.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12
13#include <analysis/dbobjects/PIDPriorsTable.h>
14#include <framework/gearbox/Const.h>
15
16class TH2F;
17
18namespace Belle2 {
31 class PIDPriors : public TObject {
32
37
38
39 public:
40
45
46
52 void setPriors(const Const::ChargedStable& particle, const PIDPriorsTable& table)
53 {
54 auto index = particle.getIndex();
55 m_priors[index] = table;
56 return;
57 }
58
59
68 void setPriors(const Const::ChargedStable& particle, std::vector<float> xAxisEdges, std::vector<float> yAxisEdges,
69 std::vector<float> priorsTable, std::vector<float> errorsTable)
70 {
71 auto index = particle.getIndex();
72 m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
73 m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
74 m_priors[index].setPriorsTable(priorsTable);
75 m_priors[index].setErrorsTable(errorsTable);
76 return;
77 }
78
79
86 void setPriors(const Const::ChargedStable& particle, TH2F* priorHistogram);
87
88
97 void setPriors(const Const::ChargedStable& particle, TH2F* counts, TH2F* normalization);
98
99
107 void setPriorsAxes(const Const::ChargedStable& particle, std::vector<float> xAxisEdges, std::vector<float> yAxisEdges)
108 {
109 auto index = particle.getIndex();
110 m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
111 m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
112 return;
113 }
114
115
122 void setPriorsTable(const Const::ChargedStable& particle, std::vector<float> priorsTable)
123 {
124 auto index = particle.getIndex();
125 m_priors[index].setPriorsTable(priorsTable);
126 return;
127 }
128
129
136 void setErrorsTable(const Const::ChargedStable& particle, std::vector<float> errorsTable)
137 {
138 auto index = particle.getIndex();
139 m_priors[index].setErrorsTable(errorsTable);
140 return;
141 }
142
143
150 void setAxisLabels(const Const::ChargedStable& particle, std::string xAxisLabel, std::string yAxisLabel)
151 {
152 auto index = particle.getIndex();
153 m_priors[index].setAxisLabels(xAxisLabel, yAxisLabel);
154 return;
155 }
156
157
164 {
165 auto index = particle.getIndex();
166 return m_priors[index];
167 }
168
169
177 float getPriorValue(const Const::ChargedStable& particle, float x, float y) const
178 {
179 auto index = particle.getIndex();
180 return m_priors[index].getPriorValue(x, y);
181 }
182
183
191 float getPriorError(const Const::ChargedStable& particle, float x, float y) const
192 {
193 auto index = particle.getIndex();
194 return m_priors[index].getErrorValue(x, y);
195 }
196
197
203 std::string getXAxisLabel(const Const::ChargedStable& particle) const
204 {
205 auto index = particle.getIndex();
206 return m_priors[index].getXAxisLabel();
207 }
208
209
215 std::string getYAxisLabel(const Const::ChargedStable& particle) const
216 {
217 auto index = particle.getIndex();
218 return m_priors[index].getYAxisLabel();
219 }
220
221 private:
225 };
226
227
229} // Belle2 namespace
230
231
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:615
int getIndex() const
This particle's index in the associated set.
Definition: Const.h:461
This class holds the prior distribution for a single particle species.
void setErrorsTable(const std::vector< float > &errors)
Sets the priors error table from a 2D std::vector.
void setBinEdges(const std::vector< float > &binEdgesX, const std::vector< float > &binEdgesY)
Sets the bin edges arrays.
float getPriorValue(float x, float y) const
Returns the prior probability for a given value of (x,y).
std::string getXAxisLabel() const
Returns the X axis label.
float getErrorValue(float x, float y) const
Returns the error on the prior probability for a given value of (x,y).
void setPriorsTable(const std::vector< float > &priors)
Sets the priors table from a 2D std::vector.
std::string getYAxisLabel() const
Returns the Y axis label.
void setAxisLabels(const std::string &labelX, const std::string &labelY)
Sets axes labels.
A database class to hold the prior probability for the particle identification.
Definition: PIDPriors.h:31
void setErrorsTable(const Const::ChargedStable &particle, std::vector< float > errorsTable)
Sets the probability error table for the priors of the selected particle species.
Definition: PIDPriors.h:136
void setPriors(const Const::ChargedStable &particle, std::vector< float > xAxisEdges, std::vector< float > yAxisEdges, std::vector< float > priorsTable, std::vector< float > errorsTable)
Sets the prior table for a particle species from the std::vectors of the bin edges and the probabilit...
Definition: PIDPriors.h:68
float getPriorError(const Const::ChargedStable &particle, float x, float y) const
Returns the error on the prior probability associated to a particle with defined species and paramete...
Definition: PIDPriors.h:191
std::string getXAxisLabel(const Const::ChargedStable &particle) const
Returns the X axis label of the prior.
Definition: PIDPriors.h:203
PIDPriorsTable m_priors[Const::ChargedStable::c_SetSize]
The array of PIDPiorsTable, one per particle species.
Definition: PIDPriors.h:222
PIDPriorsTable getPriorsTable(const Const::ChargedStable &particle) const
Returns the priors table of the selected particle species.
Definition: PIDPriors.h:163
ClassDef(PIDPriors, 1)
Class revision number.
std::string getYAxisLabel(const Const::ChargedStable &particle) const
Returns the Y axis label of the prior.
Definition: PIDPriors.h:215
void setAxisLabels(const Const::ChargedStable &particle, std::string xAxisLabel, std::string yAxisLabel)
Sets the axis labels for the priors of the selected particle species.
Definition: PIDPriors.h:150
void setPriors(const Const::ChargedStable &particle, const PIDPriorsTable &table)
Sets the prior table for a particle species from a PIDPriorsTable object.
Definition: PIDPriors.h:52
void setPriorsTable(const Const::ChargedStable &particle, std::vector< float > priorsTable)
Sets the probability table for the priors of the selected particle species.
Definition: PIDPriors.h:122
PIDPriors()
Default constructor.
Definition: PIDPriors.h:44
float getPriorValue(const Const::ChargedStable &particle, float x, float y) const
Returns the prior probability associated to a particle with defined species and parameters.
Definition: PIDPriors.h:177
void setPriorsAxes(const Const::ChargedStable &particle, std::vector< float > xAxisEdges, std::vector< float > yAxisEdges)
Sets the axes for the priors table of the selected species.
Definition: PIDPriors.h:107
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24