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

◆ calculateCentre()

TEveVector FWPFMaths::calculateCentre ( const float *  vertices)

◆ calculateEt()

float FWPFMaths::calculateEt ( const TEveVector &  centre,
float  e 
)

◆ checkIntersect()

bool FWPFMaths::checkIntersect ( const TEveVector &  vec,
float  r 
)

Definition at line 103 of file FWPFMaths.cc.

References h, AlCaHLTBitMon_ParallelJobs::p, 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:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ cross()

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 }

◆ dot()

float FWPFMaths::dot ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 29 of file FWPFMaths.cc.

References mps_fire::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 }

◆ linearInterpolation()

float FWPFMaths::linearInterpolation ( const TEveVector &  p1,
const TEveVector &  p2,
float  r 
)

Definition at line 91 of file FWPFMaths.cc.

References LaserDQM_cfg::p1, and SiStripOfflineCRack_cfg::p2.

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

◆ lineCircleIntersect()

TEveVector FWPFMaths::lineCircleIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
float  r 
)

Definition at line 38 of file FWPFMaths.cc.

References PVValHelper::dx, PVValHelper::dy, mps_fire::result, sgn(), mathSSE::sqrt(), and x.

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:19
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
float x

◆ lineLineIntersect()

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, c, cross(), dot(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, mps_fire::result, alignCSCRings::s, and heppy_batch::val.

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 }
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ sgn()

float FWPFMaths::sgn ( float  val)