7#include "MdcGeom/Constants.h"
8#include "MdcGeom/BesAngle.h"
9#include "CLHEP/Geometry/Point3D.h"
10#include "CLHEP/Vector/ThreeVector.h"
11#include "CLHEP/Matrix/SymMatrix.h"
12#include "TrkBase/HelixTraj.h"
13#include "TrkBase/TrkVisitor.h"
14#include "TrkBase/TrkExchangePar.h"
15#include "MdcRecoUtil/DifNumber.h"
16#include "MdcRecoUtil/DifPoint.h"
17#include "MdcRecoUtil/DifVector.h"
29 double lowlim,
double hilim,
const HepPoint3D& refpoint) :
35 std::cout<<
"ErrMsg(fatal) "
36 <<
"HelixTraj: incorrect constructor vector/matrix dimension" << std::endl;
45 double lowlim,
double hilim,
const HepPoint3D& refpoint) :
46 TrkSimpTraj(inpar.params(), inpar.covariance(), lowlim,hilim,refpoint)
52 double lowlim,
double hilim,
const HepPoint3D& refpoint) :
61 h.lowRange(),h.hiRange(),h.referencePoint())
87HelixTraj::z(
const double& f)
const
95 double cDip = cosDip();
96 double sDip =
tanDip() * cDip;
98 double ang = phi00 + cDip*f*
omega();
99 double cang =
cos(ang);
100 double sang =
sin(ang);
101 double sphi0 =
sin(phi00);
102 double cphi0 =
cos(phi00);
114 double alpha = angle( f );
116 double cDip = cosDip();
117 return Hep3Vector (
cos(
alpha)*cDip,
125 double ang = angle(fltLen);
126 double cDip = cosDip();
127 double delX = -
omega() * cDip * cDip *
sin(ang);
128 double delY =
omega() * cDip * cDip *
cos(ang);
129 return Hep3Vector(delX, delY, 0.0);
148 Hep3Vector& delDir)
const
151 double cDip = cosDip();
152 double sDip =
tanDip() * cDip;
154 double ang = phi00 + cDip*fltLen*
omega();
155 double cang =
cos(ang);
156 double sang =
sin(ang);
157 double sphi0 =
sin(phi00);
158 double cphi0 =
cos(phi00);
160 double xt = (sang - sphi0)/
omega() -
d0()*sphi0 +
162 double yt = -(cang - cphi0)/
omega() +
d0()*cphi0 +
169 dir.setX(cang * cDip);
170 dir.setY(sang * cDip);
173 double delX = -
omega() * cDip * cDip * sang;
174 double delY =
omega() * cDip * cDip * cang;
184 double cDip = cosDip();
185 double sDip =
tanDip() * cDip;
187 double ang = phi00 + cDip*fltLen*
omega();
188 double cang =
cos(ang);
189 double sang =
sin(ang);
190 double sphi0 =
sin(phi00);
191 double cphi0 =
cos(phi00);
193 double xt = (sang - sphi0)/
omega() -
d0()*sphi0 +
195 double yt = -(cang - cphi0)/
omega() +
d0()*cphi0 +
202 dir.setX(cang * cDip);
203 dir.setY(sang * cDip);
379 double omeg =
omega();
381 double arcl = arc(fltlen);
382 double dx =
cos(arcl);
383 double dy =
sin(arcl);
384 double cosd = cosDip();
385 double darc = omeg*
d0();
394 ddflct(
d0Index+1,1) = (1-dx)*tand/omeg;
395 ddflct(
phi0Index+1,1) = -dy*tand/(1+darc);
397 ddflct(
z0Index+1,1) = - translen(fltlen) - (tand*tand)*dy/(omeg*(1+darc));
402 ddflct(
d0Index+1,1) = -dy/(cosd*omeg);
403 ddflct(
phi0Index+1,1) = dx/(cosd*(1+darc));
404 ddflct(
z0Index+1,1) = -tand*(1- dx/(1+darc))/(cosd*omeg);
427 double omeg =
omega();
429 double arcl = arc(fltlen);
430 double dx =
cos(arcl);
431 double dy =
sin(arcl);
432 double cosd = cosDip();
433 double sind = sinDip();
434 double darc_1 = 1.0+omeg*
d0();
442 ddflct(
d0Index+1,1) = -sind*dy;
443 ddflct(
phi0Index+1,1) = sind*dx*omeg/darc_1;
444 ddflct(
z0Index+1,1) = sind*tand*dx/darc_1 + cosd;
451 ddflct(
z0Index+1,1) = tand*dy/darc_1;
475 double omeg =
omega();
477 double tranl = translen(fltlen);
478 double arcl = tranl*omeg;
479 double dx =
cos(arcl);
480 double dy =
sin(arcl);
481 double darc = omeg*
d0();
489 dmomfrac(
d0Index+1,1) = -(1-dx)/omeg;
493 dmomfrac(
z0Index+1,1) = -tand*(tranl-dy/((1+darc)*omeg));
504 double cosd = cosDip();
506 return (cosd*cosd)*fabs(
omega());
517 const HepVector& oldvec,
const HepSymMatrix& oldcov,
518 HepVector& newvec,HepSymMatrix& newcov,
522 HepVector parvec(oldvec);
526 double delx = newpoint.x()-oldpoint.x();
527 double dely = newpoint.y()-oldpoint.y();
528 double delz = newpoint.z()-oldpoint.z();
535 double perp = delx*sin0-dely*cos0;
536 double para = delx*cos0+dely*sin0;
541 double newdelta2 = delta*delta + delx*delx + dely*dely +
544 double newdelta = delta>0 ? sqrt(newdelta2) : -sqrt(newdelta2);
545 double invdelta = 1.0/newdelta;
546 double invdelta2 = 1.0/newdelta2;
550 double newphi = atan2(sin0+delx/delta,cos0-dely/delta);
551 while(fabs(newphi - oldphi)>
M_PI)
557 double delphi = newphi-parvec[
phi0Index];
586 newcov = oldcov.similarity(covrot);
603 for (
unsigned iparam = 0; iparam <
NHLXPRM; iparam++) {
609 flags[iparam] =
true;
614 flags[iparam] =
false;
617 flags[iparam] =
false;
631HelixTraj::angle(
const double& f)
const
639 os <<
"HelixTraj with range "
641 <<
"d0= " <<
d0() <<
" phi0= "
642 <<
phi0() <<
" omega= "
643 <<
omega() <<
" z0 = "
644 <<
z0() <<
" tanDip= "
double sin(const BesAngle a)
double cos(const BesAngle a)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input parameters
HepGeom::Point3D< double > HepPoint3D
void setIndepPar(const DifIndepPar *par)
DifNumber & mod(double lo, double hi)
void cosAndSin(DifNumber &c, DifNumber &s) const
double curvature(double fltLen) const
HelixTraj(const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
HepMatrix derivDeflect(double fltlen, deflectDirection) const
HelixTraj * clone() const
virtual void getDFInfo2(double fltLen, DifPoint &pos, DifVector &dir) const
HepMatrix derivPFract(double fltlen) const
virtual void print(std::ostream &os) const
virtual HepPoint3D position(double fltLen) const
void invertParams(TrkParams *params, std::vector< bool > &flags) const
virtual Hep3Vector delDirect(double) const
HelixTraj & operator=(const HelixTraj &)
virtual void printAll(std::ostream &os) const
virtual double distTo2ndError(double s, double tol, int pathDir) const
HepMatrix derivDisplace(double fltlen, deflectDirection idir) const
virtual void getDFInfo(double fltLen, DifPoint &, DifVector &dir, DifVector &delDir) const
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &dir) const
virtual double distTo1stError(double s, double tol, int pathDir) const
virtual void visitAccept(TrkVisitor *vis) const
virtual Hep3Vector direction(double fltLen) const
virtual void print(std::ostream &os) const
Trajectory & operator=(const Trajectory &)
const HepPoint3D & referencePoint() const
virtual void trkVisitHelixTraj(const HelixTraj *)=0