shiftHistFit.h
Go to the documentation of this file.
1 // shiftHistFit.h
2 //
3 // David Adams
4 // May 2021
5 //
6 // Fit a histogram with a TF1. The fitting is done after shifting the histogram
7 // and function by a specified distance with results presented at the original
8 // position. The goal is to avoid numerical problame that can arise when the
9 // position coordinate, e.g. TPC ticks, reaches large values.
10 //
11 // Call TF1::Fit after suppressing Root logging.
12 // ph - histogram to be fit
13 // pf - fit function
14 // fopt - Root fitting options
15 // spar or ipar - name or index of the position parameter in the fit function
16 // xshift - fit h'(x') = h(x) where x = x' + xshift
17 // Return value is fit status. Include "S" in fopt to get IsValid
18 // from the fit result pointer.
19 
20 #ifndef shiftHistFit_H
21 #define shiftHistFit_H
22 
23 #include <string>
24 
25 class TH1;
26 class TF1;
27 
28 int shiftHistFit(TH1* ph, TF1* pf, std::string fopt, int ipar, double xshift);
29 int shiftHistFit(TH1* ph, TF1* pf, std::string fopt, std::string spar, double xshift);
30 
31 #endif
int shiftHistFit(TH1 *ph, TF1 *pf, std::string fopt, int ipar, double xshift)
std::string string
Definition: nybbler.cc:12