CMS 3D CMS Logo

Public Member Functions | Private Attributes

CRackTrajectoryBuilder::CompareDetByTraj Class Reference

#include <CRackTrajectoryBuilder.h>

List of all members.

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.

                                       :_tSos(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().

    {
      GlobalPoint gp1 =  rh1.second.globalPosition();
      GlobalPoint gp2 =  rh2.second.globalPosition();

      GlobalPoint gpT = _tSos.globalPosition();
      GlobalVector gpDiff1 = gp1-gpT;
      GlobalVector gpDiff2 = gp2-gpT;

     //this might have a better performance ...
     //       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() );
     //       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() );
     //if ( dist1<dist2 )

     //     if ( gpDiff1.mag2() < gpDiff2.mag2() )
     

     float dist1 = gpDiff1 * _tSos.globalDirection();
     float dist2 = gpDiff2 * _tSos.globalDirection();

     if (dist1 < 0)
       return false;
     if ( dist1<dist2 )
       return true;
     
     return false;
   };

Member Data Documentation

Definition at line 178 of file CRackTrajectoryBuilder.h.

Referenced by operator()().