Belle II Software  release-05-01-25
DedxPDFs.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jake Bennett *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/gearbox/Const.h>
14 
15 #include <TFile.h>
16 #include <TObject.h>
17 #include <TH2F.h>
18 
19 namespace Belle2 {
29  class DedxPDFs: public TObject {
30 
31  public:
32 
36  DedxPDFs(): m_PXDpdfs() {};
37 
41  explicit DedxPDFs(TFile* pdffile)
42  {
43  for (unsigned int iPart = 0; iPart < Const::ChargedStable::c_SetSize; iPart++) {
44  const int pdgCode = Const::chargedStableSet.at(iPart).getPDGCode();
45 
46  TH2F pxdhist;
47  pdffile->Get(TString::Format("hist_d0_%d", pdgCode))->Copy(pxdhist);
48  m_PXDpdfs.push_back(pxdhist);
49 
50  TH2F pxdhist_trunc;
51  pdffile->Get(TString::Format("hist_d0_%d_trunc", pdgCode))->Copy(pxdhist_trunc);
52  m_PXDpdfs_trunc.push_back(pxdhist_trunc);
53 
54  TH2F svdhist;
55  pdffile->Get(TString::Format("hist_d1_%d", pdgCode))->Copy(svdhist);
56  m_SVDpdfs.push_back(svdhist);
57 
58  TH2F svdhist_trunc;
59  pdffile->Get(TString::Format("hist_d1_%d_trunc", pdgCode))->Copy(svdhist_trunc);
60  m_SVDpdfs_trunc.push_back(svdhist_trunc);
61 
62  TH2F cdchist;
63  pdffile->Get(TString::Format("hist_d2_%d", pdgCode))->Copy(cdchist);
64  m_CDCpdfs.push_back(cdchist);
65 
66  TH2F cdchist_trunc;
67  pdffile->Get(TString::Format("hist_d2_%d_trunc", pdgCode))->Copy(cdchist_trunc);
68  m_CDCpdfs_trunc.push_back(cdchist_trunc);
69  }
70  };
71 
75  ~DedxPDFs() {};
76 
80  const TH2F* getPXDPDF(int part, bool truncated) const
81  {
82  return truncated ? &m_PXDpdfs_trunc[part] : &m_PXDpdfs[part];
83  }
84 
88  const TH2F* getSVDPDF(int part, bool truncated) const
89  {
90  return truncated ? &m_SVDpdfs_trunc[part] : &m_SVDpdfs[part];
91  }
92 
96  const TH2F* getCDCPDF(int part, bool truncated) const
97  {
98  return truncated ? &m_CDCpdfs_trunc[part] : &m_CDCpdfs[part];
99  }
100 
101  private:
102  std::vector<TH2F> m_PXDpdfs;
103  std::vector<TH2F> m_SVDpdfs;
104  std::vector<TH2F> m_CDCpdfs;
106  std::vector<TH2F> m_PXDpdfs_trunc;
107  std::vector<TH2F> m_SVDpdfs_trunc;
108  std::vector<TH2F> m_CDCpdfs_trunc;
111  };
113 } // end namespace Belle2
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::DedxPDFs::m_CDCpdfs
std::vector< TH2F > m_CDCpdfs
2D histograms of CDC dE/dx versus momentum
Definition: DedxPDFs.h:112
Belle2::Const::chargedStableSet
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:494
Belle2::Const::ParticleType::getPDGCode
int getPDGCode() const
PDG code.
Definition: Const.h:349
Belle2::DedxPDFs::m_CDCpdfs_trunc
std::vector< TH2F > m_CDCpdfs_trunc
2D histograms of CDC dE/dx versus momentum
Definition: DedxPDFs.h:116
Belle2::DedxPDFs::getPXDPDF
const TH2F * getPXDPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:88
Belle2::DedxPDFs::~DedxPDFs
~DedxPDFs()
Destructor.
Definition: DedxPDFs.h:83
Belle2::DedxPDFs::getCDCPDF
const TH2F * getCDCPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:104
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DedxPDFs
dE/dx wire gain calibration constants
Definition: DedxPDFs.h:37
Belle2::DedxPDFs::m_PXDpdfs
std::vector< TH2F > m_PXDpdfs
2D histograms of PXD dE/dx versus momentum
Definition: DedxPDFs.h:110
Belle2::DedxPDFs::getSVDPDF
const TH2F * getSVDPDF(int part, bool truncated) const
Return pdf for the PXD dE/dx for the given particle.
Definition: DedxPDFs.h:96
Belle2::Const::ParticleSet::at
const ParticleType & at(unsigned int index) const
Return particle at given index, or end() if out of range.
Definition: Const.h:425
Belle2::DedxPDFs::m_PXDpdfs_trunc
std::vector< TH2F > m_PXDpdfs_trunc
2D histograms of PXD dE/dx versus momentum
Definition: DedxPDFs.h:114
Belle2::DedxPDFs::ClassDef
ClassDef(DedxPDFs, 2)
ClassDef.
Belle2::DedxPDFs::m_SVDpdfs
std::vector< TH2F > m_SVDpdfs
2D histograms of SVD dE/dx versus momentum
Definition: DedxPDFs.h:111
Belle2::DedxPDFs::m_SVDpdfs_trunc
std::vector< TH2F > m_SVDpdfs_trunc
2D histograms of SVD dE/dx versus momentum
Definition: DedxPDFs.h:115
Belle2::DedxPDFs::DedxPDFs
DedxPDFs()
Default constructor.
Definition: DedxPDFs.h:44