#include <TwoTrackMinimumDistanceLineLine.h>
Public Member Functions | |
bool | calculate (const GlobalTrajectoryParameters &, const GlobalTrajectoryParameters &) |
double | firstAngle () const |
std::pair< double, double > | pathLength () const |
std::pair< GlobalPoint, GlobalPoint > | points () const |
double | secondAngle () const |
Private Attributes | |
GlobalPoint | gPos |
GlobalPoint | hPos |
double | pathG |
double | pathH |
double | phiG |
double | phiH |
This is a helper class for TwoTrackMinimumDistance. No user should need direct access to this class. Exact solution.
Definition at line 18 of file TwoTrackMinimumDistanceLineLine.h.
bool TwoTrackMinimumDistanceLineLine::calculate | ( | const GlobalTrajectoryParameters & | theG, |
const GlobalTrajectoryParameters & | theH | ||
) |
Calculates the point of closest approach on the two tracks.
Definition at line 8 of file TwoTrackMinimumDistanceLineLine.cc.
References GlobalTrajectoryParameters::charge(), Vector3DBase< T, FrameTag >::dot(), gPos, hPos, MagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), pathG, pathH, PV3DBase< T, PVType, FrameType >::phi(), phiG, phiH, GlobalTrajectoryParameters::position(), and PV3DBase< T, PVType, FrameType >::z().
{ GlobalPoint gOrig = theG.position(); GlobalPoint hOrig = theH.position(); bool isLineG = theG.magneticField().inTesla(gOrig).z() == 0 || theG.charge() == 0; bool isLineH = theH.magneticField().inTesla(hOrig).z() == 0 || theH.charge() == 0; if ( ! (isLineG && isLineH) ) { edm::LogWarning ("TwoTrackMinimumDistanceLineLine") << "charge of input track is not zero or field non zero" << "\n positions: "<<gOrig<<" , "<<hOrig << "\n Bz fields: "<<theG.magneticField().inTesla(gOrig).z()<<" , "<<theH.magneticField().inTesla(hOrig).z() << "\n charges: "<<theG.charge()<<" , "<<theH.charge(); return true; }; GlobalVector gVec = theG.momentum(); const double gMag= theG.momentum().mag(); double gMag2 = gMag*gMag; GlobalVector hVec = theH.momentum(); const double hMag= theH.momentum().mag(); double hMag2 = hMag*hMag; if ( gMag == 0. || hMag == 0. ) { edm::LogWarning ("TwoTrackMinimumDistanceLineLine") << "momentum of input trajectory is zero."; return true; }; phiG = theG.momentum().phi(); phiH = theH.momentum().phi(); double gVec_Dot_hVec = gVec.dot(hVec); double norm = gVec_Dot_hVec*gVec_Dot_hVec - gMag2*hMag2; if ( norm == 0 ) { edm::LogWarning ("TwoTrackMinimumDistanceLineLine") << "Tracks are parallel."; return true; } GlobalVector posDiff = gOrig - hOrig; double tG = (posDiff.dot(gVec) * hMag2 - gVec_Dot_hVec * posDiff.dot(hVec))/ norm; double tH = (gVec_Dot_hVec * posDiff.dot(gVec) - posDiff.dot(hVec) * gMag2)/ norm; gPos = GlobalPoint ( gOrig + tG * gVec); hPos = GlobalPoint ( hOrig + tH * hVec); // cout << "TwoTrackMinimumDistanceLineLine "<<gPos<<hPos<<endl; pathG = tG * gMag; pathH = tH * hMag; return false; }
double TwoTrackMinimumDistanceLineLine::firstAngle | ( | ) | const [inline] |
std::pair< double, double > TwoTrackMinimumDistanceLineLine::pathLength | ( | ) | const |
std::pair< GlobalPoint, GlobalPoint > TwoTrackMinimumDistanceLineLine::points | ( | ) | const |
double TwoTrackMinimumDistanceLineLine::secondAngle | ( | ) | const [inline] |
Definition at line 41 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and points().
Definition at line 41 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and points().
double TwoTrackMinimumDistanceLineLine::pathG [private] |
Definition at line 40 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and pathLength().
double TwoTrackMinimumDistanceLineLine::pathH [private] |
Definition at line 40 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and pathLength().
double TwoTrackMinimumDistanceLineLine::phiG [private] |
Definition at line 39 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and firstAngle().
double TwoTrackMinimumDistanceLineLine::phiH [private] |
Definition at line 39 of file TwoTrackMinimumDistanceLineLine.h.
Referenced by calculate(), and secondAngle().