Belle II Software  release-05-01-25
PIDPriors.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Umberto Tamponi (tamponi@to.infn.it) *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <TObject.h>
14 
15 #include <analysis/dbobjects/PIDPriorsTable.h>
16 #include <framework/gearbox/Const.h>
17 
18 class TH2F;
19 
20 namespace Belle2 {
33  class PIDPriors : public TObject {
34 
38  ClassDef(PIDPriors, 1);
39 
40 
41  public:
42 
46  PIDPriors() {};
47 
48 
54  void setPriors(const Const::ChargedStable& particle, const PIDPriorsTable& table)
55  {
56  auto index = particle.getIndex();
57  m_priors[index] = table;
58  return;
59  }
60 
61 
70  void setPriors(const Const::ChargedStable& particle, std::vector<float> xAxisEdges, std::vector<float> yAxisEdges,
71  std::vector<float> priorsTable, std::vector<float> errorsTable)
72  {
73  auto index = particle.getIndex();
74  m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
75  m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
76  m_priors[index].setPriorsTable(priorsTable);
77  m_priors[index].setErrorsTable(errorsTable);
78  return;
79  }
80 
81 
88  void setPriors(const Const::ChargedStable& particle, TH2F* priorHistogram);
89 
90 
99  void setPriors(const Const::ChargedStable& particle, TH2F* counts, TH2F* normalization);
100 
101 
109  void setPriorsAxes(const Const::ChargedStable& particle, std::vector<float> xAxisEdges, std::vector<float> yAxisEdges)
110  {
111  auto index = particle.getIndex();
112  m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
113  m_priors[index].setBinEdges(xAxisEdges, yAxisEdges);
114  return;
115  }
116 
117 
124  void setPriorsTable(const Const::ChargedStable& particle, std::vector<float> priorsTable)
125  {
126  auto index = particle.getIndex();
127  m_priors[index].setPriorsTable(priorsTable);
128  return;
129  }
130 
131 
138  void setErrorsTable(const Const::ChargedStable& particle, std::vector<float> errorsTable)
139  {
140  auto index = particle.getIndex();
141  m_priors[index].setErrorsTable(errorsTable);
142  return;
143  }
144 
145 
152  void setAxisLabels(const Const::ChargedStable& particle, std::string xAxisLabel, std::string yAxisLabel)
153  {
154  auto index = particle.getIndex();
155  m_priors[index].setAxisLabels(xAxisLabel, yAxisLabel);
156  return;
157  }
158 
159 
166  {
167  auto index = particle.getIndex();
168  return m_priors[index];
169  }
170 
171 
179  float getPriorValue(const Const::ChargedStable& particle, float x, float y) const
180  {
181  auto index = particle.getIndex();
182  return m_priors[index].getPriorValue(x, y);
183  }
184 
185 
193  float getPriorError(const Const::ChargedStable& particle, float x, float y) const
194  {
195  auto index = particle.getIndex();
196  return m_priors[index].getErrorValue(x, y);
197  }
198 
199 
205  std::string getXAxisLabel(const Const::ChargedStable& particle) const
206  {
207  auto index = particle.getIndex();
208  return m_priors[index].getXAxisLabel();
209  }
210 
211 
217  std::string getYAxisLabel(const Const::ChargedStable& particle) const
218  {
219  auto index = particle.getIndex();
220  return m_priors[index].getYAxisLabel();
221  }
222 
223  private:
227  };
228 
229 
231 } // Belle2 namespace
232 
233 
Belle2::PIDPriorsTable::setAxisLabels
void setAxisLabels(const std::string &labelX, const std::string &labelY)
Sets axes lables.
Definition: PIDPriorsTable.h:95
Belle2::PIDPriorsTable::getXAxisLabel
std::string getXAxisLabel() const
Returns the X axis label.
Definition: PIDPriorsTable.h:149
Belle2::Const::ChargedStable::c_SetSize
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:491
Belle2::PIDPriorsTable::getYAxisLabel
std::string getYAxisLabel() const
Returns the Y axis label.
Definition: PIDPriorsTable.h:158
Belle2::PIDPriors::setPriorsAxes
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:109
Belle2::PIDPriors::PIDPriors
PIDPriors()
Default constructor.
Definition: PIDPriors.h:46
Belle2::PIDPriorsTable::getErrorValue
float getErrorValue(float x, float y) const
Returns the error on the prior probability for a given value of (x,y).
Definition: PIDPriorsTable.cc:90
Belle2::PIDPriors::setErrorsTable
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:138
Belle2::PIDPriors::setPriors
void setPriors(const Const::ChargedStable &particle, const PIDPriorsTable &table)
Sets the prior table for a particle species from a PIDPriorsTable object.
Definition: PIDPriors.h:54
Belle2::PIDPriors::ClassDef
ClassDef(PIDPriors, 1)
Class revision number.
Belle2::PIDPriors::setPriorsTable
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:124
Belle2::PIDPriorsTable::setBinEdges
void setBinEdges(const std::vector< float > &binEdgesX, const std::vector< float > &binEdgesY)
Sets the bin edges arrays.
Definition: PIDPriorsTable.cc:18
Belle2::PIDPriorsTable::setPriorsTable
void setPriorsTable(const std::vector< float > &priors)
Sets the priors table from a 2D std::vector.
Definition: PIDPriorsTable.h:54
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PIDPriors::getPriorValue
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:179
Belle2::PIDPriors::m_priors
PIDPriorsTable m_priors[Const::ChargedStable::c_SetSize]
The array of PIDPiorsTable, one per particle species.
Definition: PIDPriors.h:224
Belle2::PIDPriors::setAxisLabels
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:152
Belle2::PIDPriors
A database class to hold the prior probability for the particle identification.
Definition: PIDPriors.h:33
Belle2::PIDPriors::getXAxisLabel
std::string getXAxisLabel(const Const::ChargedStable &particle) const
Returns the X axis label of the prior.
Definition: PIDPriors.h:205
Belle2::PIDPriors::getYAxisLabel
std::string getYAxisLabel(const Const::ChargedStable &particle) const
Returns the Y axis label of the prior.
Definition: PIDPriors.h:217
Belle2::PIDPriorsTable::setErrorsTable
void setErrorsTable(const std::vector< float > &errors)
Sets the priors error table from a 2D std::vector.
Definition: PIDPriorsTable.h:65
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
Belle2::PIDPriors::getPriorError
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:193
Belle2::PIDPriorsTable::getPriorValue
float getPriorValue(float x, float y) const
Returns the prior probability for a given value of (x,y).
Definition: PIDPriorsTable.cc:80
Belle2::PIDPriors::setPriors
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 a the std::vectors of the bin edges and the probabil...
Definition: PIDPriors.h:70
Belle2::PIDPriorsTable
This class holds the prior distribution for a single particle species.
Definition: PIDPriorsTable.h:37
Belle2::PIDPriors::getPriorsTable
PIDPriorsTable getPriorsTable(const Const::ChargedStable &particle) const
Returns the priors table of the selected particle species.
Definition: PIDPriors.h:165