Belle II Software  release-08-01-10
TOPPulseHeightAlgorithm.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 #include <calibration/CalibrationAlgorithm.h>
11 #include <TH2F.h>
12 #include <TH1D.h>
13 #include <TFile.h>
14 #include <TTree.h>
15 #include <top/dbobjects/TOPCalChannelPulseHeight.h>
16 #include <top/dbobjects/TOPCalChannelThresholdEff.h>
17 
18 namespace Belle2 {
23  namespace TOP {
24 
29  public:
30 
33 
36 
40  void setMinEntries(int minEntries) {m_minEntries = minEntries;}
41 
46  void setXmin(double xmin) {m_xmin = xmin;}
47 
52  void setMinFracCalibrated(double minFract) {m_minCalibrated = minFract;}
53 
54  private:
55 
59  virtual EResult calibrate() final;
60 
66  int fitChannels(std::shared_ptr<TH2F> h);
67 
75  int fitPulseHeight(TH1D* h);
76 
83  double getEfficiency(TH1D* h, TF1* func);
84 
85  // algorithm parameters
86  int m_minEntries = 100;
87  double m_xmin = 100.0;
88  double m_minCalibrated = 0.90;
90  // ntuple variables
91  int m_slot = 0;
92  unsigned m_channel = 0;
93  int m_numPhot = 0;
94  float m_x0 = 0;
95  float m_p1 = 0;
96  float m_p2 = 0;
97  float m_x0err = 0;
98  float m_p1err = 0;
99  float m_p2err = 0;
100  float m_effi = 0;
101  float m_meanHist = 0;
102  float m_meanFunc = 0;
103  float m_chi2 = 0;
104  int m_ndf = 0;
105  int m_fitStatus = -1;
106  bool m_good = false;
108  // output file and tree
109  TFile* m_file = 0;
110  TTree* m_tree = 0;
112  // output DB objects
116  };
117 
118  } // end namespace TOP
120 } // end namespace Belle2
Base class for calibration algorithms.
EResult
The result of calibration.
Pulse height parameterizations for all 512 channels of 16 modules.
Class to store the threshold efficiency (i.e.
Algorithm for pulse-height and threshold efficiency calibration.
int fitChannels(std::shared_ptr< TH2F > h)
Fit pulse-height distributions of a single module.
int m_minEntries
minimal number of histogram entries to perform fit
double m_xmin
fit range lower limit [ADC counts]
double getEfficiency(TH1D *h, TF1 *func)
Calculate and return threshold efficiency.
void setMinEntries(int minEntries)
Sets minimal number of histogram entries to perform a fit.
int fitPulseHeight(TH1D *h)
Fit pulse-height distribution of a single channel with P(x) = (x/x0)^p1 * exp(-(x/x0)^p2) and p1 = 1.
virtual EResult calibrate() final
algorithm implementation
TOPCalChannelThresholdEff * m_thresholdEffi
threshold efficiencies
float m_p1
fitted distribution parameter p1
float m_meanFunc
fitted distribution mean value
float m_p2
fitted distribution parameter p2
void setXmin(double xmin)
Sets the lower bound of the fit range.
float m_x0err
error on x0 [ADC counts]
float m_x0
fitted distribution parameter x0 [ADC counts]
int m_numPhot
number of photons (histogram entries)
TOPCalChannelPulseHeight * m_pulseHeight
parametrized PH distributions
void setMinFracCalibrated(double minFract)
Sets minimal fraction of calibrated channels to declare this calibration as c_OK.
Abstract base class for different kinds of events.