CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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().

104 {
105  float h = sqrt( ( p.fX * p.fX ) + ( p.fY * p.fY ) );
106 
107  if( h >= r )
108  return true;
109 
110  return false;
111 }
T sqrt(T t)
Definition: SSEVec.h:48
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
TEveVector FWPFMaths::cross ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 16 of file FWPFMaths.cc.

Referenced by lineLineIntersect().

17 {
18  TEveVector vec;
19 
20  vec.fX = ( v1.fY * v2.fZ ) - ( v1.fZ * v2.fY );
21  vec.fY = ( v1.fZ * v2.fX ) - ( v1.fX * v2.fZ );
22  vec.fZ = ( v1.fX * v2.fY ) - ( v1.fY * v2.fX );
23 
24  return vec;
25 }
float FWPFMaths::dot ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 29 of file FWPFMaths.cc.

References query::result.

Referenced by lineLineIntersect().

30 {
31  float result = ( v1.fX * v2.fX ) + ( v1.fY * v2.fY ) + ( v1.fZ * v1.fZ );
32 
33  return result;
34 }
tuple result
Definition: query.py:137
float FWPFMaths::linearInterpolation ( const TEveVector &  p1,
const TEveVector &  p2,
float  r 
)

Definition at line 91 of file FWPFMaths.cc.

References detailsBasic3DVector::y, and detailsBasic3DVector::z.

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

92 {
93  float y;
94 
95  y = ( ( z - fabs( p1.fZ ) ) * p2.fY ) + ( ( fabs( p2.fZ ) - z ) * p1.fY );
96  y /= ( fabs( p2.fZ) - fabs( p1.fZ ) );
97 
98  return y;
99 }
float float float z
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
TEveVector FWPFMaths::lineCircleIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
float  r 
)

Definition at line 38 of file FWPFMaths.cc.

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

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

39 {
40  // Definitions
41  float x, y;
42  float dx = v1.fX - v2.fX;
43  float dy = v1.fY - v2.fY;
44  float dr = sqrt( ( dx * dx ) + ( dy * dy ) );
45  float D = ( ( v2.fX * v1.fY ) - ( v1.fX * v2.fY ) );
46 
47  float rtDescrim = sqrt( ( ( r * r ) * ( dr * dr ) ) - ( D * D ) );
48 
49  if( dy < 0 ) // Going down
50  {
51  x = ( D * dy ) - ( ( sgn(dy) * dx ) * rtDescrim );
52  x /= ( dr * dr );
53 
54  y = ( -D * dx ) - ( fabs( dy ) * rtDescrim );
55  y /= ( dr * dr );
56  }
57  else
58  {
59 
60  x = ( D * dy ) + ( ( sgn(dy) * dx ) * rtDescrim );
61  x /= ( dr * dr );
62 
63  y = ( -D * dx ) + ( fabs( dy ) * rtDescrim );
64  y /= ( dr * dr );
65  }
66 
67  TEveVector result = TEveVector( x, y, 0.001 );
68  return result;
69 }
float sgn(float val)
Definition: FWPFMaths.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
Definition: DDAxes.h:10
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, EnergyCorrector::c, cross(), dot(), p1, p3, query::result, and alignCSCRings::s.

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

74 {
75  TEveVector a = p2 - p1;
76  TEveVector b = p4 - p3;
77  TEveVector c = p3 - p1;
78  TEveVector result;
79  float s, val;
80 
81  s = dot( cross( c, b ), cross( a, b ) );
82  val = dot( cross( a, b ), cross( a, b ) );
83  s /= val;
84 
85  result = p1 + ( a * s );
86  return result;
87 }
double p4[4]
Definition: TauolaWrapper.h:92
tuple result
Definition: query.py:137
double p2[4]
Definition: TauolaWrapper.h:90
double b
Definition: hdecay.h:120
double p1[4]
Definition: TauolaWrapper.h:89
T dot(const Basic3DVector &v) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.
double a
Definition: hdecay.h:121
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or &quot;cross&quot; product, with a vector of same type.
double p3[4]
Definition: TauolaWrapper.h:91
float FWPFMaths::sgn ( float  val)