12 return GlobalPoint(0.5 * (
pr.first.basicVector() +
pr.second.basicVector()));
15 inline double dist(pair<GlobalPoint, GlobalPoint>
pr) {
return (
pr.first -
pr.second).mag(); }
21 "TrackingTools/PatternTools",
22 "TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
25 return theTTMDhh.firstAngle();
28 return theTTMDhl.firstAngle();
31 return theTTMDll.firstAngle();
40 "TrackingTools/PatternTools",
41 "TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
44 return theTTMDhh.secondAngle();
47 return theTTMDhl.secondAngle();
50 return theTTMDll.secondAngle();
59 "TrackingTools/PatternTools",
60 "TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
63 return theTTMDhh.pathLength();
66 return theTTMDhl.pathLength();
69 return theTTMDll.pathLength();
72 return std::pair<double, double>(0, 0);
78 "TrackingTools/PatternTools",
79 "TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
95 if (!isHelixA && !isHelixB) {
96 status_ = pointsLineLine(sta, stb);
97 }
else if (isHelixA && isHelixB) {
98 status_ = pointsHelixHelix(sta, stb);
100 status_ = pointsHelixLine(sta, stb);
108 if (theTTMDll.calculate(sta, stb))
110 points_ = theTTMDll.points();
117 if (theTTMDhl.calculate(sta, stb, 0.000001))
119 points_ = theTTMDhl.points();
127 edm::LogWarning(
"TwoTrackMinimumDistance") <<
"comparing track with itself!";
131 if (theModus == FastMode) {
133 if (!(theTTMDhh.calculate(sta, stb, .0001))) {
134 points_ = theTTMDhh.points();
140 bool cairStat = theIniAlgo.calculate(sta, stb);
143 edm::LogWarning(
"TwoTrackMinimumDistance") <<
"Computation HelixHelix::CAIR failed.";
144 if (theModus == SlowMode) {
145 if (!(theTTMDhh.calculate(sta, stb, .0001))) {
146 points_ = theTTMDhh.points();
151 if (!(theTTMDhh.calculate(sta, stb, .1))) {
152 points_ = theTTMDhh.points();
156 edm::LogWarning(
"TwoTrackMinimumDistance") <<
"TwoTrackMinimumDistanceHelixHelix failed";
159 pair<GlobalTrajectoryParameters, GlobalTrajectoryParameters> ini = theIniAlgo.trajectoryParameters();
161 pair<GlobalPoint, GlobalPoint> inip(ini.first.position(), ini.second.position());
162 bool isFirstALine = ini.first.charge() == 0. || ini.first.magneticField().inTesla(ini.first.position()).z() == 0.;
163 bool isSecondALine = ini.second.charge() == 0. || ini.second.magneticField().inTesla(ini.second.position()).z() == 0.;
164 bool gotDist =
false;
165 if (!isFirstALine && !isSecondALine)
166 gotDist = theTTMDhh.calculate(ini.first, ini.second, .0001);
167 else if (isFirstALine && isSecondALine)
168 gotDist = theTTMDll.calculate(ini.first, ini.second);
170 gotDist = theTTMDhl.calculate(ini.first, ini.second, .0001);
174 if (!isFirstALine && !isSecondALine)
175 points_ = theTTMDhh.points();
176 else if (isFirstALine && isSecondALine)
177 points_ = theTTMDll.points();
179 points_ = theTTMDhl.points();
181 if (dist(points_) > dist(inip))
GlobalPoint position() const
double firstAngle() const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const GlobalTrajectoryParameters & globalParameters() const
Global3DPoint GlobalPoint
GlobalPoint crossingPoint() const override
TrackCharge charge() const
const GlobalTrajectoryParameters & parameters() const
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
GlobalVector momentum() const
bool pointsHelixLine(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)
std::pair< GlobalPoint, GlobalPoint > points() const override
bool pointsLineLine(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
const MagneticField & magneticField() const
std::pair< double, double > pathLength() const
double secondAngle() const
float distance() const override
Log< level::Warning, false > LogWarning
bool pointsHelixHelix(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)