CMS 3D CMS Logo

Functions

FWPFMaths Namespace Reference

Functions

TEveVector calculateCentre (const float *vertices)
float calculateEt (const TEveVector &centre, float e)
bool checkIntersect (const TEveVector &vec, float r)
TEveVector cross (const TEveVector &v1, const TEveVector &v2)
float dot (const TEveVector &v1, const TEveVector &v2)
float linearInterpolation (const TEveVector &p1, const TEveVector &p2, float r)
TEveVector lineCircleIntersect (const TEveVector &v1, const TEveVector &v2, float r)
TEveVector lineLineIntersect (const TEveVector &v1, const TEveVector &v2, const TEveVector &v3, const TEveVector &v4)
float sgn (float val)

Function Documentation

TEveVector FWPFMaths::calculateCentre ( const float *  vertices)
float FWPFMaths::calculateEt ( const TEveVector &  centre,
float  e 
)
bool FWPFMaths::checkIntersect ( const TEveVector &  vec,
float  r 
)

Definition at line 103 of file FWPFMaths.cc.

References h, and mathSSE::sqrt().

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   float h = sqrt( ( p.fX * p.fX ) + ( p.fY * p.fY ) );
   
   if( h >= r )
      return true;

   return false;
}
TEveVector FWPFMaths::cross ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 16 of file FWPFMaths.cc.

Referenced by lineLineIntersect().

{
   TEveVector vec;

   vec.fX = ( v1.fY * v2.fZ ) - ( v1.fZ * v2.fY );
   vec.fY = ( v1.fZ * v2.fX ) - ( v1.fX * v2.fZ );
   vec.fZ = ( v1.fX * v2.fY ) - ( v1.fY * v2.fX );

   return vec;
}
float FWPFMaths::dot ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 29 of file FWPFMaths.cc.

References query::result.

Referenced by lineLineIntersect().

{
   float result = ( v1.fX * v2.fX ) + ( v1.fY * v2.fY ) + ( v1.fZ * v1.fZ );

   return result;
}
float FWPFMaths::linearInterpolation ( const TEveVector &  p1,
const TEveVector &  p2,
float  r 
)

Definition at line 91 of file FWPFMaths.cc.

References detailsBasic3DVector::y, and z.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   float y;

   y = ( ( z - fabs( p1.fZ ) ) * p2.fY ) + ( ( fabs( p2.fZ ) - z ) * p1.fY );
   y /= ( fabs( p2.fZ) - fabs( p1.fZ ) );

   return y;
}
TEveVector FWPFMaths::lineCircleIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
float  r 
)

Definition at line 38 of file FWPFMaths.cc.

References funct::D, query::result, sgn(), mathSSE::sqrt(), x, and detailsBasic3DVector::y.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   // Definitions
   float x, y;
   float dx = v1.fX - v2.fX;
   float dy = v1.fY - v2.fY;
   float dr = sqrt( ( dx * dx ) + ( dy * dy ) );
   float D = ( ( v2.fX * v1.fY ) - ( v1.fX * v2.fY ) );

   float rtDescrim = sqrt( ( ( r * r ) * ( dr * dr ) ) - ( D * D ) );

   if( dy < 0 )   // Going down
   {
      x = ( D * dy ) - ( ( sgn(dy) * dx ) * rtDescrim );
      x /= ( dr * dr );

      y = ( -D * dx ) - ( fabs( dy ) * rtDescrim );
      y /= ( dr * dr );
   }
   else
   {

      x = ( D * dy ) + ( ( sgn(dy) * dx ) * rtDescrim );
      x /= ( dr * dr );

      y = ( -D * dx ) + ( fabs( dy ) * rtDescrim );
      y /= ( dr * dr );
   }

   TEveVector result = TEveVector( x, y, 0.001 );
   return result;
}
TEveVector FWPFMaths::lineLineIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
const TEveVector &  v3,
const TEveVector &  v4 
)

Definition at line 73 of file FWPFMaths.cc.

References a, b, trackerHits::c, cross(), dot(), p1, p3, query::result, and alignCSCRings::s.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   TEveVector a = p2 - p1;
   TEveVector b = p4 - p3;
   TEveVector c = p3 - p1;
   TEveVector result;
   float s, val;

   s = dot( cross( c, b ), cross( a, b ) );  
   val = dot( cross( a, b ), cross( a, b ) );
   s /= val;
   
   result = p1 + ( a * s );
   return result; 
}
float FWPFMaths::sgn ( float  val)