18 return calculate(chargeA, momentumA, positionA, chargeB, momentumB, positionB,
34 return calculate(chargeA, momentumA, positionA, chargeB, momentumB, positionB,
41 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
42 return pair<GlobalPoint, GlobalPoint> (posA, posB);
50 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
52 (posA.y() + posB.y())/2.,
53 (posA.z() + posB.z())/2.);
60 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
61 return (posB - posA).mag();
67 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
69 float perpdist = (posB - posA).
perp();
91 circleParameters(chargeA, momentumA, positionA, xca, yca, ra, magField);
93 circleParameters(chargeB, momentumB, positionB, xcb, ycb, rb, magField);
96 double xg1, yg1, xg2, yg2;
97 int flag = transverseCoord(xca, yca, ra, xcb, ycb, rb, xg1, yg1, xg2, yg2);
103 double xga, yga, zga, xgb, ygb, zgb;
106 intersection_ =
true;
109 intersection_ =
false;
113 xga = xg1; yga = yg1;
114 zga = zCoord(momentumA, positionA, ra, xca, yca, xga, yga);
115 xgb = xg2; ygb = yg2;
116 zgb = zCoord(momentumB, positionB, rb, xcb, ycb, xgb, ygb);
125 pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters>
129 throw cms::Exception(
"TrackingTools/PatternTools",
"TangentApproachInRPhi::could not compute track crossing. Check status before calling this method!");
130 pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters>
131 ret ( trajectoryParameters ( posA, paramA ),
132 trajectoryParameters ( posB, paramB ) );
147 double dx2 = newpt.
x() - xc;
148 double dy2 = newpt.
y() - yc;
151 double cosphi = ( dx1 * dx2 + dy1 * dy2 ) /
152 (
sqrt ( dx1 * dx1 + dy1 * dy1 ) *
sqrt ( dx2 * dx2 + dy2 * dy2 ));
153 double sinphi = - oldgtp.
charge() *
sqrt ( 1 - cosphi * cosphi );
168 double& xc,
double& yc,
double&
r,
178 double bz = magField.
inTesla(position).
z() * 2.99792458e-3;
181 double signed_r = charge*momentum.
transverse() / bz;
187 double phi = momentum.
phi();
188 xc = signed_r*
sin(phi) + position.
x();
189 yc = -signed_r*
cos(phi) + position.
y();
196 double cxb,
double cyb,
double rb,
197 double & xg1,
double & yg1,
198 double & xg2,
double & yg2)
const
201 double x1, y1, x2, y2;
206 double d_ab =
sqrt((cxb - cxa)*(cxb - cxa) + (cyb - cya)*(cyb - cya));
211 double u = (cxb - cxa) / d_ab;
212 double v = (cyb - cya) / d_ab;
215 if (d_ab <= ra + rb && d_ab >=
abs(rb - ra)) {
234 x1 = ra; y1 = 0; x2 = d_ab - rb; y2 = 0;
238 else if (d_ab > ra + rb) {
245 x1 = ra; y1 = 0; x2 = d_ab - rb; y2 = 0;
247 else if (d_ab <
abs(rb - ra)) {
255 if (ra <= rb) sign = -1.;
256 x1 = sign*ra; y1 = 0; x2 = d_ab + sign*rb; y2 = 0;
263 xg1 = u*x1 - v*y1 + cxa; yg1 = v*x1 + u*y1 + cya;
264 xg2 = u*x2 - v*y2 + cxa; yg2 = v*x2 + u*y2 + cya;
273 double r,
double xc,
double yc,
274 double xg,
double yg)
const
278 double x = pos.
x();
double y = pos.
y();
double z = pos.
z();
280 double px = mom.
x();
double py = mom.
y();
double pz = mom.
z();
286 double sinHalfPhi =
sqrt((x-xg)*(x-xg) + (y-yg)*(y-yg))/(2*
r);
287 if (sinHalfPhi < 0.383) {
288 phi = 2*asin(sinHalfPhi);
291 double cosPhi = ((x-xc)*(xg-xc) + (y-yc)*(yg-yc))/(r*r);
292 if (
std::abs(cosPhi) > 1) cosPhi = (cosPhi > 0 ? 1 : -1);
293 phi =
abs(acos(cosPhi));
296 double signPhi = ((x - xc)*(yg - yc) - (xg - xc)*(y - yc) > 0) ? 1. : -1.;
300 double signOmega = ((x - xc)*py - (y - yc)*px > 0) ? 1. : -1.;
305 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.
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
T perp() const
Magnitude of transverse component.
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)