#include "TF1.h"
#include <string>
Go to the source code of this file.
double gausFunction |
( |
double * |
x, |
|
|
double * |
pars |
|
) |
| |
Definition at line 18 of file gausTF1.cxx.
20 double height = pars[0];
21 double mean = pars[1];
22 double sigma = pars[2];
23 if ( sigma <= 0.0 )
return 0;
24 double rat = (pos-
mean)/sigma;
25 return height*exp(-0.5*rat*rat);
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
TF1* gausTF1 |
( |
double |
heightIn, |
|
|
double |
meanIn, |
|
|
double |
sigmaIn, |
|
|
std::string |
fname |
|
) |
| |
Definition at line 28 of file gausTF1.cxx.
29 double height = heightIn != 0.0 ? heightIn : 1.0;
30 double sigma = sigmaIn > 0.0 ? sigmaIn : 1.0;
32 string sform =
"[0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2]))";
33 TF1* pf =
new TF1(
fname.c_str(), sform.c_str(), -10, 10);
35 pf->SetParName(0,
"Height");
36 pf->SetParName(1,
"Mean");
37 pf->SetParName(2,
"Sigma");
38 pf->SetParameter(0, height);
39 pf->SetParameter(1, mean);
40 pf->SetParameter(2, sigma);
41 double sigmaMin = 0.0;
42 double sigmaMax = 1.e10;
43 if ( sigmaIn > 0.0 ) {
44 sigmaMin = 0.1*sigmaIn;
45 sigmaMax = 10.0*sigmaIn;
47 pf->SetParLimits(2, sigmaMin, sigmaMax);
48 if ( sigmaIn > 0.0 ) pf->SetParLimits(2, 0.1*sigma, 10*sigma);
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)