Belle II Software  release-06-02-00
TOPPmtGainPar.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 <TObject.h>
12 #include <math.h>
13 
14 namespace Belle2 {
23  class TOPPmtGainPar : public TObject {
24  public:
28  enum {c_NumPmtPixels = 16};
29 
34  {}
35 
40  explicit TOPPmtGainPar(const std::string& serialNumber):
41  m_serialNumber(serialNumber)
42  {}
43 
51  void setPmtPixelData(unsigned pmtPixel, double constant, double slope, double ratio)
52  {
53  pmtPixel--;
54  if (pmtPixel >= c_NumPmtPixels) return;
55  m_constant[pmtPixel] = constant;
56  m_slope[pmtPixel] = slope;
57  m_ratio[pmtPixel] = ratio;
58  }
59 
64  void setNominalHV0(float HV) {m_HV_noB = HV;}
65 
70  void setNominalHV(float HV) {m_HV_withB = HV;}
71 
76  const std::string& getSerialNumber() const {return m_serialNumber;}
77 
83  double getConstant(unsigned pmtPixel) const
84  {
85  pmtPixel--;
86  if (pmtPixel >= c_NumPmtPixels) return 0;
87  return m_constant[pmtPixel];
88  }
89 
95  double getSlope(unsigned pmtPixel) const
96  {
97  pmtPixel--;
98  if (pmtPixel >= c_NumPmtPixels) return 0;
99  return m_slope[pmtPixel];
100  }
101 
107  double getRatio(unsigned pmtPixel) const
108  {
109  pmtPixel--;
110  if (pmtPixel >= c_NumPmtPixels) return 0;
111  return m_ratio[pmtPixel];
112  }
113 
118  float getNominalHV0() const {return m_HV_noB;}
119 
124  float getNominalHV() const {return m_HV_withB;}
125 
132  double getGain0(unsigned pmtPixel, double HV) const
133  {
134  pmtPixel--;
135  if (pmtPixel >= c_NumPmtPixels) return 0;
136  return exp(m_constant[pmtPixel] + m_slope[pmtPixel] * HV) * 1.0e6;
137  }
138 
145  double getGain(unsigned pmtPixel, float HV) const
146  {
147  return getGain0(pmtPixel, HV) * getRatio(pmtPixel);
148  }
149 
153  void print() const;
154 
155 
156  private:
157 
158  std::string m_serialNumber;
159  float m_constant[c_NumPmtPixels] = {0};
160  float m_slope[c_NumPmtPixels] = {0};
161  float m_ratio[c_NumPmtPixels] = {0};
162  float m_HV_noB = 0;
163  float m_HV_withB = 0;
167  };
168 
170 } // end namespace Belle2
171 
172 
Parameterized PMT gain (from laser testing at Nagoya)
Definition: TOPPmtGainPar.h:23
double getSlope(unsigned pmtPixel) const
Returns slope of the gain vs HV fitting function.
Definition: TOPPmtGainPar.h:95
TOPPmtGainPar()
Default constructor.
Definition: TOPPmtGainPar.h:33
void setNominalHV0(float HV)
Sets the high voltage at gain of 5x10^5, without B field.
Definition: TOPPmtGainPar.h:64
double getRatio(unsigned pmtPixel) const
Returns ratio of gains between 1.5T and 0T.
float m_ratio[c_NumPmtPixels]
ratio of gains at B = 1.5 T and B = 0
float m_constant[c_NumPmtPixels]
constant
double getConstant(unsigned pmtPixel) const
Returns constant of the gain vs HV fitting function.
Definition: TOPPmtGainPar.h:83
float m_HV_withB
high voltage for the gain of 5x10^5, with B field
TOPPmtGainPar(const std::string &serialNumber)
Useful constructor.
Definition: TOPPmtGainPar.h:40
float m_HV_noB
high voltage for the gain of 5x10^5, no B field
double getGain(unsigned pmtPixel, float HV) const
Returns pmtPixel gain at B = 1.5 T for a given high voltage.
float getNominalHV0() const
Returns nominal HV (corresponding to a gain of 5x10^5 at B = 0)
std::string m_serialNumber
serial number, e.g.
ClassDef(TOPPmtGainPar, 3)
ClassDef.
float getNominalHV() const
Returns nominal HV (corresponding to a gain of 5x10^5 at B = 1.5T)
const std::string & getSerialNumber() const
Returns PMT serial number.
Definition: TOPPmtGainPar.h:76
float m_slope[c_NumPmtPixels]
slope
void setNominalHV(float HV)
Sets the high voltage at gain of 5x10^5, with B field.
Definition: TOPPmtGainPar.h:70
void setPmtPixelData(unsigned pmtPixel, double constant, double slope, double ratio)
Sets the data for a given PMT pmtPixel.
Definition: TOPPmtGainPar.h:51
double getGain0(unsigned pmtPixel, double HV) const
Returns pmtPixel gain at B = 0 for a given high voltage.
void print() const
Print the class content.
Abstract base class for different kinds of events.