147 double cof[7] = { 0., 0., 0., 0., 0., 0., 0. };
149 double chisq_ch = 0.;
151 double amp_norm = 0.;
158 float mindig, maxdig;
161 if (
are3FF(mindig, maxdig)) {
164 if (mindig > 2046.99)
212 CLHEP::HepMatrix
A(n, n, 0);
214 double signalModel[7]={};
219 float ofcPhase(-t_ch);
232 for (k = 0; k <
m_digits.size(); ++k) {
237 amp_mf += g[k] * (
m_digits[k] - ped_ch);
238 amp_norm += g[k] * g[k];
242 if (it == 0) amp_mf = amp_mf / amp_norm;
247 for (row = 0; row < n; row++) {
249 for (col = 0; col < n; col++) {
250 if (((col + t) > 6) || ((col + t) < 0)) {
253 A[row][col] = g[col + t];
259 for (col = 0; col < n; col++) {
265 CLHEP::HepMatrix B(n, n, 0);
270 double xDecon[7] = { 0, 0, 0, 0, 0, 0, 0 };
271 for (j = 0; j < n; ++j) {
272 for (i = 0; i < n; ++i) {
273 xDecon[j] += (
m_digits[i] - ped_ch) * B[i][j];
278 double thr[7] = { 0, 0, 0, 0, 0, 0, 0 };
279 for (j = 0; j < n; ++j) {
280 for (i = 0; i < n; ++i) {
281 thr[j] += (rms_aux * rms_aux) * (B[i][j] * B[i][j]);
283 thr[j] = sqrt(thr[j]);
287 int pileupDet[7] = { 0, 0, 0, 1, 0, 0, 0 };
289 for (i = 0; i < n; ++i) {
290 if (i == 3)
continue;
291 if ((ros == 1) || (ros == 2)) {
292 if (xDecon[i] > 4 * thr[i]) {
296 }
else if ((ros == 3) || (ros == 4)) {
297 if (xDecon[i] > 3 * thr[i]) {
314 CLHEP::HepMatrix
H(constraint, n, 0);
318 for (row = 0; row < n; row++) {
320 if (pileupDet[row] == 0)
continue;
321 for (col = 0; col < n; col++) {
322 if (((col + t) > 6) || ((col + t) < 0)) {
323 H[rowAux][col] = 0.0;
325 H[rowAux][col] = g[col + t];
335 for (col = 0; col < n; col++) {
336 H[rowAux][col] = dg[col];
341 CLHEP::HepMatrix tH(n, constraint, 0);
342 CLHEP::HepMatrix resultH(constraint, n, 0);
343 CLHEP::HepMatrix multH(constraint, constraint, 0);
349 for (j = 0; j < n; j++) {
350 signalModel[j] = 0.0;
357 for (j = 0; j < n; j++) {
358 signalModel[j] += cof[3] *
A[3][j];
361 for (i = 0; i < n; ++i) {
362 if (pileupDet[i] == 0)
continue;
363 if (i == 3) iBC3 =
r;
364 for (j = 0; j < n; j++) {
365 cof[i] += (
m_digits[j] - ped_ch) * resultH[
r][j];
367 for (j = 0; j < n; j++) {
368 signalModel[j] += cof[i] *
A[i][j];
377 for (j = 0; j < n; j++) {
379 t_aux += (
m_digits[j] - ped_ch) * (-resultH[rowAux][j]);
384 for (j = 0; j < n; j++) {
391 goodEne = (fabs(cof[3]) > 1.0e-04);
397 for (i = 0; i < n; ++i) {
408 double correction = 0.0;
414 for (j = 0; j < n; ++j) {
415 correction +=
weights.g[j] * resultH[iBC3][j];
417 cof[3] += (1 - correction) * cof[3];
429 for (i = 0; i < n; ++i) {
435 for (k = 0; k <
m_digits.size(); ++k) {
436 double dqf = (signalModel[k] - (
m_digits[k] - ped_ch));
439 chisq_ch = sqrt(MFchi2);
441 if (fabs(chisq_ch) > 1.0e-04 || goodEne) {
442 if (
msgLvl(MSG::VERBOSE)) {
443 msg(MSG::VERBOSE) <<
"MFtime=" << t_ch <<
endmsg;
444 msg(MSG::VERBOSE) <<
"MFped=" << ped_ch <<
endmsg;
445 msg(MSG::VERBOSE) <<
"MFchi2=" << chisq_ch <<
endmsg;
448 if (
msgLvl(MSG::VERBOSE)) {
449 msg(MSG::VERBOSE) <<
"MFtime=" << t_ch <<
endmsg;
450 msg(MSG::VERBOSE) <<
"MFped=" << ped_ch <<
endmsg;
451 msg(MSG::VERBOSE) <<
"MFchi2=" << chisq_ch <<
" ... assuming 0.0" <<
endmsg;
461 float times[7] = { (float)t_ch, -75, -50, -25, 25, 50, 75};
463 std::begin(cof), std::end(cof),
464 std::begin(times), std::end(times),
465 &chisq_ch, &chisq_ch+1,
474 ATH_MSG_VERBOSE(
"Creating RawChannel" <<
" a=" << amp_ch <<
" t=" << t_ch <<
" q=" << chisq_ch);