Belle II Software  release-05-01-25
TOPPmtGainPar.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric, Alessandro Gaz *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <TObject.h>
14 #include <math.h>
15 
16 namespace Belle2 {
25  class TOPPmtGainPar : public TObject {
26  public:
30  enum {c_NumPmtPixels = 16};
31 
36  {}
37 
42  explicit TOPPmtGainPar(const std::string& serialNumber):
43  m_serialNumber(serialNumber)
44  {}
45 
53  void setPmtPixelData(unsigned pmtPixel, double constant, double slope, double ratio)
54  {
55  pmtPixel--;
56  if (pmtPixel >= c_NumPmtPixels) return;
57  m_constant[pmtPixel] = constant;
58  m_slope[pmtPixel] = slope;
59  m_ratio[pmtPixel] = ratio;
60  }
61 
66  void setNominalHV0(float HV) {m_HV_noB = HV;}
67 
72  void setNominalHV(float HV) {m_HV_withB = HV;}
73 
78  const std::string& getSerialNumber() const {return m_serialNumber;}
79 
85  double getConstant(unsigned pmtPixel) const
86  {
87  pmtPixel--;
88  if (pmtPixel >= c_NumPmtPixels) return 0;
89  return m_constant[pmtPixel];
90  }
91 
97  double getSlope(unsigned pmtPixel) const
98  {
99  pmtPixel--;
100  if (pmtPixel >= c_NumPmtPixels) return 0;
101  return m_slope[pmtPixel];
102  }
103 
109  double getRatio(unsigned pmtPixel) const
110  {
111  pmtPixel--;
112  if (pmtPixel >= c_NumPmtPixels) return 0;
113  return m_ratio[pmtPixel];
114  }
115 
120  float getNominalHV0() const {return m_HV_noB;}
121 
126  float getNominalHV() const {return m_HV_withB;}
127 
134  double getGain0(unsigned pmtPixel, double HV) const
135  {
136  pmtPixel--;
137  if (pmtPixel >= c_NumPmtPixels) return 0;
138  return exp(m_constant[pmtPixel] + m_slope[pmtPixel] * HV) * 1.0e6;
139  }
140 
147  double getGain(unsigned pmtPixel, float HV) const
148  {
149  return getGain0(pmtPixel, HV) * getRatio(pmtPixel);
150  }
151 
155  void print() const;
156 
157 
158  private:
159 
160  std::string m_serialNumber;
161  float m_constant[c_NumPmtPixels] = {0};
162  float m_slope[c_NumPmtPixels] = {0};
163  float m_ratio[c_NumPmtPixels] = {0};
164  float m_HV_noB = 0;
165  float m_HV_withB = 0;
167  ClassDef(TOPPmtGainPar, 3);
169  };
170 
172 } // end namespace Belle2
173 
174 
Belle2::TOPPmtGainPar::getSerialNumber
const std::string & getSerialNumber() const
Returns PMT serial number.
Definition: TOPPmtGainPar.h:86
Belle2::TOPPmtGainPar::setPmtPixelData
void setPmtPixelData(unsigned pmtPixel, double constant, double slope, double ratio)
Sets the data for a given PMT pmtPixel.
Definition: TOPPmtGainPar.h:61
Belle2::TOPPmtGainPar::ClassDef
ClassDef(TOPPmtGainPar, 3)
ClassDef.
Belle2::TOPPmtGainPar::m_constant
float m_constant[c_NumPmtPixels]
constant
Definition: TOPPmtGainPar.h:169
Belle2::TOPPmtGainPar::m_slope
float m_slope[c_NumPmtPixels]
slope
Definition: TOPPmtGainPar.h:170
Belle2::TOPPmtGainPar::getNominalHV
float getNominalHV() const
Returns nominal HV (corresponding to a gain of 5x10^5 at B = 1.5T)
Definition: TOPPmtGainPar.h:134
Belle2::TOPPmtGainPar::getGain0
double getGain0(unsigned pmtPixel, double HV) const
Returns pmtPixel gain at B = 0 for a given high voltage.
Definition: TOPPmtGainPar.h:142
Belle2::TOPPmtGainPar::m_HV_noB
float m_HV_noB
high voltage for the gain of 5x10^5, no B field
Definition: TOPPmtGainPar.h:172
Belle2::TOPPmtGainPar::getGain
double getGain(unsigned pmtPixel, float HV) const
Returns pmtPixel gain at B = 1.5 T for a given high voltage.
Definition: TOPPmtGainPar.h:155
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPPmtGainPar::getNominalHV0
float getNominalHV0() const
Returns nominal HV (corresponding to a gain of 5x10^5 at B = 0)
Definition: TOPPmtGainPar.h:128
Belle2::TOPPmtGainPar::getRatio
double getRatio(unsigned pmtPixel) const
Returns ratio of gains between 1.5T and 0T.
Definition: TOPPmtGainPar.h:117
Belle2::TOPPmtGainPar::getConstant
double getConstant(unsigned pmtPixel) const
Returns constant of the gain vs HV fitting function.
Definition: TOPPmtGainPar.h:93
Belle2::TOPPmtGainPar::m_ratio
float m_ratio[c_NumPmtPixels]
ratio of gains at B = 1.5 T and B = 0
Definition: TOPPmtGainPar.h:171
Belle2::TOPPmtGainPar::setNominalHV
void setNominalHV(float HV)
Sets the high voltage at gain of 5x10^5, with B field.
Definition: TOPPmtGainPar.h:80
Belle2::TOPPmtGainPar::setNominalHV0
void setNominalHV0(float HV)
Sets the high voltage at gain of 5x10^5, without B field.
Definition: TOPPmtGainPar.h:74
Belle2::TOPPmtGainPar::getSlope
double getSlope(unsigned pmtPixel) const
Returns slope of the gain vs HV fitting function.
Definition: TOPPmtGainPar.h:105
Belle2::TOPPmtGainPar::print
void print() const
Print the class content.
Definition: TOPPmtGainPar.cc:23
Belle2::TOPPmtGainPar::m_serialNumber
std::string m_serialNumber
serial number, e.g.
Definition: TOPPmtGainPar.h:168
Belle2::TOPPmtGainPar::TOPPmtGainPar
TOPPmtGainPar()
Default constructor.
Definition: TOPPmtGainPar.h:43
Belle2::TOPPmtGainPar::m_HV_withB
float m_HV_withB
high voltage for the gain of 5x10^5, with B field
Definition: TOPPmtGainPar.h:173