14 auto c =
new TCanvas(
"DoubleCrystalBall",
"DoubleCrystalBall", 600, 800);
20 c->DrawFrame(x1, y1, x2, y2,
";#Delta;");
32 double p[] = { N, mu, sigma, kL, nL, kR, nR };
37 cout <<
"Integral of CB = " <<
f->Integral(x1, x2) << endl;
39 TF1 * g =
new TF1(
"gaus",
"gaus(0)", x1, x2);
40 double q[] = {N/(sigma*sqrt(2*M_PI)), mu, sigma};
42 g->SetLineColor(kBlue);
46 cout <<
"Integral of Gaussian = " << g->Integral(x1, x2) << endl;
48 TLegend * legend =
new TLegend(0.6, 0.7, 0.89, 0.85);
49 legend->SetBorderSize(0);
50 legend->AddEntry(
f,
"Double Crystal-Ball",
"l");
51 legend->AddEntry(g,
"Gaussian with same core parameters",
"l");
53 auto line = [&](TF1 *
f, Style_t s,
double x, TString title =
"") {
54 TLine * line =
new TLine;
55 line->SetLineStyle(s);
56 line->DrawLine(x, y1, x,
f->Eval(x));
57 if (title !=
"") legend->AddEntry(line, title,
"l");
59 line(
f, 1, mu, Form(
"mean (#mu = %.2f)", mu));
60 line(
f, 2, mu+sigma, Form(
"mean #pm width (#sigma = %.2f)", sigma));
62 line(
f, 3, kL, Form(
"k_{L} = %.2f, n_{L} = %.0f", kL, nL));
63 line(
f, 3, kR, Form(
"k_{R} = %.2f, n_{R} = %.0f", kR, nR));
67 c->Print(
"DoubleCrystalBall.pdf(");
71 auto c2 =
new TCanvas(
"IntDoubleCrystalBall",
"IntDoubleCrystalBall", 600, 800);
75 c2->DrawFrame(x1, y1, x2, y2,
";#Delta;");
83 auto myErf = [](
double * x,
double *
p) {
84 double N =
p[0], mu =
p[1], sigma =
p[2];
85 double z = (*x-mu)/sigma;
86 return N*(1+erf(z/sqrt(2)))/2;
89 TF1 * g2 =
new TF1(
"myErf", myErf, x1, x2, 3);
91 g2->SetLineColor(kBlue);
96 legend =
new TLegend(0.2, 0.7, 0.49, 0.85);
97 legend->SetBorderSize(0);
98 legend->AddEntry(
f,
"Integrated DCB",
"l");
99 legend->AddEntry(g,
"Error function",
"l");
101 line(f2, 1, mu, Form(
"mean (#mu = %.2f)", mu));
102 line(f2, 2, mu+sigma, Form(
"mean #pm width (#sigma = %.2f)", sigma));
103 line(f2, 2, mu-sigma);
104 line(f2, 3, kL, Form(
"k_{L} = %.2f, n_{L} = %.0f", kL, nL));
105 line(f2, 3, kR, Form(
"k_{R} = %.2f, n_{R} = %.0f", kR, nR));
109 c2->Print(
"DoubleCrystalBall.pdf");
113 auto c3 =
new TCanvas(
"DerivLogDoubleCrystalBall",
"DerivLogDoubleCrystalBall", 600, 800);
117 c3->DrawFrame(x1, y1, x2, y2,
";#Delta;");
121 f3->SetParameters(
p);
124 TF1 * g3 =
new TF1(
"derivLogGauss",
"-(x-[0])/([1]*[1])", x1, x2);
125 g3->SetParameters(&
p[1]);
126 g3->SetLineColor(kBlue);
131 legend =
new TLegend(0.6, 0.7, 0.89, 0.85);
132 legend->SetBorderSize(0);
133 legend->AddEntry(
f,
"Derivative of Log of DCB",
"l");
134 legend->AddEntry(g,
"Same for pure Gaussian",
"l");
136 line(f3, 1, mu, Form(
"mean (#mu = %.2f)", mu));
137 line(f3, 2, mu+sigma, Form(
"mean #pm width (#sigma = %.2f)", sigma));
138 line(f3, 2, mu-sigma);
139 line(f3, 3, kL, Form(
"k_{L} = %.2f, n_{L} = %.0f", kL, nL));
140 line(f3, 3, kR, Form(
"k_{R} = %.2f, n_{R} = %.0f", kR, nR));
145 c3->Print(
"DoubleCrystalBall.pdf)");