Belle II Software development
LaserCalibratorFit.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 <TH1F.h>
12#include <TF1.h>
13#include <string>
14
15namespace Belle2 {
20 namespace TOP {
21
28 double fcnCB(double* x, double* par);
29
36 double fcnCB2(double* x, double* par);
37
45 public:
50 explicit LaserCalibratorFit(unsigned moduleID);
51
56
61 void setHist(const std::vector<TH1F*>& hist);
62
67 void setFitMethod(const std::string& method) {m_fitMethod = method;}
68
74 void setFitRange(double xmin = -200, double xmax = 200) {m_xmin = xmin; m_xmax = xmax;}
75
80 int fitChannel(unsigned channel);
81
86 void writeFile(const std::string& outfile);
87
91 int getModuleID() const {return m_moduleID;}
92
97 double getFitChisq(unsigned channel);
98
102 std::string getFitMethod() const {return m_fitMethod;}
103
107 std::vector<double> getMaxPos() {return m_maxpos;}
108
112 double getFitT() {return m_fitT;}
113
117 double getFitTErr() {return m_fitTErr;}
118
119
120 private:
121
126 TF1* makeGFit(unsigned channel);
127
132 TF1* makeCBFit(unsigned channel);
133
140 TF1* makeCB2Fit(unsigned channel, bool minOut);
141
142 unsigned m_moduleID = 0;
143 std::vector<double> m_maxpos;
144 std::vector<double> m_maxpos_error;
145 double m_xmin = 0;
146 double m_xmax = 0;
147 double m_fitT = 0;
148 double m_fitTErr = 0.;
149 std::vector<TH1F*> m_hist;
150 std::vector<TF1*> m_func;
151 std::string m_fitMethod;
152 };
153 }// TOP namespace
155}//Belle2 namespace
A class do laser calibration fit provide different fitting method (under development)
unsigned m_moduleID
one moduleID/slot
TF1 * makeCB2Fit(unsigned channel, bool minOut)
Fit process using double Crystal Ball fuction.
void setHist(const std::vector< TH1F * > &hist)
set time hist of all channels in one moduleID
double getFitT()
get mean positon after fit
std::vector< TH1F * > m_hist
time hist of 512 channels
TF1 * makeCBFit(unsigned channel)
Fit process using single Crystal Ball fuction.
std::vector< TF1 * > m_func
fitting function
int getModuleID() const
get the module ID in the fit
double m_fitTErr
error on the mean position estimated by the fit
void setFitMethod(const std::string &method)
set time fit function
void setFitRange(double xmin=-200, double xmax=200)
set x range in the fit
double m_xmax
fitting upper-edge
std::vector< double > getMaxPos()
get the center positon of hist max bin
std::vector< double > m_maxpos_error
error on the center positon of hist max bin
int fitChannel(unsigned channel)
fit for a specific channel
double getFitTErr()
returns the error mean positon after fit
void writeFile(const std::string &outfile)
write fit result to a root file
double m_fitT
mean position after fit
std::string m_fitMethod
fitting method
std::string getFitMethod() const
get the fit method used in recent module
TF1 * makeGFit(unsigned channel)
Fit process using single gaussian function.
std::vector< double > m_maxpos
center positon of hist max bin
double getFitChisq(unsigned channel)
get chi^2 in the fit
Abstract base class for different kinds of events.