40 #include <TFitResult.h>
45 #include <TPaveText.h>
55 : TNamed(
"function",
"function") {
63 : TNamed(name, title) {
82 const Double_t* par) {
92 "E-PairAnalysisFunction::PeakFun: No histogram for peak fit defined!\n");
96 Int_t idx = hPeak->FindBin(xx);
97 if ((idx <= 1) || (idx >= hPeak->GetNbinsX())) {
return 0.0; }
99 return (par[0] * hPeak->GetBinContent(idx));
104 const Double_t* par) {
108 Double_t alpha = par[1];
109 Double_t meanx = par[2];
110 Double_t sigma = par[3];
111 Double_t nn = par[4];
114 TMath::Power((n / TMath::Abs(alpha)), n) * TMath::Exp(-.5 * alpha * alpha);
115 Double_t b = n / TMath::Abs(alpha) - TMath::Abs(alpha);
117 Double_t arg = (
x[0] - meanx) / sigma;
120 if (arg > -1. * alpha) {
121 fitval = nn * TMath::Exp(-.5 * arg * arg);
123 fitval = nn * a * TMath::Power((b - arg), (-1 * n));
131 const Double_t* par) {
135 Double_t mean = par[1];
136 Double_t sigma = par[2];
139 return (n * TMath::Exp(-0.5 * TMath::Power((xx - mean) / sigma, 2)));
154 if (!sig || !back || !combined) {
155 Error(
"SetFunctions",
156 "Both, signal and background function need to be set!");
179 fFuncSignal =
new TF1(
"DieleSignal",
"gaus", 2.5, 4);
181 fFuncSigBack =
new TF1(
"DieleCombined",
"gaus+pol1(3)", 2.5, 4);
187 }
else if (type == 1) {
188 fFuncSignal =
new TF1(
"DieleSignal",
"gaus", 2.5, 4);
190 new TF1(
"DieleBackground",
"[0]*exp(-(x-[1])/[2])", 2.5, 4);
192 new TF1(
"DieleCombined",
"gaus+[3]*exp(-(x-[4])/[5])", 2.5, 4);
198 }
else if (type == 2) {
202 "(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/"
203 "[3])*(1-exp(-0.5*((x-[1])/"
204 "[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",
208 new TF1(
"DieleBackground",
"[0]*exp(-(x-[1])/[2])+[3]", 2.5, 4);
211 "(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/"
212 "[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/"
213 "[2])^2))+[4]*exp(-(x-[5])/[6])+[7]",
216 fFuncSigBack->SetParameters(1., 3.1, .05, .1, 1, 2.5, 1, 0);
232 if (!peak || !bgnd) {
234 "Both, signal and background function need to be set!");
254 const Double_t* par) {