19 return calculate(chargeA, momentumA, positionA, chargeB, momentumB, positionB,
35 return calculate(chargeA, momentumA, positionA, chargeB, momentumB, positionB,
42 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
43 return pair<GlobalPoint, GlobalPoint> (posA, posB);
51 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
53 (posA.y() + posB.y())/2.,
54 (posA.z() + posB.z())/2.);
61 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
62 return (posB - posA).mag();
68 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
70 float perpdist = (posB - posA).
perp();
92 circleParameters(chargeA, momentumA, positionA, xca, yca, ra, magField);
94 circleParameters(chargeB, momentumB, positionB, xcb, ycb, rb, magField);
97 double xg1, yg1, xg2, yg2;
98 int flag = transverseCoord(xca, yca, ra, xcb, ycb, rb, xg1, yg1, xg2, yg2);
104 double xga, yga, zga, xgb, ygb, zgb;
107 intersection_ =
true;
110 intersection_ =
false;
114 xga = xg1; yga = yg1;
115 zga = zCoord(momentumA, positionA, ra, xca, yca, xga, yga);
116 xgb = xg2; ygb = yg2;
117 zgb = zCoord(momentumB, positionB, rb, xcb, ycb, xgb, ygb);
126 pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters>
130 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
131 pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters>
132 ret ( trajectoryParameters ( posA, paramA ),
133 trajectoryParameters ( posB, paramB ) );
148 double dx2 = newpt.
x() - xc;
149 double dy2 = newpt.
y() - yc;
152 double cosphi = ( dx1 * dx2 + dy1 * dy2 ) /
153 (
sqrt ( dx1 * dx1 + dy1 * dy1 ) *
sqrt ( dx2 * dx2 + dy2 * dy2 ));
154 double sinphi = - oldgtp.
charge() *
sqrt ( 1 - cosphi * cosphi );
169 double& xc,
double& yc,
double&
r,
179 double bz = magField.
inTesla(position).
z() * 2.99792458e-3;
182 double signed_r = charge*momentum.
transverse() / bz;
188 double phi = momentum.
phi();
189 xc = signed_r*
sin(phi) + position.
x();
190 yc = -signed_r*
cos(phi) + position.
y();
197 double cxb,
double cyb,
double rb,
198 double & xg1,
double & yg1,
199 double & xg2,
double & yg2)
const
202 double x1, y1, x2, y2;
207 double d_ab =
sqrt((cxb - cxa)*(cxb - cxa) + (cyb - cya)*(cyb - cya));
212 double u = (cxb - cxa) / d_ab;
213 double v = (cyb - cya) / d_ab;
216 if (d_ab <= ra + rb && d_ab >=
abs(rb - ra)) {
235 x1 = ra; y1 = 0; x2 = d_ab - rb; y2 = 0;
239 else if (d_ab > ra + rb) {
246 x1 = ra; y1 = 0; x2 = d_ab - rb; y2 = 0;
248 else if (d_ab <
abs(rb - ra)) {
256 if (ra <= rb) sign = -1.;
257 x1 = sign*ra; y1 = 0; x2 = d_ab + sign*rb; y2 = 0;
264 xg1 = u*x1 - v*y1 + cxa; yg1 = v*x1 + u*y1 + cya;
265 xg2 = u*x2 - v*y2 + cxa; yg2 = v*x2 + u*y2 + cya;
274 double r,
double xc,
double yc,
275 double xg,
double yg)
const
279 double x = pos.
x();
double y = pos.
y();
double z = pos.
z();
281 double px = mom.
x();
double py = mom.
y();
double pz = mom.
z();
287 double sinHalfPhi =
sqrt((x-xg)*(x-xg) + (y-yg)*(y-yg))/(2*
r);
288 if (sinHalfPhi < 0.383) {
289 phi = 2*asin(sinHalfPhi);
292 double cosPhi = ((x-xc)*(xg-xc) + (y-yc)*(yg-yc))/(r*r);
293 if (
std::abs(cosPhi) > 1) cosPhi = (cosPhi > 0 ? 1 : -1);
294 phi =
abs(acos(cosPhi));
297 double signPhi = ((x - xc)*(yg - yc) - (xg - xc)*(y - yc) > 0) ? 1. : -1.;
301 double signOmega = ((x - xc)*py - (y - yc)*px > 0) ? 1. : -1.;
306 double dz = signPhi*signOmega*(pz/mom.
transverse())*phi*r;
virtual std::pair< GlobalPoint, GlobalPoint > points() const
TrackCharge charge() const
std::pair< GlobalTrajectoryParameters, GlobalTrajectoryParameters > trajectoryParameters() const
const GlobalTrajectoryParameters & parameters() const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T perp() const
Magnitude of transverse component.
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
TrackCharge charge() const
double zCoord(const GlobalVector &mom, const GlobalPoint &pos, double r, double xc, double yc, double xg, double yg) const
static int position[TOTALCHAMBERS][3]
virtual GlobalPoint crossingPoint() const
FreeTrajectoryState * freeState(bool withErrors=true) const
GlobalVector momentum() const
Cos< T >::type cos(const T &t)
int transverseCoord(double cxa, double cya, double ra, double cxb, double cyb, double rb, double &xg1, double &yg1, double &xg2, double &yg2) const
GlobalVector momentum() const
GlobalPoint position() const
GlobalPoint position() const
const GlobalTrajectoryParameters & globalParameters() const
virtual float distance() const
GlobalVector globalMomentum() const
const MagneticField & magneticField() const
TrackCharge charge() const
void circleParameters(const TrackCharge &charge, const GlobalVector &momemtum, const GlobalPoint &position, double &xc, double &yc, double &r, const MagneticField &magField) const
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)