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#include <framework/gearbox/Const.h>
12
13#include <TFile.h>
14#include <TObject.h>
15#include <TH2F.h>
16
17namespace Belle2 {
27 class DedxPDFs: public TObject {
28
29 public:
30
35
39 explicit DedxPDFs(TFile* pdffile)
40 {
41 for (unsigned int iPart = 0; iPart < Const::ChargedStable::c_SetSize; iPart++) {
42 const int pdgCode = Const::chargedStableSet.at(iPart).getPDGCode();
43
44 TH2F pxdhist;
45 pdffile->Get(TString::Format("hist_d0_%d", pdgCode))->Copy(pxdhist);
46 m_PXDpdfs.push_back(pxdhist);
47
48 TH2F pxdhist_trunc;
49 pdffile->Get(TString::Format("hist_d0_%d_trunc", pdgCode))->Copy(pxdhist_trunc);
50 m_PXDpdfs_trunc.push_back(pxdhist_trunc);
51
52 TH2F svdhist;
53 pdffile->Get(TString::Format("hist_d1_%d", pdgCode))->Copy(svdhist);
54 m_SVDpdfs.push_back(svdhist);
55
56 TH2F svdhist_trunc;
57 pdffile->Get(TString::Format("hist_d1_%d_trunc", pdgCode))->Copy(svdhist_trunc);
58 m_SVDpdfs_trunc.push_back(svdhist_trunc);
59
60 TH2F cdchist;
61 pdffile->Get(TString::Format("hist_d2_%d", pdgCode))->Copy(cdchist);
62 m_CDCpdfs.push_back(cdchist);
63
64 TH2F cdchist_trunc;
65 pdffile->Get(TString::Format("hist_d2_%d_trunc", pdgCode))->Copy(cdchist_trunc);
66 m_CDCpdfs_trunc.push_back(cdchist_trunc);
67 }
68 };
69
74
79 const TH2F* getPXDPDF(int part, bool truncated) const
80 {
81 return truncated ? &m_PXDpdfs_trunc[part] : &m_PXDpdfs[part];
82 }
83
88 const TH2F* getSVDPDF(int part, bool truncated) const
89 {
90 return truncated ? &m_SVDpdfs_trunc[part] : &m_SVDpdfs[part];
91 }
92
97 const TH2F* getCDCPDF(int part, bool truncated) const
98 {
99 return truncated ? &m_CDCpdfs_trunc[part] : &m_CDCpdfs[part];
100 }
101
102 private:
103 std::vector<TH2F> m_PXDpdfs;
104 std::vector<TH2F> m_SVDpdfs;
105 std::vector<TH2F> m_CDCpdfs;
107 std::vector<TH2F> m_PXDpdfs_trunc;
108 std::vector<TH2F> m_SVDpdfs_trunc;
109 std::vector<TH2F> m_CDCpdfs_trunc;
112 };
114} // end namespace Belle2
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:615
const ParticleType & at(unsigned int index) const
Return particle at given index, or end() if out of range.
Definition: Const.h:549
int getPDGCode() const
PDG code.
Definition: Const.h:473
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:618
dE/dx wire gain calibration constants
Definition: DedxPDFs.h:27
std::vector< TH2F > m_CDCpdfs_trunc
2D histograms of CDC dE/dx versus momentum
Definition: DedxPDFs.h:109
DedxPDFs(TFile *pdffile)
Constructor.
Definition: DedxPDFs.h:39
DedxPDFs()
Default constructor.
Definition: DedxPDFs.h:34
std::vector< TH2F > m_PXDpdfs
2D histograms of PXD dE/dx versus momentum
Definition: DedxPDFs.h:103
std::vector< TH2F > m_PXDpdfs_trunc
2D histograms of PXD dE/dx versus momentum
Definition: DedxPDFs.h:107
const TH2F * getPXDPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:79
std::vector< TH2F > m_CDCpdfs
2D histograms of CDC dE/dx versus momentum
Definition: DedxPDFs.h:105
ClassDef(DedxPDFs, 2)
ClassDef.
std::vector< TH2F > m_SVDpdfs_trunc
2D histograms of SVD dE/dx versus momentum
Definition: DedxPDFs.h:108
const TH2F * getCDCPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:97
~DedxPDFs()
Destructor.
Definition: DedxPDFs.h:73
std::vector< TH2F > m_SVDpdfs
2D histograms of SVD dE/dx versus momentum
Definition: DedxPDFs.h:104
const TH2F * getSVDPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:88
Abstract base class for different kinds of events.