CMS 3D CMS Logo

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

Constructor & Destructor Documentation

◆ CompareDetByTraj()

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

Definition at line 142 of file CRackTrajectoryBuilder.h.

142 : _tSos(tSos){};

Member Function Documentation

◆ operator()()

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

Definition at line 143 of file CRackTrajectoryBuilder.h.

144  {
145  GlobalPoint gp1 = rh1.second.globalPosition();
146  GlobalPoint gp2 = rh2.second.globalPosition();
147 
149  GlobalVector gpDiff1 = gp1 - gpT;
150  GlobalVector gpDiff2 = gp2 - gpT;
151 
152  //this might have a better performance ...
153  // 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() );
154  // 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() );
155  //if ( dist1<dist2 )
156 
157  // if ( gpDiff1.mag2() < gpDiff2.mag2() )
158 
159  float dist1 = gpDiff1 * _tSos.globalDirection();
160  float dist2 = gpDiff2 * _tSos.globalDirection();
161 
162  if (dist1 < 0)
163  return false;
164  if (dist1 < dist2)
165  return true;
166 
167  return false;
168  };

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

Member Data Documentation

◆ _tSos

const TrajectoryStateOnSurface& CRackTrajectoryBuilder::CompareDetByTraj::_tSos
private

Definition at line 168 of file CRackTrajectoryBuilder.h.

Referenced by operator()().

Vector3DBase
Definition: Vector3DBase.h:8
TrajectoryStateOnSurface::globalDirection
GlobalVector globalDirection() const
Definition: TrajectoryStateOnSurface.h:67
CRackTrajectoryBuilder::CompareDetByTraj::_tSos
const TrajectoryStateOnSurface & _tSos
Definition: CRackTrajectoryBuilder.h:168
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
Point3DBase< float, GlobalTag >