8#include <ecl/digitization/ECLDspFitterPure.h>
17using namespace Belle2::ECL;
20double Belle2::ECL::func(
int i,
int ifine,
32double Belle2::ECL::func1(
int i,
int ifine,
48 for (
int i = 0; i < 16; i++) {
52 else params.f[i][k] = func(i, k, signal);
59 for (
int h = 0; h < 16; h++) {
61 for (
int j = 0; j < 16; j++) {
62 params.c001[h] -= params.invC[h][j];
63 params.c002 += params.invC[h][j];
74 for (
int i = 0; i < 16; i++) {
75 for (
int j = 0; j < 16; j++) {
76 params.c110[k] += kdt * func1(i, k, signal) * params.invC[i][j] * func(j, k, signal);
77 params.c200[k] += func(i, k, signal) * params.invC[i][j] * func(j, k, signal);
78 params.c020[k] += kdt * func1(i, k, signal) * params.invC[i][j] * func1(j, k, signal) * kdt;
79 params.c101[k] += func(i, k, signal) * params.invC[i][j];
80 params.c011[k] += kdt * func1(i, k, signal) * params.invC[i][j];
90 params.c110[k + off] = 0;
91 params.c200[k + off] = 0;
92 params.c020[k + off] = 0;
93 params.c101[k + off] = 0;
94 params.c011[k + off] = 0;
95 for (
int i = 0; i < 16; i++) {
96 for (
int j = 0; j < 16; j++) {
97 params.c110[k + off] += kdt * func1(i, -k, signal) * params.invC[i][j] * func(j, -k, signal);
98 params.c200[k + off] += func(i, -k, signal) * params.invC[i][j] * func(j, -k, signal);
99 params.c020[k + off] += kdt * func1(i, -k, signal) * params.invC[i][j] * func1(j, -k, signal) * kdt;
100 params.c101[k + off] += func(i, -k, signal) * params.invC[i][j];
101 params.c011[k + off] += kdt * func1(i, -k, signal) * params.invC[i][j];
104 params.c110[k + off] *= 2;
105 params.c101[k + off] *= 2;
106 params.c011[k + off] *= 2;
110 for (
int h = 0; h < 16; h++) {
113 params.c100[h][k] = 0;
114 params.c010[h][k] = 0;
115 for (
int i = 0; i < 16; i++) {
116 params.c100[h][k] -= func(i, k, signal) * params.invC[i][h];
117 params.c010[h][k] -= kdt * func1(i, k, signal) * params.invC[i][h];
119 params.c100[h][k] *= 2;
120 params.c010[h][k] *= 2;
123 params.c100[h][k + off] = 0;
124 params.c010[h][k + off] = 0;
125 for (
int i = 0; i < 16; i++) {
126 params.c100[h][k + off] -= func(i, -k, signal) * params.invC[i][h];
127 params.c010[h][k + off] -= kdt * func1(i, -k, signal) * params.invC[i][h];
129 params.c100[h][k + off] *= 2;
130 params.c010[h][k + off] *= 2;
137 double& time,
double& chi2,
int& iter)
139 int baseline = accumulate(FitA, FitA + 16, 0) / 16;
142 amp = *imax - baseline;
154 double k100 { 0 }, k010{ 0 }, k001{ 0 };
156 if (dt < 0) dt = offset - 1 - dt;
157 for (
int i = 0; i < 16; i++) {
158 k100 += f.c100[i][dt] * y[i];
159 k010 += f.c010[i][dt] * y[i];
160 k001 += f.c001[i] * y[i];
163 double a[] = { 2 * f.c200[dt], f.c110[dt], f.c101[dt],
164 f.c110[dt], 2 * f.c020[dt], f.c011[dt],
165 f.c101[dt], f.c011[dt], 2 * f.c002
169 M1.SetMatrixArray(a);
183 TDecompLU solver(M1);
185 C = solver.Solve(C, ok);
214 chi2 = f.c200[dt] * A * A + f.c020[dt] * B * B + f.c002 * P * P +
215 f.c110[dt] * A * B + f.c101[dt] * A * P + f.c011[dt] * B * P +
216 k100 * A + k010 * B + k001 * P ;
217 for (
int i = 0; i < 16; i++)
218 for (
int j = 0; j < 16; j++)
219 chi2 += y[i] * f.invC[i][j] * y[j];
222 double deltaT = C[1] / C[0] ;
223 int intTime = ttrig + round(deltaT) ;
225 time = -(ttrig + deltaT);
228 if (iter < 3 && intime) {
230 DSPFitterPure(f, FitA, intTime, amp, time, chi2, iter);
233 if (intime && abs(deltaT) > 0.5 && iter++ < 10)
234 DSPFitterPure(f, FitA, intTime, amp, time, chi2, iter);
static double getTickPure()
Getter for m_tickPure.
static constexpr int m_ndtPure
number of points per ADC tick where signal fit procedure parameters are evaluated
static constexpr int m_nsmp
number of ADC measurements for signal fitting
Abstract base class for different kinds of events.
A struct for the fit parameters for a single channel of the pure CsI calorimeter (in the simulation,...
a struct for a signal sample for the pure CsI calorimeter