Belle II Software development
dEdxPDFs.cc
1
2/**************************************************************************
3 * basf2 (Belle II Analysis Software Framework) *
4 * Author: The Belle II Collaboration *
5 * *
6 * See git log for contributors and copyright holders. *
7 * This file is licensed under LGPL-3.0, see LICENSE.md. *
8 **************************************************************************/
9
10#include <framework/dbobjects/dEdxPDFs.h>
11
12namespace Belle2 {
18 const std::vector<const TH2F*>& dEdxPDFs::getPDFs(bool truncated) const
19 {
20 auto& cachePDFs = truncated ? m_cachePDFsTruncated : m_cachePDFs;
21 if (cachePDFs.empty()) {
22 const auto& PDFs = truncated ? m_dEdxPDFsTruncated : m_dEdxPDFs;
23 for (const auto& pdf : PDFs) cachePDFs.push_back(&pdf);
24 }
25 return cachePDFs;
26 }
27
28
29 bool dEdxPDFs::checkPDFs(bool truncated) const
30 {
31 const auto& PDFs = truncated ? m_dEdxPDFsTruncated : m_dEdxPDFs;
32
33 int nx = PDFs[0].GetNbinsX();
34 int ny = PDFs[0].GetNbinsY();
35 double xmin = PDFs[0].GetXaxis()->GetXmin();
36 double xmax = PDFs[0].GetXaxis()->GetXmax();
37 double ymin = PDFs[0].GetYaxis()->GetXmin();
38 double ymax = PDFs[0].GetYaxis()->GetXmax();
39
40 for (const auto& h : PDFs) {
41 if (h.GetNbinsX() != nx) return false;
42 if (h.GetNbinsY() != ny) return false;
43 if (h.GetXaxis()->GetXmin() != xmin) return false;
44 if (h.GetXaxis()->GetXmax() != xmax) return false;
45 if (h.GetYaxis()->GetXmin() != ymin) return false;
46 if (h.GetYaxis()->GetXmax() != ymax) return false;
47 }
48
49 return true;
50 }
51
53} //Belle2 namespace
std::vector< const TH2F * > m_cachePDFs
cache for a vector of pointers to PDFs
Definition: dEdxPDFs.h:109
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
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.