12 return GlobalPoint ( 0.5*(pr.first.basicVector() + pr.second.basicVector()) );
15 inline double dist ( pair<GlobalPoint, GlobalPoint> pr ) {
16 return ( pr.first - pr.second ).mag();
23 throw cms::Exception(
"TrackingTools/PatternTools",
"TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
24 switch ( theCharge ) {
25 case (hh):
return theTTMDhh.firstAngle();
break;
26 case (hl):
return theTTMDhl.firstAngle();
break;
27 case (ll):
return theTTMDll.firstAngle();
break;
35 throw cms::Exception(
"TrackingTools/PatternTools",
"TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
36 switch ( theCharge ) {
37 case (hh):
return theTTMDhh.secondAngle();
break;
38 case (hl):
return theTTMDhl.secondAngle();
break;
39 case (ll):
return theTTMDll.secondAngle();
break;
48 throw cms::Exception(
"TrackingTools/PatternTools",
"TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
49 switch ( theCharge ) {
50 case (hh):
return theTTMDhh.pathLength();
break;
51 case (hl):
return theTTMDhl.pathLength();
break;
52 case (ll):
return theTTMDll.pathLength();
break;
54 return std::pair<double,double>(0,0);
60 throw cms::Exception(
"TrackingTools/PatternTools",
"TwoTrackMinimumDistance::could not compute track crossing. Check status before calling this method!");
88 if (! isHelixA && ! isHelixB) {
89 status_ = pointsLineLine(sta, stb);
90 }
else if ( isHelixA && isHelixB ) {
91 status_ = pointsHelixHelix(sta, stb);
93 status_ = pointsHelixLine(sta, stb);
103 if (theTTMDll.calculate(sta, stb))
return false;
104 points_ = theTTMDll.points();
113 if (theTTMDhl.calculate(sta, stb, 0.000001))
return false;
114 points_ = theTTMDhl.points();
127 edm::LogWarning (
"TwoTrackMinimumDistance") <<
"comparing track with itself!";
131 if ( theModus == FastMode )
134 if ( !(theTTMDhh.calculate ( sta, stb, .0001 )) )
136 points_ = theTTMDhh.points();
142 bool cairStat = theIniAlgo.calculate ( sta, stb );
145 edm::LogWarning (
"TwoTrackMinimumDistance" ) <<
"Computation HelixHelix::CAIR failed.";
146 if ( theModus == SlowMode ) {
147 if ( !(theTTMDhh.calculate ( sta, stb, .0001 )) ) {
148 points_ = theTTMDhh.points();
153 if ( !(theTTMDhh.calculate ( sta, stb, .1 )) ) {
154 points_ = theTTMDhh.points();
158 edm::LogWarning (
"TwoTrackMinimumDistance" ) <<
"TwoTrackMinimumDistanceHelixHelix failed";
161 pair<GlobalTrajectoryParameters, GlobalTrajectoryParameters >
162 ini = theIniAlgo.trajectoryParameters();
164 pair<GlobalPoint, GlobalPoint> inip ( ini.first.position(),
165 ini.second.position() );
166 bool isFirstALine = ini.first.charge() == 0. || ini.first.magneticField().inTesla(ini.first.position()).z() == 0.;
167 bool isSecondALine = ini.second.charge() == 0. || ini.second.magneticField().inTesla(ini.second.position()).z() == 0.;
168 bool gotDist =
false;
169 if (!isFirstALine && !isSecondALine) gotDist = theTTMDhh.calculate ( ini.first, ini.second, .0001 );
170 else if ( isFirstALine && isSecondALine) gotDist = theTTMDll.calculate ( ini.first, ini.second );
171 else gotDist = theTTMDhl.calculate ( ini.first, ini.second, .0001 );
175 if (!isFirstALine && !isSecondALine) points_ = theTTMDhh.points ();
176 else if ( isFirstALine && isSecondALine) points_ = theTTMDll.points ();
177 else points_ = theTTMDhl.points ();
179 if ( dist ( points_ ) > dist ( inip ) ) points_ = inip;
187 return mean ( points_ );
193 return dist ( points_ );
virtual float distance() const
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
const GlobalTrajectoryParameters & parameters() const
virtual GlobalPoint crossingPoint() const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
bool pointsHelixLine(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)
GlobalVector momentum() const
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double firstAngle() const
double secondAngle() const
bool pointsLineLine(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)
GlobalPoint position() const
const GlobalTrajectoryParameters & globalParameters() const
std::pair< double, double > pathLength() const
const MagneticField & magneticField() const
TrackCharge charge() const
virtual std::pair< GlobalPoint, GlobalPoint > points() const
bool pointsHelixHelix(const GlobalTrajectoryParameters &sta, const GlobalTrajectoryParameters &stb)