Belle II Software development
dEdxPDFs.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/* basf2 headers. */
12#include <framework/gearbox/Const.h>
13
14/* C++ headers. */
15#include <array>
16#include <vector>
17
18/* ROOT headers. */
19#include <TH2F.h>
20#include <TObject.h>
21
22namespace Belle2 {
32 class dEdxPDFs: public TObject {
33
34 public:
35
39 dEdxPDFs() = default;
40
46 const TH2F* getPDF(const Const::ChargedStable& chargedStable, bool truncated) const
47 {
48 return getPDF(chargedStable.getIndex(), truncated);
49 }
50
56 const TH2F* getPDF(const unsigned int hypothesis, const bool truncated) const
57 {
58 return truncated ? &(m_dEdxPDFsTruncated.at(hypothesis)) : &(m_dEdxPDFs.at(hypothesis));
59 }
60
66 const std::vector<const TH2F*>& getPDFs(bool truncated) const;
67
74 void setPDF(const TH2F& pdf, const Const::ChargedStable& chargedStable, bool truncated)
75 {
76 setPDF(pdf, chargedStable.getIndex(), truncated);
77 }
78
85 void setPDF(const TH2F& pdf, const unsigned int hypothesis, const bool truncated)
86 {
87 if (truncated)
88 m_dEdxPDFsTruncated.at(hypothesis) = pdf;
89 else
90 m_dEdxPDFs.at(hypothesis) = pdf;
91 }
92
98 bool checkPDFs(bool truncated) const;
99
100 private:
101
103 std::array<TH2F, Const::ChargedStable::c_SetSize> m_dEdxPDFs;
104
106 std::array<TH2F, Const::ChargedStable::c_SetSize> m_dEdxPDFsTruncated;
107
109 mutable std::vector<const TH2F*> m_cachePDFs;
110
112 mutable std::vector<const TH2F*> m_cachePDFsTruncated;
113
116
117 };
118
120}
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589
int getIndex() const
This particle's index in the associated set.
Definition: Const.h:461
Base class for holding the dE/dx PDFs.
Definition: dEdxPDFs.h:32
std::vector< const TH2F * > m_cachePDFs
cache for a vector of pointers to PDFs
Definition: dEdxPDFs.h:109
void setPDF(const TH2F &pdf, const unsigned int hypothesis, const bool truncated)
Set the dE/dx PDF for the given particle hypothesis.
Definition: dEdxPDFs.h:85
void setPDF(const TH2F &pdf, const Const::ChargedStable &chargedStable, bool truncated)
Set the dE/dx PDF for the given particle hypothesis.
Definition: dEdxPDFs.h:74
ClassDef(dEdxPDFs, 1)
do not write out
const TH2F * getPDF(const unsigned int hypothesis, const bool truncated) const
Return the dE/dx PDF for the given particle hypothesis.
Definition: dEdxPDFs.h:56
const TH2F * getPDF(const Const::ChargedStable &chargedStable, bool truncated) const
Return the dE/dx PDF for the given particle hypothesis.
Definition: dEdxPDFs.h:46
std::array< TH2F, Const::ChargedStable::c_SetSize > m_dEdxPDFs
Array of dE/dx PDFs for each particle hypothesis.
Definition: dEdxPDFs.h:103
std::array< TH2F, Const::ChargedStable::c_SetSize > m_dEdxPDFsTruncated
Array of truncated dE/dx PDFs for each particle hypothesis.
Definition: dEdxPDFs.h:106
dEdxPDFs()=default
Default constructor.
std::vector< const TH2F * > m_cachePDFsTruncated
do not write out
Definition: dEdxPDFs.h:112
const std::vector< const TH2F * > & getPDFs(bool truncated) const
Return all PDF's as a vector of histogram pointers.
Definition: dEdxPDFs.cc:18
bool checkPDFs(bool truncated) const
Check PDF histograms if they are defined in the same range and with the same binning.
Definition: dEdxPDFs.cc:29
Abstract base class for different kinds of events.