CMS 3D CMS Logo

Public Member Functions

DistanceOfVertices2D Class Reference

#include <DistanceOfVertices2D.h>

Inheritance diagram for DistanceOfVertices2D:
DistanceOfVertices

List of all members.

Public Member Functions

virtual Measurement1D distance (const TransientVertex &, const TransientVertex &)
 DistanceOfVertices2D ()
virtual Measurement1D signedDistance (const TransientVertex &, const TransientVertex &, const CLHEP::Hep3Vector &)
virtual ~DistanceOfVertices2D ()

Detailed Description

Definition at line 9 of file DistanceOfVertices2D.h.


Constructor & Destructor Documentation

DistanceOfVertices2D::DistanceOfVertices2D ( ) [inline]

Definition at line 13 of file DistanceOfVertices2D.h.

{}
virtual DistanceOfVertices2D::~DistanceOfVertices2D ( ) [inline, virtual]

Definition at line 14 of file DistanceOfVertices2D.h.

{}

Member Function Documentation

Measurement1D DistanceOfVertices2D::distance ( const TransientVertex v1,
const TransientVertex v2 
) [virtual]

Implements DistanceOfVertices.

Definition at line 4 of file DistanceOfVertices2D.cc.

References gather_cfg::cout, DistanceOfVertices::deltaV2V1(), mathSSE::sqrt(), and DistanceOfVertices::terms2D().

Referenced by Flight2DSvFilter::operator()(), and signedDistance().

                                                                                                       {
  
  double FlightDistance2D = deltaV2V1(v1,v2).perp() ; 
  
  // for the significances, we need the error on the difference:
  // => take into account the full correlation matrices of both vertices
  //    (but neglect correl. between them, they are not easily available)
  
  double sigmaFlightDistance2D2;
  if(  FlightDistance2D > 0.000001 )
    sigmaFlightDistance2D2 = ( 1 / ( FlightDistance2D*FlightDistance2D ) ) * terms2D ( v1 , v2 ) ; 
  else
    sigmaFlightDistance2D2 = 0.0;
  
  double sigmaFlightDistance2D ;
  if ( sigmaFlightDistance2D2 >= 0 ) {
    sigmaFlightDistance2D = sqrt ( sigmaFlightDistance2D2 ) ;
  }
  else {
    std::cout << "DistanceOfVertices2D::distance : sigmaFlightDistance2D2 <= 0 : " << sigmaFlightDistance2D2 << std::endl ;
    sigmaFlightDistance2D = 0.0 ;
  }

  return Measurement1D ( FlightDistance2D , sigmaFlightDistance2D ) ;
}
Measurement1D DistanceOfVertices2D::signedDistance ( const TransientVertex v1,
const TransientVertex v2,
const CLHEP::Hep3Vector &  direction 
) [virtual]

Implements DistanceOfVertices.

Definition at line 31 of file DistanceOfVertices2D.cc.

References DistanceOfVertices::deltaV2V1(), distance(), Measurement1D::error(), and Measurement1D::value().

                                                                                                                                                 {
  // give a sign to the distance of Vertices v1 and v2:
  // + if (v2-v1) is along direction, - if in opposite direction
  
  CLHEP::Hep3Vector v1ToV2 = deltaV2V1 ( v1, v2 ) ;
  int sign2d = -1 ;
  if ( ( direction.x()*v1ToV2.x() + direction.y()*v1ToV2.y() ) > 0 )  sign2d = 1 ;
  
  Measurement1D unsignedFlightDistance = distance ( v1 , v2 ) ;

  return Measurement1D ( sign2d * unsignedFlightDistance.value() , unsignedFlightDistance.error() ) ; 
}