CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CRackTrajectoryBuilder::CompareDetByTraj Class Reference

#include <CRackTrajectoryBuilder.h>

Public Member Functions

 CompareDetByTraj (const TSOS &tSos)
 
bool operator() (const std::pair< TrackingRecHitRangeIterator, TSOS > rh1, const std::pair< TrackingRecHitRangeIterator, TSOS > rh2)
 

Private Attributes

const TrajectoryStateOnSurface_tSos
 

Detailed Description

Definition at line 144 of file CRackTrajectoryBuilder.h.

Constructor & Destructor Documentation

CRackTrajectoryBuilder::CompareDetByTraj::CompareDetByTraj ( const TSOS tSos)
inline

Definition at line 146 of file CRackTrajectoryBuilder.h.

146  :_tSos(tSos)
147  {};
const TrajectoryStateOnSurface & _tSos

Member Function Documentation

bool CRackTrajectoryBuilder::CompareDetByTraj::operator() ( const std::pair< TrackingRecHitRangeIterator, TSOS rh1,
const std::pair< TrackingRecHitRangeIterator, TSOS rh2 
)
inline

Definition at line 148 of file CRackTrajectoryBuilder.h.

References _tSos, TrajectoryStateOnSurface::globalDirection(), and TrajectoryStateOnSurface::globalPosition().

150  {
151  GlobalPoint gp1 = rh1.second.globalPosition();
152  GlobalPoint gp2 = rh2.second.globalPosition();
153 
155  GlobalVector gpDiff1 = gp1-gpT;
156  GlobalVector gpDiff2 = gp2-gpT;
157 
158  //this might have a better performance ...
159  // float dist1 = ( gp1.x()-gpT.x() ) * ( gp1.x()-gpT.x() ) + ( gp1.y()-gpT.y() ) * ( gp1.y()-gpT.y() ) + ( gp1.z()-gpT.z() ) * ( gp1.z()-gpT.z() );
160  // float dist2 = ( gp2.x()-gpT.x() ) * ( gp2.x()-gpT.x() ) + ( gp2.y()-gpT.y() ) * ( gp2.y()-gpT.y() ) + ( gp2.z()-gpT.z() ) * ( gp2.z()-gpT.z() );
161  //if ( dist1<dist2 )
162 
163  // if ( gpDiff1.mag2() < gpDiff2.mag2() )
164 
165 
166  float dist1 = gpDiff1 * _tSos.globalDirection();
167  float dist2 = gpDiff2 * _tSos.globalDirection();
168 
169  if (dist1 < 0)
170  return false;
171  if ( dist1<dist2 )
172  return true;
173 
174  return false;
175  };
GlobalPoint globalPosition() const
const TrajectoryStateOnSurface & _tSos
GlobalVector globalDirection() const

Member Data Documentation

const TrajectoryStateOnSurface& CRackTrajectoryBuilder::CompareDetByTraj::_tSos
private

Definition at line 175 of file CRackTrajectoryBuilder.h.

Referenced by operator()().