509 CLHEP::HepMatrix correlation(dignum, dignum, 0);
510 CLHEP::HepMatrix
inverse(dignum, dignum, 0);
511 CLHEP::HepMatrix
zero(dignum, dignum, 0);
512 CLHEP::HepMatrix pulseShape(dignum, 1, 0);
513 CLHEP::HepMatrix pulseShapeDerivative(dignum, 1, 0);
514 CLHEP::HepMatrix
a(dignum, 1, 0);
515 CLHEP::HepMatrix
b(dignum, 1, 0);
517 std::fstream *aiLoFile =
new std::fstream(aiLoOptFilterFile.c_str(),
std::fstream::out);
518 std::fstream *biLoFile =
new std::fstream(biLoOptFilterFile.c_str(),
std::fstream::out);
519 std::fstream *aiHiFile =
new std::fstream(aiHiOptFilterFile.c_str(),
std::fstream::out);
520 std::fstream *biHiFile =
new std::fstream(biHiOptFilterFile.c_str(),
std::fstream::out);
523 if (aiLoFile->is_open() && aiLoFile->is_open() && aiLoFile->is_open() && aiLoFile->is_open()) {
553 msg(
MSG::VERBOSE) <<
"shapeFormLG, shapeFormDerivativeLG, shapeFormHG, shapeFormDerivativeHG" <<
endmsg;
554 for (
int i = 0;
i <
int(shapeFormLG.size()); ++
i)
556 << shapeFormLG[
i] <<
" " << std::setw(18) << std::setprecision(10)
557 << shapeFormDerivativeLG[
i] <<
" " << std::setw(18) << std::setprecision(10)
558 << shapeFormHG[
i] <<
" " << std::setw(18) << std::setprecision(10)
559 << shapeFormDerivativeHG[
i] <<
" " <<
endmsg;
570 double Q1, Q2, Q3, Delta;
573 if (deltaCorrelation) {
575 for (
int pha = -12; pha < 13; ++pha) {
579 for (
int i = 0;
i < dignum; ++
i)
580 for (
int j = 0; j < dignum; ++j)
581 correlation[
i][j] =
m_R[0][0][0][0][
i][j];
583 inverse = correlation.inverse(ierr);
585 for (
int i = 0;
i < dignum; ++
i) {
587 pulseShape[
i][0] = shapeFormLG[
i * 25 + 12 + pha];
588 pulseShapeDerivative[
i][0] = shapeFormDerivativeLG[
i * 25 + 12 + pha];
590 pulseShape[
i][0] = shapeFormHG[
i * 25 + 12 + pha];
591 pulseShapeDerivative[
i][0] = shapeFormDerivativeHG[
i * 25 + 12 + pha];
595 Q1 = ((pulseShape.T()) *
inverse * pulseShape).determinant();
596 Q2 = ((pulseShapeDerivative.T()) *
inverse * pulseShapeDerivative).determinant();
597 Q3 = ((pulseShapeDerivative.T()) *
inverse * pulseShape).determinant();
598 Delta = Q1 * Q2 - Q3 * Q3;
600 a = Q2 / Delta *
inverse * pulseShape - Q3 / Delta *
inverse * pulseShapeDerivative;
601 b = Q3 / Delta *
inverse * pulseShape - Q1 / Delta *
inverse * pulseShapeDerivative;
604 *aiLoFile << std::setw(6) << pha;
605 for (
int i = 0;
i < dignum; ++
i)
606 *aiLoFile << std::setw(18) << std::setprecision(10) <<
a(
i + 1, 1);
607 *aiLoFile << std::endl;
609 *biLoFile << std::setw(6) << pha;
610 for (
int i = 0;
i < dignum; ++
i)
611 *biLoFile << std::setw(18) << std::setprecision(10) <<
b(
i + 1, 1);
612 *biLoFile << std::endl;
614 *aiHiFile << std::setw(6) << pha;
615 for (
int i = 0;
i < dignum; ++
i)
616 *aiHiFile << std::setw(18) << std::setprecision(10) <<
a(
i + 1, 1);
617 *aiHiFile << std::endl;
619 *biHiFile << std::setw(6) << pha;
620 for (
int i = 0;
i < dignum; ++
i)
621 *biHiFile << std::setw(18) << std::setprecision(10) <<
b(
i + 1, 1);
622 *biHiFile << std::endl;
634 *aiLoFile <<
"ros " <<
ros
635 <<
" drawer " <<
drawer << std::hex
636 <<
" frag0x " << frag << std::dec
640 *biLoFile <<
"ros " <<
ros
641 <<
" drawer " <<
drawer << std::hex
642 <<
" frag0x " << frag << std::dec
647 *aiHiFile <<
"ros " <<
ros
648 <<
" drawer " <<
drawer << std::hex
649 <<
" frag0x " << frag << std::dec
653 *biHiFile <<
"ros " <<
ros
654 <<
" drawer " <<
drawer << std::hex
655 <<
" frag0x " << frag << std::dec
660 for (
int pha = -12; pha < 13; ++pha) {
664 for (
int i = 0;
i < dignum; ++
i)
665 for (
int j = 0; j < dignum; ++j)
668 inverse = correlation.inverse(ierr);
670 for (
int i = 0;
i < dignum; ++
i) {
672 pulseShape[
i][0] = shapeFormLG[
i * 25 + 12 + pha];
673 pulseShapeDerivative[
i][0] = shapeFormDerivativeLG[
i * 25 + 12 + pha];
675 pulseShape[
i][0] = shapeFormHG[
i * 25 + 12 + pha];
676 pulseShapeDerivative[
i][0] = shapeFormDerivativeHG[
i * 25 + 12 + pha];
695 Q1 = ((pulseShape.T()) *
inverse * pulseShape).determinant();
696 Q2 = ((pulseShapeDerivative.T()) *
inverse * pulseShapeDerivative).determinant();
697 Q3 = ((pulseShapeDerivative.T()) *
inverse * pulseShape).determinant();
698 Delta = Q1 * Q2 - Q3 * Q3;
701 a = Q2 / Delta *
inverse * pulseShape - Q3 / Delta *
inverse * pulseShapeDerivative;
702 b = Q3 / Delta *
inverse * pulseShape - Q1 / Delta *
inverse * pulseShapeDerivative;
708 *aiLoFile << std::setw(6) << pha;
709 for (
int i = 0;
i < dignum; ++
i)
710 *aiLoFile << std::setw(18) << std::setprecision(10) <<
a(
i + 1, 1);
711 *aiLoFile << std::endl;
713 *biLoFile << std::setw(6) << pha;
714 for (
int i = 0;
i < dignum; ++
i)
715 *biLoFile << std::setw(18) << std::setprecision(10) <<
b(
i + 1, 1);
716 *biLoFile << std::endl;
718 *aiHiFile << std::setw(6) << pha;
719 for (
int i = 0;
i < dignum; ++
i)
720 *aiHiFile << std::setw(18) << std::setprecision(10) <<
a(
i + 1, 1);
721 *aiHiFile << std::endl;
723 *biHiFile << std::setw(6) << pha;
724 for (
int i = 0;
i < dignum; ++
i)
725 *biHiFile << std::setw(18) << std::setprecision(10) <<
b(
i + 1, 1);
726 *biHiFile << std::endl;