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 84 of file FWPFMaths.cc.

References h, AlCaHLTBitMon_ParallelJobs::p, and mathSSE::sqrt().

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

84  {
85  float h = sqrt((p.fX * p.fX) + (p.fY * p.fY));
86 
87  if (h >= r)
88  return true;
89 
90  return false;
91  }
T sqrt(T t)
Definition: SSEVec.h:23
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 10 of file FWPFMaths.cc.

Referenced by lineLineIntersect().

10  {
11  TEveVector vec;
12 
13  vec.fX = (v1.fY * v2.fZ) - (v1.fZ * v2.fY);
14  vec.fY = (v1.fZ * v2.fX) - (v1.fX * v2.fZ);
15  vec.fZ = (v1.fX * v2.fY) - (v1.fY * v2.fX);
16 
17  return vec;
18  }

◆ dot()

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

Definition at line 21 of file FWPFMaths.cc.

References mps_fire::result.

Referenced by lineLineIntersect().

21  {
22  float result = (v1.fX * v2.fX) + (v1.fY * v2.fY) + (v1.fZ * v1.fZ);
23 
24  return result;
25  }

◆ linearInterpolation()

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

Definition at line 74 of file FWPFMaths.cc.

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

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

74  {
75  float y;
76 
77  y = ((z - fabs(p1.fZ)) * p2.fY) + ((fabs(p2.fZ) - z) * p1.fY);
78  y /= (fabs(p2.fZ) - fabs(p1.fZ));
79 
80  return y;
81  }

◆ lineCircleIntersect()

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

Definition at line 28 of file FWPFMaths.cc.

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

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

28  {
29  // Definitions
30  float x, y;
31  float dx = v1.fX - v2.fX;
32  float dy = v1.fY - v2.fY;
33  float dr = sqrt((dx * dx) + (dy * dy));
34  float D = ((v2.fX * v1.fY) - (v1.fX * v2.fY));
35 
36  float rtDescrim = sqrt(((r * r) * (dr * dr)) - (D * D));
37 
38  if (dy < 0) // Going down
39  {
40  x = (D * dy) - ((sgn(dy) * dx) * rtDescrim);
41  x /= (dr * dr);
42 
43  y = (-D * dx) - (fabs(dy) * rtDescrim);
44  y /= (dr * dr);
45  } else {
46  x = (D * dy) + ((sgn(dy) * dx) * rtDescrim);
47  x /= (dr * dr);
48 
49  y = (-D * dx) + (fabs(dy) * rtDescrim);
50  y /= (dr * dr);
51  }
52 
53  TEveVector result = TEveVector(x, y, 0.001);
54  return result;
55  }
float sgn(float val)
Definition: FWPFMaths.cc:7
T sqrt(T t)
Definition: SSEVec.h:23
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 58 of file FWPFMaths.cc.

References a, b, DummyCfis::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().

58  {
59  TEveVector a = p2 - p1;
60  TEveVector b = p4 - p3;
61  TEveVector c = p3 - p1;
62  TEveVector result;
63  float s, val;
64 
65  s = dot(cross(c, b), cross(a, b));
66  val = dot(cross(a, b), cross(a, b));
67  s /= val;
68 
69  result = p1 + (a * s);
70  return result;
71  }
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:120
double a
Definition: hdecay.h:121

◆ sgn()

float FWPFMaths::sgn ( float  val)