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 147 of file CRackTrajectoryBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 149 of file CRackTrajectoryBuilder.h.

149  :_tSos(tSos)
150  {};
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 151 of file CRackTrajectoryBuilder.h.

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

153  {
154  GlobalPoint gp1 = rh1.second.globalPosition();
155  GlobalPoint gp2 = rh2.second.globalPosition();
156 
158  GlobalVector gpDiff1 = gp1-gpT;
159  GlobalVector gpDiff2 = gp2-gpT;
160 
161  //this might have a better performance ...
162  // 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() );
163  // 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() );
164  //if ( dist1<dist2 )
165 
166  // if ( gpDiff1.mag2() < gpDiff2.mag2() )
167 
168 
169  float dist1 = gpDiff1 * _tSos.globalDirection();
170  float dist2 = gpDiff2 * _tSos.globalDirection();
171 
172  if (dist1 < 0)
173  return false;
174  if ( dist1<dist2 )
175  return true;
176 
177  return false;
178  };
GlobalPoint globalPosition() const
const TrajectoryStateOnSurface & _tSos
GlobalVector globalDirection() const

Member Data Documentation

const TrajectoryStateOnSurface& CRackTrajectoryBuilder::CompareDetByTraj::_tSos
private

Definition at line 178 of file CRackTrajectoryBuilder.h.

Referenced by operator()().