23#include "CLHEP/Vector/ThreeVector.h"
24#include "CLHEP/Matrix/Vector.h"
25#include "CLHEP/Geometry/Point3D.h"
48 theField,
double fltlen) {
53 if (theVisitor.
helix() != 0 || theVisitor.
circle() != 0) {
57 return calcCurvPtMom(theTraj.
direction(fltlen),
60 }
else if (theVisitor.
neut() != 0) {
63 double sindip = theTraj.
direction(fltlen).z();
64 double arg = 1.0-sindip*sindip;
66 double cosdip = sqrt(
arg);
83 theField,
double fltlen) {
87 if (theVisitor.
helix() != 0 || theVisitor.
circle() != 0) {
92 return calcCurvVecMom(theTraj.
direction(fltlen),
95 }
else if (theVisitor.
neut() != 0) {
98 Hep3Vector theMom = theTraj.
direction(fltlen);
105 return Hep3Vector(999, 999, 999);
113 theField,
double fltlen) {
118 if (theVisitor.
helix() != 0 || theVisitor.
circle() != 0) {
122 return calcCurvErrMom(theTraj, theField, fltlen);
124 }
else if (theVisitor.
neut() != 0) {
127 return calcNeutErrMom(theTraj, theField, fltlen);
141 theField,
double fltlen) {
146 if (theVisitor.
helix() != 0 || theVisitor.
circle() != 0) {
160 return ( plus ? 1 : -1 );
166 }
else if (theVisitor.
neut() != 0) {
186 if (theVisitor.
helix() != 0 || theVisitor.
circle() != 0) {
190 return calcCurvPosmomCov(theTraj, theField, fltlen);
192 }
else if (theVisitor.
neut() != 0) {
195 return calcNeutPosmomCov(theTraj, theField, fltlen);
201 return HepMatrix(3,3,0);
217 if (theVisitor.
helix() != 0) {
220 calcCurvAllCovs(theTraj,theField,fltlen,xxCov,ppCov,xpCov);
222 }
else if (theVisitor.
circle() != 0){
226 calcCurvAllCovsOLD(theTraj,theField,fltlen,xxCov,ppCov,xpCov);
228 }
else if (theVisitor.
neut() != 0) {
231 calcNeutAllCovs(theTraj,theField,fltlen,xxCov,ppCov,xpCov);
257 HepSymMatrix& xxWeight,
258 HepSymMatrix& ppWeight,
259 HepMatrix& xpWeight) {
264 if (theVisitor.
helix() != 0){
268 calcCurvAllWeights(theTraj,theField,fltlen,
269 pos,mom,xxWeight,ppWeight,xpWeight);
271 }
else if (theVisitor.
circle() != 0) {
273 calcCurvAllWeightsOLD(theTraj,theField,fltlen,
274 pos,mom,xxWeight,ppWeight,xpWeight);
276 }
else if (theVisitor.
neut() != 0) {
279 calcNeutAllWeights(theTraj,theField,fltlen,
280 pos,mom,xxWeight,ppWeight,xpWeight);
304TrkMomCalculator::calcCurvPtMom(
const Hep3Vector& direction,
308 Hep3Vector theMomVec = calcCurvVecMom(direction, curvature,
310 return theMomVec.perp();
316TrkMomCalculator::calcCurvVecMom(
const Hep3Vector& direction,
320 double sindip = direction.z();
321 double arg = 1.0-sindip*sindip;
323 double cosdip = sqrt(
arg);
327 Hep3Vector momVec = direction;
328 momVec.setMag(momMag);
336TrkMomCalculator::calcCurvErrMom(
const TrkSimpTraj& theTraj,
346 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
347 if (delDirDif.
length() == 0.) {
352 if (
arg.number() < 0.0) {
arg.setNumber(0.0);}
360 MomDif = DirDif * momMag;
407 MomDif.x.indepPar()->covariance()));
408 return BesVectorErr(Hep3Vector(MomDif.x.number(), MomDif.y.number(),
409 MomDif.z.number()), symErr);
414TrkMomCalculator::calcNeutErrMom(
const TrkSimpTraj& theTraj,
423 theTraj.
getDFInfo(fltlen, posDif, dirDif, delDirDif);
447TrkMomCalculator::calcCurvCharge(
const Hep3Vector& direction,
453 calcCurvVecMom(direction, curvature, theField);
456 return -nearestInt(momVec.mag() * curvature / theField.
bFieldNominal());
458 return nearestInt(momVec.mag() * curvature / theField.
bFieldNominal());
464TrkMomCalculator::nearestInt(
double floatPt) {
468 return (
int)(floatPt+0.5);
470 return (
int)(floatPt-0.5);
481TrkMomCalculator::calcCurvPosmomCov(
const TrkSimpTraj& theTraj,
491 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
492 if (delDirDif.
length() == 0.) {
497 if (
arg.number() < 0.0) {
arg.setNumber(0.0);}
506 MomDif = DirDif * momMag;
511 HepMatrix xpCov(3,3);
512 const HepSymMatrix& nnCov=MomDif.x.indepPar()->covariance();
528TrkMomCalculator::calcNeutPosmomCov(
const TrkSimpTraj& theTraj,
537 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
547 HepMatrix xpCov(3,3);
559 return HepMatrix(3,3,0);
563 HepSymMatrix& outXX,HepSymMatrix& outPP,HepMatrix& outXP){
564 assert(inXX.num_row()==outXX.num_row());
565 assert(inPP.num_row()==outPP.num_row());
566 assert(inXP.num_row()==outXP.num_row());
567 assert(inXP.num_col()==outXP.num_col());
568 assert(inXX.num_row()==inXP.num_row());
569 assert(inPP.num_row()==inXP.num_col());
571 HepSymMatrix aInv = inXX.inverse(status);
572 if(status)
return false;
573 HepSymMatrix beta = inPP-aInv.similarityT(inXP);
574 outPP = beta.inverse(status);
575 if(status)
return false;
576 outXP = -aInv*inXP*outPP;
577 HepMatrix
alpha(aInv-aInv*inXP*outXP.T());
584TrkMomCalculator::calcCurvAllCovs(
const TrkSimpTraj& theTraj,
603 double cosDip = 1/sqrt(1.0+
s*
s);
604 double l = fltlen*cosDip ;
607 double dlds = -fltlen*
s*(cosDip*cosDip*cosDip) ;
608 double phi = phi0 + omega*l;
609 double sinphi0 =
sin(phi0);
610 double cosphi0 =
cos(phi0);
611 double sinphi =
sin(phi);
612 double cosphi =
cos(phi);
614 double r = 1.0/omega;
617 double d_x_d0 = -sinphi0;
618 double d_x_phi0 = r*cosphi - (r+d0)*cosphi0;
619 double d_x_omega = -r*r*sinphi + r*r*sinphi0 + l*r*cosphi;
620 double d_x_tanDip = cosphi*dlds;
621 double d_y_d0 = cosphi0;
622 double d_y_phi0 = r*sinphi - (r+d0)*sinphi0;
623 double d_y_omega = r*r*cosphi - r*r*cosphi0 + l*r*sinphi;
624 double d_y_tanDip = sinphi*dlds;
626 double d_z_tanDip = l + dlds*
s;
627 double d_px_phi0 = -pt*sinphi;
628 double d_px_omega = -pt*cosphi/omega - pt*l*sinphi;
629 double d_px_tanDip = -pt*omega*sinphi*dlds;
630 double d_py_phi0 = pt*cosphi;
631 double d_py_omega = -pt*sinphi/omega + pt*l*cosphi;
632 double d_py_tanDip = pt*omega*cosphi*dlds;
633 double d_pz_omega = -pt*
s/omega;
634 double d_pz_tanDip = pt;
655 d_x_d0* ( d_x_d0*m_d0_d0 + d_x_phi0*m_phi0_d0 + d_x_omega*m_omega_d0 + d_x_tanDip*m_tanDip_d0 ) +
656 d_x_phi0* ( d_x_d0*m_phi0_d0 + d_x_phi0*m_phi0_phi0 + d_x_omega*m_omega_phi0 + d_x_tanDip*m_tanDip_phi0 ) +
657 d_x_omega* ( d_x_d0*m_omega_d0 + d_x_phi0*m_omega_phi0 + d_x_omega*m_omega_omega + d_x_tanDip*m_tanDip_omega ) +
658 d_x_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
660 d_y_d0* ( d_x_d0*m_d0_d0 + d_x_phi0*m_phi0_d0 + d_x_omega*m_omega_d0 + d_x_tanDip*m_tanDip_d0 ) +
661 d_y_phi0* ( d_x_d0*m_phi0_d0 + d_x_phi0*m_phi0_phi0 + d_x_omega*m_omega_phi0 + d_x_tanDip*m_tanDip_phi0 ) +
662 d_y_omega* ( d_x_d0*m_omega_d0 + d_x_phi0*m_omega_phi0 + d_x_omega*m_omega_omega + d_x_tanDip*m_tanDip_omega ) +
663 d_y_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
665 d_y_d0* ( d_y_d0*m_d0_d0 + d_y_phi0*m_phi0_d0 + d_y_omega*m_omega_d0 + d_y_tanDip*m_tanDip_d0 ) +
666 d_y_phi0* ( d_y_d0*m_phi0_d0 + d_y_phi0*m_phi0_phi0 + d_y_omega*m_omega_phi0 + d_y_tanDip*m_tanDip_phi0 ) +
667 d_y_omega* ( d_y_d0*m_omega_d0 + d_y_phi0*m_omega_phi0 + d_y_omega*m_omega_omega + d_y_tanDip*m_tanDip_omega ) +
668 d_y_tanDip* ( d_y_d0*m_tanDip_d0 + d_y_phi0*m_tanDip_phi0 + d_y_omega*m_tanDip_omega + d_y_tanDip*m_tanDip_tanDip ) ;
670 d_z_z0* ( d_x_d0*m_z0_d0 + d_x_phi0*m_z0_phi0 + d_x_omega*m_z0_omega + d_x_tanDip*m_tanDip_z0 ) +
671 d_z_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
673 d_z_z0* ( d_y_d0*m_z0_d0 + d_y_phi0*m_z0_phi0 + d_y_omega*m_z0_omega + d_y_tanDip*m_tanDip_z0 ) +
674 d_z_tanDip* ( d_y_d0*m_tanDip_d0 + d_y_phi0*m_tanDip_phi0 + d_y_omega*m_tanDip_omega + d_y_tanDip*m_tanDip_tanDip ) ;
676 d_z_z0* ( d_z_z0*m_z0_z0 + d_z_tanDip*m_tanDip_z0 ) +
677 d_z_tanDip* ( d_z_z0*m_tanDip_z0 + d_z_tanDip*m_tanDip_tanDip ) ;
680 d_px_phi0* ( d_x_d0*m_phi0_d0 + d_x_phi0*m_phi0_phi0 + d_x_omega*m_omega_phi0 + d_x_tanDip*m_tanDip_phi0 ) +
681 d_px_omega* ( d_x_d0*m_omega_d0 + d_x_phi0*m_omega_phi0 + d_x_omega*m_omega_omega + d_x_tanDip*m_tanDip_omega ) +
682 d_px_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
684 d_px_phi0* ( d_y_d0*m_phi0_d0 + d_y_phi0*m_phi0_phi0 + d_y_omega*m_omega_phi0 + d_y_tanDip*m_tanDip_phi0 ) +
685 d_px_omega* ( d_y_d0*m_omega_d0 + d_y_phi0*m_omega_phi0 + d_y_omega*m_omega_omega + d_y_tanDip*m_tanDip_omega ) +
686 d_px_tanDip* ( d_y_d0*m_tanDip_d0 + d_y_phi0*m_tanDip_phi0 + d_y_omega*m_tanDip_omega + d_y_tanDip*m_tanDip_tanDip ) ;
688 d_px_phi0* ( d_z_z0*m_z0_phi0 + d_z_tanDip*m_tanDip_phi0 ) +
689 d_px_omega* ( d_z_z0*m_z0_omega + d_z_tanDip*m_tanDip_omega ) +
690 d_px_tanDip* ( d_z_z0*m_tanDip_z0 + d_z_tanDip*m_tanDip_tanDip ) ;
692 d_py_phi0* ( d_x_d0*m_phi0_d0 + d_x_phi0*m_phi0_phi0 + d_x_omega*m_omega_phi0 + d_x_tanDip*m_tanDip_phi0 ) +
693 d_py_omega* ( d_x_d0*m_omega_d0 + d_x_phi0*m_omega_phi0 + d_x_omega*m_omega_omega + d_x_tanDip*m_tanDip_omega ) +
694 d_py_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
696 d_py_phi0* ( d_y_d0*m_phi0_d0 + d_y_phi0*m_phi0_phi0 + d_y_omega*m_omega_phi0 + d_y_tanDip*m_tanDip_phi0 ) +
697 d_py_omega* ( d_y_d0*m_omega_d0 + d_y_phi0*m_omega_phi0 + d_y_omega*m_omega_omega + d_y_tanDip*m_tanDip_omega ) +
698 d_py_tanDip* ( d_y_d0*m_tanDip_d0 + d_y_phi0*m_tanDip_phi0 + d_y_omega*m_tanDip_omega + d_y_tanDip*m_tanDip_tanDip ) ;
700 d_py_phi0* ( d_z_z0*m_z0_phi0 + d_z_tanDip*m_tanDip_phi0 ) +
701 d_py_omega* ( d_z_z0*m_z0_omega + d_z_tanDip*m_tanDip_omega ) +
702 d_py_tanDip* ( d_z_z0*m_tanDip_z0 + d_z_tanDip*m_tanDip_tanDip ) ;
704 d_pz_omega* ( d_x_d0*m_omega_d0 + d_x_phi0*m_omega_phi0 + d_x_omega*m_omega_omega + d_x_tanDip*m_tanDip_omega ) +
705 d_pz_tanDip* ( d_x_d0*m_tanDip_d0 + d_x_phi0*m_tanDip_phi0 + d_x_omega*m_tanDip_omega + d_x_tanDip*m_tanDip_tanDip ) ;
707 d_pz_omega* ( d_y_d0*m_omega_d0 + d_y_phi0*m_omega_phi0 + d_y_omega*m_omega_omega + d_y_tanDip*m_tanDip_omega ) +
708 d_pz_tanDip* ( d_y_d0*m_tanDip_d0 + d_y_phi0*m_tanDip_phi0 + d_y_omega*m_tanDip_omega + d_y_tanDip*m_tanDip_tanDip ) ;
710 d_pz_omega* ( d_z_z0*m_z0_omega + d_z_tanDip*m_tanDip_omega ) +
711 d_pz_tanDip* ( d_z_z0*m_tanDip_z0 + d_z_tanDip*m_tanDip_tanDip ) ;
714 d_px_phi0* ( d_px_phi0*m_phi0_phi0 + d_px_omega*m_omega_phi0 + d_px_tanDip*m_tanDip_phi0 ) +
715 d_px_omega* ( d_px_phi0*m_omega_phi0 + d_px_omega*m_omega_omega + d_px_tanDip*m_tanDip_omega ) +
716 d_px_tanDip* ( d_px_phi0*m_tanDip_phi0 + d_px_omega*m_tanDip_omega + d_px_tanDip*m_tanDip_tanDip ) ;
718 d_py_phi0* ( d_px_phi0*m_phi0_phi0 + d_px_omega*m_omega_phi0 + d_px_tanDip*m_tanDip_phi0 ) +
719 d_py_omega* ( d_px_phi0*m_omega_phi0 + d_px_omega*m_omega_omega + d_px_tanDip*m_tanDip_omega ) +
720 d_py_tanDip* ( d_px_phi0*m_tanDip_phi0 + d_px_omega*m_tanDip_omega + d_px_tanDip*m_tanDip_tanDip ) ;
722 d_py_phi0* ( d_py_phi0*m_phi0_phi0 + d_py_omega*m_omega_phi0 + d_py_tanDip*m_tanDip_phi0 ) +
723 d_py_omega* ( d_py_phi0*m_omega_phi0 + d_py_omega*m_omega_omega + d_py_tanDip*m_tanDip_omega ) +
724 d_py_tanDip* ( d_py_phi0*m_tanDip_phi0 + d_py_omega*m_tanDip_omega + d_py_tanDip*m_tanDip_tanDip ) ;
726 d_pz_omega* ( d_px_phi0*m_omega_phi0 + d_px_omega*m_omega_omega + d_px_tanDip*m_tanDip_omega ) +
727 d_pz_tanDip* ( d_px_phi0*m_tanDip_phi0 + d_px_omega*m_tanDip_omega + d_px_tanDip*m_tanDip_tanDip ) ;
729 d_pz_omega* ( d_py_phi0*m_omega_phi0 + d_py_omega*m_omega_omega + d_py_tanDip*m_tanDip_omega ) +
730 d_pz_tanDip* ( d_py_phi0*m_tanDip_phi0 + d_py_omega*m_tanDip_omega + d_py_tanDip*m_tanDip_tanDip ) ;
732 d_pz_omega* ( d_pz_omega*m_omega_omega + d_pz_tanDip*m_tanDip_omega ) +
733 d_pz_tanDip* ( d_pz_omega*m_tanDip_omega + d_pz_tanDip*m_tanDip_tanDip ) ;
770TrkMomCalculator::calcCurvAllCovsOLD(
const TrkSimpTraj& theTraj,
783 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
784 if (delDirDif.
length() != 0) {
787 if (
arg.number() < 0.0) {
arg.setNumber(0.0);}
795 MomDif = DirDif * momMag;
822TrkMomCalculator::calcNeutAllCovs(
const TrkSimpTraj& theTraj,
829 HepVector p0(3),x0(3);
830 calcNeutAllCovs(theTraj,theField,fltlen,x0,p0,xxCov,ppCov,xpCov);
836TrkMomCalculator::calcNeutAllCovs(
const TrkSimpTraj& theTraj,
839 HepVector& x0,HepVector& p0,
849 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
888TrkMomCalculator::calcCurvAllWeights(
const TrkSimpTraj& theTraj,
893 HepSymMatrix& xxWeight,
894 HepSymMatrix& ppWeight,
895 HepMatrix& xpWeight) {
908 double l = fltlen / sqrt(1.0+
s*
s) ;
910 double phi = phi0 + omega*l;
911 double sinphi0 =
sin(phi0);
912 double cosphi0 =
cos(phi0);
913 double sinphi =
sin(phi);
914 double cosphi =
cos(phi);
917 -omega>0 ?
q=1.0:
q=-1.0;
919 double pt = fabs( -qC / omega );
920 double r = 1.0/omega;
923 pos(1) = r*sinphi - (r + d0)*sinphi0;
924 pos(2) = -r*cosphi + (r + d0)*cosphi0;
933 if ( (1+d0*omega)==0.0 ){
934 calcCurvAllWeightsOLD(theTraj,theField,fltlen,
935 pos,mom,xxWeight,ppWeight,xpWeight);
939 double dinv_x_d0 = -sinphi0;
940 double dinv_x_phi0 = -omega * cosphi0 / (1 + d0 * omega);
941 double dinv_x_z0 = -
s * cosphi0 / (1 + d0 * omega);
943 double dinv_y_d0 = cosphi0;
944 double dinv_y_phi0 = -omega * sinphi0 / (1 + d0 * omega);
945 double dinv_y_z0 = -
s * sinphi0 / (1 + d0 * omega);
947 double dinv_z_z0 = 1;
949 double dinv_px_d0 = (cosphi - cosphi0) / qC;
950 double dinv_px_phi0 = omega * sinphi0 / (1 + d0 * omega) / qC;
951 double dinv_px_omega = omega * omega * cosphi / qC;
952 double dinv_px_z0 = -
s * ( sinphi*(1 + d0 * omega) - sinphi0 ) / (qC * (1 + d0 * omega));
953 double dinv_px_tanDip = omega * cosphi *
s / qC;
955 double dinv_py_d0 = (sinphi - sinphi0) / qC;
956 double dinv_py_phi0 = -omega * cosphi0 / (1 + d0 * omega) / qC;
957 double dinv_py_omega = omega * omega * sinphi / qC;
958 double dinv_py_z0 =
s * ( cosphi*(1 + d0 * omega) - cosphi0) / (qC * (1 + d0 * omega));
959 double dinv_py_tanDip = omega * sinphi *
s / qC;
961 double dinv_pz_z0 = l * omega / qC;
962 double dinv_pz_tanDip = -omega / qC;
983 dinv_x_d0* ( dinv_x_d0*w_d0_d0 +dinv_x_phi0*w_phi0_d0 +dinv_x_z0*w_z0_d0 ) +
984 dinv_x_phi0* ( dinv_x_d0*w_phi0_d0 +dinv_x_phi0*w_phi0_phi0 +dinv_x_z0*w_z0_phi0 ) +
985 dinv_x_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) ;
987 dinv_y_d0* ( dinv_x_d0*w_d0_d0 +dinv_x_phi0*w_phi0_d0 +dinv_x_z0*w_z0_d0 ) +
988 dinv_y_phi0* ( dinv_x_d0*w_phi0_d0 +dinv_x_phi0*w_phi0_phi0 +dinv_x_z0*w_z0_phi0 ) +
989 dinv_y_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) ;
991 dinv_y_d0* ( dinv_y_d0*w_d0_d0 +dinv_y_phi0*w_phi0_d0 +dinv_y_z0*w_z0_d0 ) +
992 dinv_y_phi0* ( dinv_y_d0*w_phi0_d0 +dinv_y_phi0*w_phi0_phi0 +dinv_y_z0*w_z0_phi0 ) +
993 dinv_y_z0* ( dinv_y_d0*w_z0_d0 +dinv_y_phi0*w_z0_phi0 +dinv_y_z0*w_z0_z0 ) ;
995 dinv_z_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) ;
997 dinv_z_z0* ( dinv_y_d0*w_z0_d0 +dinv_y_phi0*w_z0_phi0 +dinv_y_z0*w_z0_z0 ) ;
999 dinv_z_z0* ( dinv_z_z0*w_z0_z0 ) ;
1002 dinv_px_d0* ( dinv_x_d0*w_d0_d0 +dinv_x_phi0*w_phi0_d0 +dinv_x_z0*w_z0_d0 ) +
1003 dinv_px_phi0* ( dinv_x_d0*w_phi0_d0 +dinv_x_phi0*w_phi0_phi0 +dinv_x_z0*w_z0_phi0 ) +
1004 dinv_px_omega* ( dinv_x_d0*w_omega_d0 +dinv_x_phi0*w_omega_phi0 +dinv_x_z0*w_z0_omega ) +
1005 dinv_px_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) +
1006 dinv_px_tanDip* ( dinv_x_d0*w_tanDip_d0 +dinv_x_phi0*w_tanDip_phi0 +dinv_x_z0*w_tanDip_z0 ) ;
1008 dinv_px_d0* ( dinv_y_d0*w_d0_d0 +dinv_y_phi0*w_phi0_d0 +dinv_y_z0*w_z0_d0 ) +
1009 dinv_px_phi0* ( dinv_y_d0*w_phi0_d0 +dinv_y_phi0*w_phi0_phi0 +dinv_y_z0*w_z0_phi0 ) +
1010 dinv_px_omega* ( dinv_y_d0*w_omega_d0 +dinv_y_phi0*w_omega_phi0 +dinv_y_z0*w_z0_omega ) +
1011 dinv_px_z0* ( dinv_y_d0*w_z0_d0 +dinv_y_phi0*w_z0_phi0 +dinv_y_z0*w_z0_z0 ) +
1012 dinv_px_tanDip* ( dinv_y_d0*w_tanDip_d0 +dinv_y_phi0*w_tanDip_phi0 +dinv_y_z0*w_tanDip_z0 ) ;
1014 dinv_px_d0* ( dinv_z_z0*w_z0_d0 ) +
1015 dinv_px_phi0* ( dinv_z_z0*w_z0_phi0 ) +
1016 dinv_px_omega* ( dinv_z_z0*w_z0_omega ) +
1017 dinv_px_z0* ( dinv_z_z0*w_z0_z0 ) +
1018 dinv_px_tanDip* ( dinv_z_z0*w_tanDip_z0 ) ;
1020 dinv_py_d0* ( dinv_x_d0*w_d0_d0 +dinv_x_phi0*w_phi0_d0 +dinv_x_z0*w_z0_d0 ) +
1021 dinv_py_phi0* ( dinv_x_d0*w_phi0_d0 +dinv_x_phi0*w_phi0_phi0 +dinv_x_z0*w_z0_phi0 ) +
1022 dinv_py_omega* ( dinv_x_d0*w_omega_d0 +dinv_x_phi0*w_omega_phi0 +dinv_x_z0*w_z0_omega ) +
1023 dinv_py_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) +
1024 dinv_py_tanDip* ( dinv_x_d0*w_tanDip_d0 +dinv_x_phi0*w_tanDip_phi0 +dinv_x_z0*w_tanDip_z0 ) ;
1026 dinv_py_d0* ( dinv_y_d0*w_d0_d0 +dinv_y_phi0*w_phi0_d0 +dinv_y_z0*w_z0_d0 ) +
1027 dinv_py_phi0* ( dinv_y_d0*w_phi0_d0 +dinv_y_phi0*w_phi0_phi0 +dinv_y_z0*w_z0_phi0 ) +
1028 dinv_py_omega* ( dinv_y_d0*w_omega_d0 +dinv_y_phi0*w_omega_phi0 +dinv_y_z0*w_z0_omega ) +
1029 dinv_py_z0* ( dinv_y_d0*w_z0_d0 +dinv_y_phi0*w_z0_phi0 +dinv_y_z0*w_z0_z0 ) +
1030 dinv_py_tanDip* ( dinv_y_d0*w_tanDip_d0 +dinv_y_phi0*w_tanDip_phi0 +dinv_y_z0*w_tanDip_z0 ) ;
1032 dinv_py_d0* ( dinv_z_z0*w_z0_d0 ) +
1033 dinv_py_phi0* ( dinv_z_z0*w_z0_phi0 ) +
1034 dinv_py_omega* ( dinv_z_z0*w_z0_omega ) +
1035 dinv_py_z0* ( dinv_z_z0*w_z0_z0 ) +
1036 dinv_py_tanDip* ( dinv_z_z0*w_tanDip_z0 ) ;
1038 dinv_pz_z0* ( dinv_x_d0*w_z0_d0 +dinv_x_phi0*w_z0_phi0 +dinv_x_z0*w_z0_z0 ) +
1039 dinv_pz_tanDip* ( dinv_x_d0*w_tanDip_d0 +dinv_x_phi0*w_tanDip_phi0 +dinv_x_z0*w_tanDip_z0 ) ;
1041 dinv_pz_z0* ( dinv_y_d0*w_z0_d0 +dinv_y_phi0*w_z0_phi0 +dinv_y_z0*w_z0_z0 ) +
1042 dinv_pz_tanDip* ( dinv_y_d0*w_tanDip_d0 +dinv_y_phi0*w_tanDip_phi0 +dinv_y_z0*w_tanDip_z0 ) ;
1044 dinv_pz_z0* ( dinv_z_z0*w_z0_z0 ) +
1045 dinv_pz_tanDip* ( dinv_z_z0*w_tanDip_z0 ) ;
1049 dinv_px_d0* ( dinv_px_d0*w_d0_d0 +dinv_px_phi0*w_phi0_d0 +dinv_px_omega*w_omega_d0 +dinv_px_z0*w_z0_d0 +dinv_px_tanDip*w_tanDip_d0 ) +
1050 dinv_px_phi0* ( dinv_px_d0*w_phi0_d0 +dinv_px_phi0*w_phi0_phi0 +dinv_px_omega*w_omega_phi0 +dinv_px_z0*w_z0_phi0 +dinv_px_tanDip*w_tanDip_phi0 ) +
1051 dinv_px_omega* ( dinv_px_d0*w_omega_d0 +dinv_px_phi0*w_omega_phi0 +dinv_px_omega*w_omega_omega +dinv_px_z0*w_z0_omega +dinv_px_tanDip*w_tanDip_omega ) +
1052 dinv_px_z0* ( dinv_px_d0*w_z0_d0 +dinv_px_phi0*w_z0_phi0 +dinv_px_omega*w_z0_omega +dinv_px_z0*w_z0_z0 +dinv_px_tanDip*w_tanDip_z0 ) +
1053 dinv_px_tanDip* ( dinv_px_d0*w_tanDip_d0 +dinv_px_phi0*w_tanDip_phi0 +dinv_px_omega*w_tanDip_omega +dinv_px_z0*w_tanDip_z0 +dinv_px_tanDip*w_tanDip_tanDip ) ;
1055 dinv_py_d0* ( dinv_px_d0*w_d0_d0 +dinv_px_phi0*w_phi0_d0 +dinv_px_omega*w_omega_d0 +dinv_px_z0*w_z0_d0 +dinv_px_tanDip*w_tanDip_d0 ) +
1056 dinv_py_phi0* ( dinv_px_d0*w_phi0_d0 +dinv_px_phi0*w_phi0_phi0 +dinv_px_omega*w_omega_phi0 +dinv_px_z0*w_z0_phi0 +dinv_px_tanDip*w_tanDip_phi0 ) +
1057 dinv_py_omega* ( dinv_px_d0*w_omega_d0 +dinv_px_phi0*w_omega_phi0 +dinv_px_omega*w_omega_omega +dinv_px_z0*w_z0_omega +dinv_px_tanDip*w_tanDip_omega ) +
1058 dinv_py_z0* ( dinv_px_d0*w_z0_d0 +dinv_px_phi0*w_z0_phi0 +dinv_px_omega*w_z0_omega +dinv_px_z0*w_z0_z0 +dinv_px_tanDip*w_tanDip_z0 ) +
1059 dinv_py_tanDip* ( dinv_px_d0*w_tanDip_d0 +dinv_px_phi0*w_tanDip_phi0 +dinv_px_omega*w_tanDip_omega +dinv_px_z0*w_tanDip_z0 +dinv_px_tanDip*w_tanDip_tanDip ) ;
1061 dinv_py_d0* ( dinv_py_d0*w_d0_d0 +dinv_py_phi0*w_phi0_d0 +dinv_py_omega*w_omega_d0 +dinv_py_z0*w_z0_d0 +dinv_py_tanDip*w_tanDip_d0 ) +
1062 dinv_py_phi0* ( dinv_py_d0*w_phi0_d0 +dinv_py_phi0*w_phi0_phi0 +dinv_py_omega*w_omega_phi0 +dinv_py_z0*w_z0_phi0 +dinv_py_tanDip*w_tanDip_phi0 ) +
1063 dinv_py_omega* ( dinv_py_d0*w_omega_d0 +dinv_py_phi0*w_omega_phi0 +dinv_py_omega*w_omega_omega +dinv_py_z0*w_z0_omega +dinv_py_tanDip*w_tanDip_omega ) +
1064 dinv_py_z0* ( dinv_py_d0*w_z0_d0 +dinv_py_phi0*w_z0_phi0 +dinv_py_omega*w_z0_omega +dinv_py_z0*w_z0_z0 +dinv_py_tanDip*w_tanDip_z0 ) +
1065 dinv_py_tanDip* ( dinv_py_d0*w_tanDip_d0 +dinv_py_phi0*w_tanDip_phi0 +dinv_py_omega*w_tanDip_omega +dinv_py_z0*w_tanDip_z0 +dinv_py_tanDip*w_tanDip_tanDip ) ;
1067 dinv_pz_z0* ( dinv_px_d0*w_z0_d0 +dinv_px_phi0*w_z0_phi0 +dinv_px_omega*w_z0_omega +dinv_px_z0*w_z0_z0 +dinv_px_tanDip*w_tanDip_z0 ) +
1068 dinv_pz_tanDip* ( dinv_px_d0*w_tanDip_d0 +dinv_px_phi0*w_tanDip_phi0 +dinv_px_omega*w_tanDip_omega +dinv_px_z0*w_tanDip_z0 +dinv_px_tanDip*w_tanDip_tanDip ) ;
1070 dinv_pz_z0* ( dinv_py_d0*w_z0_d0 +dinv_py_phi0*w_z0_phi0 +dinv_py_omega*w_z0_omega +dinv_py_z0*w_z0_z0 +dinv_py_tanDip*w_tanDip_z0 ) +
1071 dinv_pz_tanDip* ( dinv_py_d0*w_tanDip_d0 +dinv_py_phi0*w_tanDip_phi0 +dinv_py_omega*w_tanDip_omega +dinv_py_z0*w_tanDip_z0 +dinv_py_tanDip*w_tanDip_tanDip ) ;
1073 dinv_pz_z0* ( dinv_pz_z0*w_z0_z0 +dinv_pz_tanDip*w_tanDip_z0 ) +
1074 dinv_pz_tanDip* ( dinv_pz_z0*w_tanDip_z0 +dinv_pz_tanDip*w_tanDip_tanDip ) ;
1110TrkMomCalculator::calcCurvAllWeightsOLD(
const TrkSimpTraj& theTraj,
1115 HepSymMatrix& xxWeight,
1116 HepSymMatrix& ppWeight,
1117 HepMatrix& xpWeight) {
1126 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
1127 if (delDirDif.
length() != 0) {
1130 if (
arg.number() < 0.0) {
arg.setNumber(0.0);}
1138 MomDif = DirDif * momMag;
1153 HepMatrix Jxp_ns(6,6);
1158 Jxp_ns[i ][j]=Jx_n[i][j];
1159 Jxp_ns[i+3][j]=Jp_n[i][j];
1171 Jxp_ns[0][5]=DirDif.
x.
number();
1172 Jxp_ns[1][5]=DirDif.
y.
number();
1173 Jxp_ns[2][5]=DirDif.
z.
number();
1188 Jxp_ns.invert(invStatus);
1190 HepMatrix Jn_x(5,3);
1191 HepMatrix Jn_p(5,3);
1196 Jn_x[i][j]=Jxp_ns[i][j ];
1197 Jn_p[i][j]=Jxp_ns[i][j+3];
1202 Wnn.invert(invStatus);
1207 xxWeight = Wnn.similarityT(Jn_x);
1208 ppWeight = Wnn.similarityT(Jn_p);
1209 xpWeight = Jn_x.T()*Wnn*Jn_p;
1223TrkMomCalculator::calcNeutAllWeights(
const TrkSimpTraj& theTraj,
1228 HepSymMatrix& xxWeight,
1229 HepSymMatrix& ppWeight,
1230 HepMatrix& xpWeight) {
1237 theTraj.
getDFInfo(fltlen, PosDif, DirDif, delDirDif);
1248 HepMatrix Jxp_ns(6,6);
1253 Jxp_ns[i ][j]=Jx_n[i][j];
1254 Jxp_ns[i+3][j]=Jp_n[i][j];
1258 Jxp_ns.invert(invStatus);
1260 HepMatrix Jn_x(5,3);
1261 HepMatrix Jn_p(5,3);
1266 Jn_x[i][j]=Jxp_ns[i][j ];
1267 Jn_p[i][j]=Jxp_ns[i][j+3];
1272 Wnn.invert(invStatus);
1273 xxWeight = Wnn.similarityT(Jn_x);
1274 ppWeight = Wnn.similarityT(Jn_p);
1275 xpWeight = Jn_x.T()*Wnn*Jn_p;
double sin(const BesAngle a)
double cos(const BesAngle a)
double correlation(const DifNumber &a, const DifNumber &b)
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
double arg(const EvtComplex &c)
double bFieldNominal() const
static const double cmTeslaToGeVc
HepSymMatrix & covariance()
DifNumber difPar(int i) const
const DifIndepPar * indepPar() const
HepSymMatrix errorMatrix(const HepSymMatrix &e) const
HepMatrix jacobian() const
virtual Hep3Vector direction(double) const =0
virtual double curvature(double) const =0
virtual void getDFInfo(double fltLen, DifPoint &pos, DifVector &direction, DifVector &delDirect) const =0
static void getAllWeights(const TrkSimpTraj &, const BField &, double fltlen, HepVector &pos, HepVector &mom, HepSymMatrix &xxWeight, HepSymMatrix &ppWeight, HepMatrix &xpWeight)
virtual ~TrkMomCalculator()
static bool weightToCov(const HepSymMatrix &inXX, const HepSymMatrix &inPP, const HepMatrix &inXP, HepSymMatrix &outXX, HepSymMatrix &outPP, HepMatrix &outXP)
static void getAllCovs(const TrkSimpTraj &, const BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static HepMatrix posmomCov(const TrkSimpTraj &, const BField &, double fltlen)
static BesVectorErr errMom(const TrkSimpTraj &, const BField &, double fltlen)
static Hep3Vector vecMom(const TrkSimpTraj &, const BField &, double fltlen)
static int charge(const TrkSimpTraj &, const BField &, double fltlen)
static double ptMom(const TrkSimpTraj &, const BField &, double fltlen)
const TrkCircleTraj * circle() const
const HelixTraj * helix() const
const NeutTraj * neut() const
HepSymMatrix & covariance()
const HepSymMatrix & weightMatrix() const