39 #include "StPhysicalHelixD.hh"
45 static Double_t sectorX[] = {
47 0.866025403784439, -0.5,
48 0.5, -0.866025403784439,
50 -0.5, -0.866025403784439,
51 -0.866025403784439, -0.5,
53 -0.866025403784439, 0.5,
54 -0.5, 0.866025403784438,
56 0.5, 0.866025403784439,
57 0.866025403784438, 0.5,
59 0.866025403784439, 0.5,
60 0.5, 0.866025403784438,
62 -0.5, 0.866025403784439,
63 -0.866025403784439, 0.5,
65 -0.866025403784439, -0.5,
66 -0.5, -0.866025403784439,
68 0.5, -0.866025403784439,
69 0.866025403784438, -0.5,
75 static Double_t sectorY[] = {
77 0.5, 0.866025403784439,
78 0.866025403784439, 0.5,
80 0.866025403784439, -0.5,
81 0.5, -0.866025403784439,
83 -0.5, -0.866025403784439,
84 -0.866025403784439, -0.5,
86 -0.866025403784439, 0.5,
87 -0.5, 0.866025403784438,
89 -0.5, 0.866025403784439,
90 -0.866025403784439, 0.5,
92 -0.866025403784439, -0.5,
93 -0.5, -0.866025403784439,
95 0.5, -0.866025403784439,
96 0.866025403784438, -0.5,
98 0.866025403784438, 0.5,
99 0.5, 0.866025403784439,
108 double distance(
double a1,
double b1,
double a2,
double b2){
109 return ::sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) );
118 return (point1-point2).mag();
131 if(fabs(helix.curvature())<=static_cast<double>(0)){
132 return lineDca2D(helix,point,*origin);
135 return helixDca2D(helix,point);
147 double z0 = helix.
origin().z();
148 double phi = atan2(point.y()-helix.
ycenter(),
151 double dphi = h*(phi-helix.
phase());
154 dphi = (fabs(dphi) < M_PI ) ? dphi :
155 ((dphi<0) ? 2*M_PI + dphi : 2*M_PI - dphi);
157 double arclength= (1./helix.curvature()) * dphi;
159 double dcaZ = (point.z() - (z0 + arclength*tan(helix.dipAngle())));
202 if(fabs(helix.curvature())<=static_cast<double>(0)){
203 return lineCrossingAngle(helix,hit);
206 return helixCrossingAngle(helix,hit,bField);
213 if(fabs(helix.curvature())<=static_cast<double>(0)){
214 return linePadrowDca(helix,hit);
217 return helixPadrowDca(helix,hit);
249 double R = 1./helix.curvature();
250 double dX = hit->position().x() - helix.
xcenter();
251 double dY = hit->position().y() - helix.
ycenter();
259 double d = TMath::Sqrt(dX*dX + dY*dY);
260 double dPerp = dX*sectorY[2*hit->sector()] +
261 dY*sectorY[2*hit->sector() + 1];
269 x = - dX*sectorY[2*hit->sector() + 1] +
270 dY*sectorY[2*hit->sector()];
273 double cosTheta = (dX*sectorX[2*hit->sector()] +
274 dY*sectorX[2*hit->sector() + 1])/d;
276 x = -d*cosTheta + (cosTheta<0 ? -1. : 1.) *
277 TMath::Sqrt(R*R - d*d*(1 - cosTheta*cosTheta));
282 dX = hit->position().x() + x*sectorX[2*hit->sector()];
283 dY = hit->position().y() + x*sectorX[2*hit->sector() + 1];
310 double s = propagateToPadrow(helix, hit);
311 double dX = hit->position().x() - helix.
x(s);
312 double dY = hit->position().y() - helix.y(s);
313 double dca = TMath::Sqrt(dX*dX + dY*dY);
316 if (helixDca2D(helix, hit->position()) < 0) dca *= -1.;
333 double s = propagateToPadrow(helix, hit);
342 double cosTheta = (p.x()*sectorY[2*hit->sector()] +
343 p.y()*sectorY[2*hit->sector() + 1])/p.perp();
364 double theta = TMath::ACos(cosTheta);
365 if (p.x()*sectorY[2*hit->sector() + 1] -
366 p.y()*sectorY[2*hit->sector()] > 0) theta *= -1.;
375 return (distance(helix.
xcenter(),point.x(),helix.
ycenter(),point.y())
376 -(1./helix.curvature()));
395 double cosPhase = cos(helix.
phase());
396 double sinPhase = sin(helix.
phase());
398 double px = point.x();
399 double py = point.y();
400 double dx = px-origin.x();
401 double dy = py-origin.y();
403 double s = cosPhase*dy-sinPhase*dx;
406 double xDca = origin.x() - s*sinPhase;
407 double yDca = origin.y() + s*cosPhase;
434 (perp.x()*sectorX[2*hit->sector()] +
435 perp.y()*sectorX[2*hit->sector()+1])/perp.perp();
437 double padrowDca = perp.perp()/fabs(cosTheta);
441 double sign = lineDca2D(helix,hit->position(),origin);
443 return (sign>=0) ? padrowDca : -padrowDca;
451 double psi = helix.
phase() + TMath::Pi()/2.;
452 double psiX = cos(psi);
453 double psiY = sin(psi);
456 psiX*sectorY[2*hit->sector()] + psiY*sectorY[2*hit->sector()+1];
460 cout <<
"%%% line crossing angle negative? "
466 double sign = psiX*sectorY[2*hit->sector()+1]-psiY*sectorY[2*hit->sector()];
468 return (sign>0) ? acos(cosTheta) : -acos(cosTheta);
476 double psi = helix.
phase() + TMath::Pi()/2.;
477 double psiX = cos(psi);
478 double psiY = sin(psi);
481 psiX*sectorY[2*sector] + psiY*sectorY[2*sector+1];
485 cout <<
"%%% line crossing angle negative? "
491 double sign = psiX*sectorY[2*sector+1]-psiY*sectorY[2*sector];
493 return (sign>0) ? acos(cosTheta) : -acos(cosTheta);
517 double cross = origin2atHit.x()*origin2hit.y()
518 - origin2atHit.y()*origin2hit.x();
520 return (cross>=0) ? dca.perp() : - dca.perp();
int h() const
y-center of circle in xy-plane
double x(double s) const
coordinates of helix at point s
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
double ycenter() const
x-center of circle in xy-plane
const StThreeVector< double > & origin() const
-sign(q*B);
double xcenter() const
aziumth in xy-plane measured from ring center
double phase() const
1/R in xy-plane