17 Double_t
CBcalc(Double_t *xx, Double_t *par)
26 double alpha = par[0];
28 double x_mean = par[2];
29 double sigma = par[3];
33 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
34 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
37 if( (x-x_mean)/sigma > -alpha)
39 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
43 f = N * A * pow(B - (x-x_mean)/sigma, -n);
58 double alpha = par[0];
60 double x_mean = par[2];
61 double sigma = par[3];
65 double slope = par[6];
68 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
69 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
72 if( (x-x_mean)/sigma > -alpha)
74 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
78 f = N * A * pow(B - (x-x_mean)/sigma, -n);
81 f += Nexp * exp(slope * x);
94 double alpha = par[0];
96 double x_mean = par[2];
97 double sigma = par[3];
100 double Nexp = par[5];
101 double slope = par[6];
116 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
117 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
120 if( (x-x_mean)/sigma > -alpha)
122 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
126 f = N * A * pow(B - (x-x_mean)/sigma, -n);
129 f += Nexp * exp(slope * x);
134 double bg12 =
recomassBG->GetBinContent(ibin);
146 double alpha1s = par[0];
148 double sigma1s = par[2];
155 double Nexp = par[9];
156 double slope = par[10];
160 TF1 *
f1 =
new TF1(
"f1",
CBcalc,7,11,5);
161 f1->SetParameter(0,alpha1s);
162 f1->SetParameter(1,n1s);
163 f1->SetParameter(2,m1s);
164 f1->SetParameter(3,sigma1s);
165 f1->SetParameter(4,N1s);
167 TF1 *
f2 =
new TF1(
"f2",
CBcalc,7,11,5);
168 f2->SetParameter(0,alpha1s);
169 f2->SetParameter(1,n1s);
170 f2->SetParameter(2,m2s);
171 f2->SetParameter(3,sigma1s);
172 f2->SetParameter(4,N2s);
174 TF1 *
f3 =
new TF1(
"f3",
CBcalc,7,11,5);
175 f3->SetParameter(0,alpha1s);
176 f3->SetParameter(1,n1s);
177 f3->SetParameter(2,m3s);
178 f3->SetParameter(3,sigma1s);
179 f3->SetParameter(4,N3s);
181 TF1 *fexp =
new TF1(
"fexp",
"[0]*exp([1]*x)",7,11);
182 fexp->SetParameter(0,Nexp);
183 fexp->SetParameter(1,slope);
186 double mass = f1->Eval(x) + f2->Eval(x) + f3->Eval(x) + fexp->Eval(x);
193 gROOT->SetStyle(
"Plain");
194 gStyle->SetOptStat(0);
195 gStyle->SetOptFit(0);
196 gStyle->SetOptTitle(0);
200 double maxmass = 3.5;
203 file1S =
new TFile(
"Final_Hists_mee_meeBG_Type_VetoB0.root");
207 cout <<
" Failed to open input root file" << endl;
213 cout <<
"Failed to get Hunlk" << endl;
217 cout <<
"Failed to get HmxNorm" << endl;
219 TCanvas *cups =
new TCanvas(
"cups",
"cups",5,5,1000,800);
228 f1S =
new TF1(
"f1SLL",
CBcalc_LL,1.3,maxmass,7);
233 f1S =
new TF1(
"f1S",
CBcalc_exp,1.3,maxmass,7);
239 f1S->SetParameter(0, -0.5);
240 f1S->SetParameter(1, 2.0);
241 f1S->SetParameter(2, 3.07);
242 f1S->SetParameter(3, 0.11);
243 f1S->SetParameter(4, 850);
244 f1S->FixParameter(5, 0.0);
245 f1S->FixParameter(6, -1.00);
246 f1S->SetParNames(
"alpha1S",
"n1S",
"m1S",
"sigma1S",
"N1S",
"Nexp",
"slope");
248 f1S->SetLineColor(kBlue);
249 f1S->SetLineWidth(3);
250 f1S->SetLineStyle(kDashed);
252 TCanvas *csig =
new TCanvas(
"csig",
"csig",5,5,1000,800);
267 fitResult =
recomassFG->GetFunction(
"CBcalc_exp");
271 cout <<
" chisquare " << fitResult->GetChisquare() <<
" NDF " << fitResult->GetNDF() << endl;
275 cout <<
"Failed to get fitResult" << endl;
283 TF1 *fcbonly =
new TF1(
"fcbonly",
CBcalc,1.3,4.0,5);
284 fcbonly->SetParameter(0,f1S->GetParameter(0));
285 fcbonly->SetParameter(1,f1S->GetParameter(1));
286 fcbonly->SetParameter(2,f1S->GetParameter(2));
287 fcbonly->SetParameter(3,f1S->GetParameter(3));
288 fcbonly->SetParameter(4,f1S->GetParameter(4));
289 fcbonly->SetLineColor(kMagenta);
290 fcbonly->Draw(
"same");
293 TF1 *fexp =
new TF1(
"fexp",
"[0]*exp([1]*x)",1.3,4.0);
294 fexp->SetParameter(0,f1S->GetParameter(5));
295 fexp->SetParameter(1,f1S->GetParameter(6));
297 fexp->SetLineColor(kGreen);
298 fexp->SetLineWidth(3);
299 fexp->SetLineStyle(kDashed);
310 double frac_yerror = f1S->GetParError(4) / f1S->GetParameter(4);
326 fcbonly->Draw(
"same");