11 static Double_t sectorX[] = {
13 0.866025403784439, -0.5,
14 0.5, -0.866025403784439,
16 -0.5, -0.866025403784439,
17 -0.866025403784439, -0.5,
19 -0.866025403784439, 0.5,
20 -0.5, 0.866025403784438,
22 0.5, 0.866025403784439,
23 0.866025403784438, 0.5,
25 0.866025403784439, 0.5,
26 0.5, 0.866025403784438,
28 -0.5, 0.866025403784439,
29 -0.866025403784439, 0.5,
31 -0.866025403784439, -0.5,
32 -0.5, -0.866025403784439,
34 0.5, -0.866025403784439,
35 0.866025403784438, -0.5,
41 static Double_t sectorY[] = {
43 0.5, 0.866025403784439,
44 0.866025403784439, 0.5,
46 0.866025403784439, -0.5,
47 0.5, -0.866025403784439,
49 -0.5, -0.866025403784439,
50 -0.866025403784439, -0.5,
52 -0.866025403784439, 0.5,
53 -0.5, 0.866025403784438,
55 -0.5, 0.866025403784439,
56 -0.866025403784439, 0.5,
58 -0.866025403784439, -0.5,
59 -0.5, -0.866025403784439,
61 0.5, -0.866025403784439,
62 0.866025403784438, -0.5,
64 0.866025403784438, 0.5,
65 0.5, 0.866025403784439,
74 double distance(
double a1,
double b1,
double a2,
double b2){
75 return sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) );
84 return (point1-point2).mag();
97 if(fabs(helix.curvature())<=static_cast<double>(0)){
98 return lineDca2D(helix,point,*origin);
101 return helixDca2D(helix,point);
115 double dcaZ = (dis1.mag() < dis2.mag()) ? dis1.z() : dis2.z();
116 if(isnan(dcaZ))
return 999;
124 if(fabs(helix.curvature())<=static_cast<double>(0)){
125 return lineCrossingAngle(helix,hit);
128 return helixCrossingAngle(helix,hit,bField);
135 if(fabs(helix.curvature())<=static_cast<double>(0)){
136 return linePadrowDca(helix,hit);
139 return helixPadrowDca(helix,hit);
171 double R = 1./helix.curvature();
172 double dX = hit->position().x() - helix.
xcenter();
173 double dY = hit->position().y() - helix.
ycenter();
181 double d = TMath::Sqrt(dX*dX + dY*dY);
182 double dPerp = dX*sectorY[2*hit->sector()] +
183 dY*sectorY[2*hit->sector() + 1];
191 x = - dX*sectorY[2*hit->sector() + 1] +
192 dY*sectorY[2*hit->sector()];
195 double cosTheta = (dX*sectorX[2*hit->sector()] +
196 dY*sectorX[2*hit->sector() + 1])/d;
198 x = -d*cosTheta + (cosTheta<0 ? -1. : 1.) *
199 TMath::Sqrt(R*R - d*d*(1 - cosTheta*cosTheta));
204 dX = hit->position().x() + x*sectorX[2*hit->sector()];
205 dY = hit->position().y() + x*sectorX[2*hit->sector() + 1];
234 double s = propagateToPadrow(helix, hit);
235 double dX = hit->position().x() - helix.
x(s);
236 double dY = hit->position().y() - helix.y(s);
237 double dca = TMath::Sqrt(dX*dX + dY*dY);
240 if (helixDca2D(helix, hit->position()) < 0) dca *= -1.;
251 double helixCrossingAngle(
float pt,
float phi,
int sector)
253 double px=pt*cos(phi);
254 double py=pt*sin(phi);
255 double cosTheta = (px*sectorY[2*sector] +
256 py*sectorY[2*sector + 1])/pt;
263 double theta = TMath::ACos(cosTheta);
264 if (px*sectorY[2*sector + 1] -
265 py*sectorY[2*sector] > 0) theta *= -1.;
279 double s = propagateToPadrow(helix, hit);
288 double cosTheta = (p.x()*sectorY[2*hit->sector()] +
289 p.y()*sectorY[2*hit->sector() + 1])/p.perp();
310 double theta = TMath::ACos(cosTheta);
311 if (p.x()*sectorY[2*hit->sector() + 1] -
312 p.y()*sectorY[2*hit->sector()] > 0) theta *= -1.;
321 return (distance(helix.
xcenter(),point.x(),helix.
ycenter(),point.y())
322 -(1./helix.curvature()));
341 double cosPhase = cos(helix.
phase());
342 double sinPhase = sin(helix.
phase());
344 double px = point.x();
345 double py = point.y();
346 double dx = px-origin.x();
347 double dy = py-origin.y();
349 double s = cosPhase*dy-sinPhase*dx;
352 double xDca = origin.x() - s*sinPhase;
353 double yDca = origin.y() + s*cosPhase;
380 (perp.x()*sectorX[2*hit->sector()] +
381 perp.y()*sectorX[2*hit->sector()+1])/perp.perp();
383 double padrowDca = perp.perp()/fabs(cosTheta);
387 double sign = lineDca2D(helix,hit->position(),origin);
389 return (sign>=0) ? padrowDca : -padrowDca;
397 double psi = helix.
phase() + TMath::Pi()/2.;
398 double psiX = cos(psi);
399 double psiY = sin(psi);
402 psiX*sectorY[2*hit->sector()] + psiY*sectorY[2*hit->sector()+1];
406 cout <<
"%%% line crossing angle negative? "
412 double sign = psiX*sectorY[2*hit->sector()+1]-psiY*sectorY[2*hit->sector()];
414 return (sign>0) ? acos(cosTheta) : -acos(cosTheta);
422 double psi = helix.
phase() + TMath::Pi()/2.;
423 double psiX = cos(psi);
424 double psiY = sin(psi);
427 psiX*sectorY[2*sector] + psiY*sectorY[2*sector+1];
431 cout <<
"%%% line crossing angle negative? "
437 double sign = psiX*sectorY[2*sector+1]-psiY*sectorY[2*sector];
439 return (sign>0) ? acos(cosTheta) : -acos(cosTheta);
463 double cross = origin2atHit.x()*origin2hit.y()
464 - origin2atHit.y()*origin2hit.x();
466 return (cross>=0) ? dca.perp() : - dca.perp();
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