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.

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 }

References AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and mathSSE::sqrt().

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

◆ cross()

TEveVector FWPFMaths::cross ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 16 of file FWPFMaths.cc.

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 }

Referenced by lineLineIntersect().

◆ dot()

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

Definition at line 29 of file FWPFMaths.cc.

30 {
31  float result = ( v1.fX * v2.fX ) + ( v1.fY * v2.fY ) + ( v1.fZ * v1.fZ );
32 
33  return result;
34 }

References mps_fire::result.

Referenced by lineLineIntersect().

◆ linearInterpolation()

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

Definition at line 91 of file FWPFMaths.cc.

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 }

References p1, and p2.

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

◆ lineCircleIntersect()

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

Definition at line 38 of file FWPFMaths.cc.

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 }

References flavorHistoryFilter_cfi::dr, PVValHelper::dx, PVValHelper::dy, alignCSCRings::r, mps_fire::result, sgn(), and mathSSE::sqrt().

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

◆ lineLineIntersect()

TEveVector FWPFMaths::lineLineIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
const TEveVector &  v3,
const TEveVector &  v4 
)

Definition at line 73 of file FWPFMaths.cc.

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 }

References a, b, c, cross(), dot(), p1, p2, p3, p4, mps_fire::result, alignCSCRings::s, and heppy_batch::val.

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

◆ sgn()

float FWPFMaths::sgn ( float  val)
dot
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
Definition: Basic3DVectorLD.h:212
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
FWPFMaths::sgn
float sgn(float val)
Definition: FWPFMaths.cc:9
alignCSCRings.s
s
Definition: alignCSCRings.py:92
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
h
b
double b
Definition: hdecay.h:118
cross
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Definition: Basic3DVectorLD.h:225
a
double a
Definition: hdecay.h:119
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
p4
double p4[4]
Definition: TauolaWrapper.h:92
p1
double p1[4]
Definition: TauolaWrapper.h:89
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
PVValHelper::dy
Definition: PVValidationHelpers.h:50
alignCSCRings.r
r
Definition: alignCSCRings.py:93
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
heppy_batch.val
val
Definition: heppy_batch.py:351
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
genVertex_cff.x
x
Definition: genVertex_cff.py:13
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
p3
double p3[4]
Definition: TauolaWrapper.h:91
mps_fire.result
result
Definition: mps_fire.py:311
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
PVValHelper::dx
Definition: PVValidationHelpers.h:49
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37