CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
ThirdHitPredictionFromInvParabola Class Reference

#include <ThirdHitPredictionFromInvParabola.h>

Public Types

typedef Basic2DVector< ScalarPoint2D
 
typedef PixelRecoRange< float > Range
 
typedef PixelRecoRange< ScalarRangeD
 
typedef TkRotation2D< ScalarRotation
 
using Scalar = double
 

Public Member Functions

void init (const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)
 
void init (Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv)
 
Range operator() (Scalar radius, int charge) const
 
Range rangeRPhi (Scalar radius, int charge) const __attribute__((optimize(3
 
 ThirdHitPredictionFromInvParabola ()
 
 ThirdHitPredictionFromInvParabola (Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv, Scalar tolerance)
 
 ThirdHitPredictionFromInvParabola (const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv, Scalar tolerance)
 

Public Attributes

Range fast math
 

Private Member Functions

Scalar coeffA (Scalar impactParameter) const
 
Scalar coeffB (Scalar impactParameter) const
 
void findPointAtCurve (Scalar radius, Scalar ip, Scalar &u, Scalar &v) const
 
Scalar ipFromCurvature (Scalar curvature, bool pos) const
 
Scalar predV (Scalar u, Scalar ip) const
 
Point2D transform (Point2D const &p) const
 
Point2D transformBack (Point2D const &p) const
 

Private Attributes

Scalar dv
 
Scalar overDu
 
Scalar pv
 
Scalar su
 
RangeD theIpRangeMinus
 
RangeD theIpRangePlus
 
Rotation theRotation
 
Scalar theTolerance
 
Scalar u1u2
 

Detailed Description

Definition at line 25 of file ThirdHitPredictionFromInvParabola.h.

Member Typedef Documentation

Definition at line 32 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 30 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 31 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 29 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 28 of file ThirdHitPredictionFromInvParabola.h.

Constructor & Destructor Documentation

ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( )
inline

Definition at line 35 of file ThirdHitPredictionFromInvParabola.h.

35 {}
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( Scalar  x1,
Scalar  y1,
Scalar  x2,
Scalar  y2,
Scalar  ip,
Scalar  curv,
Scalar  tolerance 
)
inline

Definition at line 36 of file ThirdHitPredictionFromInvParabola.h.

References abs, and init().

37  : theTolerance(tolerance)
38  {
39  init(x1,y1,x2,y2,ip,std::abs(curv));
40  }
#define abs(x)
Definition: mlp_lapack.h:159
void init(const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( const GlobalPoint P1,
const GlobalPoint P2,
Scalar  ip,
Scalar  curv,
Scalar  tolerance 
)

Definition at line 20 of file ThirdHitPredictionFromInvParabola.cc.

References abs, and init().

22  : theTolerance(tolerance)
23 {
24  init(P1,P2,ip,std::abs(curv));
25 }
#define abs(x)
Definition: mlp_lapack.h:159
void init(const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)

Member Function Documentation

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffA ( Scalar  impactParameter) const
inlineprivate
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffB ( Scalar  impactParameter) const
inlineprivate
void ThirdHitPredictionFromInvParabola::findPointAtCurve ( Scalar  radius,
Scalar  ip,
Scalar u,
Scalar v 
) const
inlineprivate

Definition at line 117 of file ThirdHitPredictionFromInvParabola.h.

References funct::A, a, alpha, trackerHits::c, coeffA(), coeffB(), delta, alignCSCRings::r, mathSSE::sqrt(), and findQualityFiles::v.

Referenced by rangeRPhi().

119 {
120  //
121  // assume u=(1-alpha^2/2)/r v=alpha/r
122  // solve qudratic equation neglecting aplha^4 term
123  //
124  Scalar A = coeffA(ip);
125  Scalar B = coeffB(ip);
126 
127  // Scalar overR = 1./r;
128  Scalar ipOverR = ip/r; // *overR;
129 
130  Scalar a = 0.5*B+ipOverR;
131  Scalar c = -B+A*r-ipOverR;
132 
133  Scalar delta = 1-4*a*c;
134  // Scalar sqrtdelta = (delta > 0) ? std::sqrt(delta) : 0.;
135  Scalar sqrtdelta = std::sqrt(delta);
136  // Scalar alpha = (-1+sqrtdelta)/(2*a);
137  Scalar alpha = (-2*c)/(1+sqrtdelta);
138 
139  v = alpha; // *overR
140  Scalar d2 = 1. - v*v; // overR*overR - v*v
141  // u = (d2 > 0) ? std::sqrt(d2) : 0.;
142  u = std::sqrt(d2);
143 
144  // u,v not rotated! not multiplied by 1/r
145 }
Scalar coeffA(Scalar impactParameter) const
dbl * delta
Definition: mlp_gen.cc:36
float alpha
Definition: AMPTWrapper.h:95
T sqrt(T t)
Definition: SSEVec.h:48
Scalar coeffB(Scalar impactParameter) const
double a
Definition: hdecay.h:121
void ThirdHitPredictionFromInvParabola::init ( const GlobalPoint P1,
const GlobalPoint P2,
Scalar  ip,
Scalar  curv 
)
inline

Definition at line 51 of file ThirdHitPredictionFromInvParabola.h.

References PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by ThirdHitPredictionFromInvParabola().

51  {
52  init( P1.x(), P1.y(), P2.x(),P2.y(),ip,curv);
53  }
T y() const
Definition: PV3DBase.h:63
void init(const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)
T x() const
Definition: PV3DBase.h:62
void ThirdHitPredictionFromInvParabola::init ( Scalar  x1,
Scalar  y1,
Scalar  x2,
Scalar  y2,
Scalar  ip,
Scalar  curv 
)

Definition at line 28 of file ThirdHitPredictionFromInvParabola.cc.

References dv, PixelRecoRange< T >::intersection(), ipFromCurvature(), overDu, p1, p2, pv, PixelRecoRange< T >::sort(), su, theIpRangeMinus, theIpRangePlus, theRotation, transform(), u1u2, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

28  {
29 // GlobalVector aX = GlobalVector( P2.x()-P1.x(), P2.y()-P1.y(), 0.).unit();
30 
31  Point2D p1(x1,y1);
32  Point2D p2(x2,y2);
34  p1 = transform(p1); // (1./P1.xy().mag(),0);
35  p2 = transform(p2);
36 
37 
38  u1u2 = p1.x()*p2.x();
39  overDu = 1./(p2.x() - p1.x());
40  pv = p1.y()*p2.x() - p2.y()*p1.x();
41  dv = p2.y() - p1.y();
42  su = p2.x() + p1.x();
43 
44  RangeD ipRange(-ip, ip);
45  ipRange.sort();
46 
47  Scalar ipIntyPlus = ipFromCurvature(0.,true);
48  Scalar ipCurvPlus = ipFromCurvature(curv, true);
49  Scalar ipCurvMinus = ipFromCurvature(curv, false);
50 
51 
52  RangeD ipRangePlus(ipIntyPlus, ipCurvPlus); ipRangePlus.sort();
53  RangeD ipRangeMinus(-ipIntyPlus, ipCurvMinus); ipRangeMinus.sort();
54 
55  theIpRangePlus = ipRangePlus.intersection(ipRange);
56  theIpRangeMinus = ipRangeMinus.intersection(ipRange);
57 }
double p2[4]
Definition: TauolaWrapper.h:90
Scalar ipFromCurvature(Scalar curvature, bool pos) const
double p1[4]
Definition: TauolaWrapper.h:89
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::ipFromCurvature ( Scalar  curvature,
bool  pos 
) const
inlineprivate

Definition at line 101 of file ThirdHitPredictionFromInvParabola.h.

References overDu, pv, and u1u2.

Referenced by init().

102 {
103  Scalar overU1u2 = 1./u1u2;
104  Scalar inInf = -pv*overDu*overU1u2;
105  return (pos? inInf : -inInf) -curvature*overU1u2*0.5;
106 }
T curvature(T InversePt, const edm::EventSetup &iSetup)
Range ThirdHitPredictionFromInvParabola::operator() ( Scalar  radius,
int  charge 
) const
inline

Definition at line 46 of file ThirdHitPredictionFromInvParabola.h.

References rangeRPhi().

46 { return rangeRPhi(radius,charge); }
double charge(const std::vector< uint8_t > &Ampls)
Range rangeRPhi(Scalar radius, int charge) const __attribute__((optimize(3
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::predV ( Scalar  u,
Scalar  ip 
) const
inlineprivate

Definition at line 110 of file ThirdHitPredictionFromInvParabola.h.

References trackerHits::c, coeffA(), and coeffB().

111 {
112  auto c = -( coeffA(ip) - coeffB(ip*u) - ip*u*u);
113  return c;
114 }
Scalar coeffA(Scalar impactParameter) const
Scalar coeffB(Scalar impactParameter) const
ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( Scalar  radius,
int  charge 
) const

Definition at line 62 of file ThirdHitPredictionFromInvParabola.cc.

References Basic2DVector< T >::barePhi(), PixelRecoRange< T >::empty(), findPointAtCurve(), i, PixelRecoRange< T >::intersection(), PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), pos, diffTwoXMLs::r1, diffTwoXMLs::r2, TkRotation2D< T >::rotateBack(), std::swap(), theIpRangeMinus, theIpRangePlus, theRotation, theTolerance, and findQualityFiles::v.

Referenced by operator()().

63 {
64  bool pos = icharge>0;
65 
67 
68 
69  // it will vectorize with gcc 4.7 (with -O3 -fno-math-errno)
70  // change sign as intersect assume -ip for negative charge...
71  Scalar ipv[2]={(pos)? ip.min() : -ip.min() ,(pos)? ip.max() : -ip.max()};
72  Scalar u[2], v[2];
73  for (int i=0; i!=2; ++i)
74  findPointAtCurve(radius,ipv[i],u[i],v[i]);
75 
76  //
77  Scalar phi1 = theRotation.rotateBack(Point2D(u[0],v[0])).barePhi();
78  Scalar phi2 = phi1+(v[1]-v[0]);
79 
80  if (ip.empty()) {
83  return r1.intersection(r2);
84  }
85 
86  if (phi2<phi1) std::swap(phi1, phi2);
87  return Range(radius*phi1-theTolerance, radius*phi2+theTolerance);
88 
89 }
int i
Definition: DBlmapReader.cc:9
T barePhi() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void findPointAtCurve(Scalar radius, Scalar ip, Scalar &u, Scalar &v) const
BasicVector rotateBack(const BasicVector &v) const
Point2D ThirdHitPredictionFromInvParabola::transform ( Point2D const &  p) const
inlineprivate

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

References Basic2DVector< T >::mag2(), TkRotation2D< T >::rotate(), and theRotation.

Referenced by init().

63  {
64  return theRotation.rotate(p)/p.mag2();
65  }
BasicVector rotate(const BasicVector &v) const
Point2D ThirdHitPredictionFromInvParabola::transformBack ( Point2D const &  p) const
inlineprivate

Member Data Documentation

Scalar ThirdHitPredictionFromInvParabola::dv
private

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

Range fast ThirdHitPredictionFromInvParabola::math

Definition at line 48 of file ThirdHitPredictionFromInvParabola.h.

Scalar ThirdHitPredictionFromInvParabola::overDu
private

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), coeffB(), init(), and ipFromCurvature().

Scalar ThirdHitPredictionFromInvParabola::pv
private

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), init(), and ipFromCurvature().

Scalar ThirdHitPredictionFromInvParabola::su
private

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

RangeD ThirdHitPredictionFromInvParabola::theIpRangeMinus
private

Definition at line 79 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

RangeD ThirdHitPredictionFromInvParabola::theIpRangePlus
private

Definition at line 79 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

Rotation ThirdHitPredictionFromInvParabola::theRotation
private

Definition at line 73 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), rangeRPhi(), transform(), and transformBack().

Scalar ThirdHitPredictionFromInvParabola::theTolerance
private

Definition at line 80 of file ThirdHitPredictionFromInvParabola.h.

Referenced by rangeRPhi().

Scalar ThirdHitPredictionFromInvParabola::u1u2
private

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), init(), and ipFromCurvature().