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< double > Point2D
 
typedef PixelRecoRange< float > Range
 
typedef PixelRecoRange< double > RangeD
 
typedef TkRotation2D< double > Rotation
 

Public Member Functions

void init (const GlobalPoint &P1, const GlobalPoint &P2, double ip, double curv)
 
Range operator() (double radius, int charge) const
 
Range rangeRPhi (double radius, int charge) const __attribute__((optimize(3
 
 ThirdHitPredictionFromInvParabola (const GlobalPoint &P1, const GlobalPoint &P2, double ip, double curv, double tolerance)
 

Public Attributes

Range fast math
 

Private Member Functions

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

Private Attributes

double dv
 
double overDu
 
double pv
 
double su
 
RangeD theIpRangeMinus
 
RangeD theIpRangePlus
 
Rotation theRotation
 
double theTolerance
 
double 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.

Constructor & Destructor Documentation

ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( const GlobalPoint P1,
const GlobalPoint P2,
double  ip,
double  curv,
double  tolerance 
)

Definition at line 24 of file ThirdHitPredictionFromInvParabola.cc.

References abs, and init().

26  : theTolerance(torlerance)
27 {
28  init(P1,P2,ip,std::abs(curv));
29 }
#define abs(x)
Definition: mlp_lapack.h:159
void init(const GlobalPoint &P1, const GlobalPoint &P2, double ip, double curv)

Member Function Documentation

double ThirdHitPredictionFromInvParabola::coeffA ( double  impactParameter,
double  charge 
) const
inlineprivate

Definition at line 75 of file ThirdHitPredictionFromInvParabola.h.

References overDu, pv, and u1u2.

Referenced by findPointAtCurve(), and predV().

double ThirdHitPredictionFromInvParabola::coeffB ( double  impactParameter,
double  charge 
) const
inlineprivate

Definition at line 81 of file ThirdHitPredictionFromInvParabola.h.

References dv, overDu, and su.

Referenced by findPointAtCurve(), and predV().

void ThirdHitPredictionFromInvParabola::findPointAtCurve ( double  radius,
double  charge,
double  ip,
double &  u,
double &  v 
) const
inlineprivate

Definition at line 100 of file ThirdHitPredictionFromInvParabola.h.

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

Referenced by rangeRPhi().

102 {
103  //
104  // assume u=(1-alpha^2/2)/r v=alpha/r
105  // solve qudratic equation neglecting aplha^4 term
106  //
107  double A = coeffA(ip,c);
108  double B = coeffB(ip,c);
109 
110  // double overR = 1./r;
111  double ipOverR = ip/r; // *overR;
112 
113  double delta = 1-4*(0.5*B+ipOverR)*(-B+A*r-ipOverR);
114  // double sqrtdelta = (delta > 0) ? std::sqrt(delta) : 0.;
115  double sqrtdelta = std::sqrt(delta);
116  double alpha = (c>0)? (-c+sqrtdelta)/(B+2*ipOverR) : (-c-sqrtdelta)/(B+2*ipOverR);
117 
118  v = alpha; // *overR
119  double d2 = 1. - v*v; // overR*overR - v*v
120  // u = (d2 > 0) ? std::sqrt(d2) : 0.;
121  u = std::sqrt(d2);
122 
123  // u,v not rotated! not multiplied by 1/r
124 }
dbl * delta
Definition: mlp_gen.cc:36
float alpha
Definition: AMPTWrapper.h:95
double coeffA(double impactParameter, double charge) const
double coeffB(double impactParameter, double charge) const
T sqrt(T t)
Definition: SSEVec.h:46
mathSSE::Vec4< T > v
void ThirdHitPredictionFromInvParabola::init ( const GlobalPoint P1,
const GlobalPoint P2,
double  ip,
double  curv 
)

Definition at line 33 of file ThirdHitPredictionFromInvParabola.cc.

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

Referenced by ThirdHitPredictionFromInvParabola().

34 {
35 // GlobalVector aX = GlobalVector( P2.x()-P1.x(), P2.y()-P1.y(), 0.).unit();
36 
37  Point2D p1 = P1.basicVector().xy();
38  Point2D p2 = P2.basicVector().xy();
39  theRotation = Rotation(p1);
40  p1 = transform(p1); // (1./P1.xy().mag(),0);
41  p2 = transform(p2);
42 
43 
44  u1u2 = p1.x()*p2.x();
45  overDu = 1./(p2.x() - p1.x());
46  pv = p1.y()*p2.x() - p2.y()*p1.x();
47  dv = p2.y() - p1.y();
48  su = p2.x() + p1.x();
49 
50  RangeD ipRange(-ip, ip);
51  ipRange.sort();
52 
53  double ipIntyPlus = ipFromCurvature(0.,1);
54  double ipCurvPlus = ipFromCurvature(curv, 1);
55  double ipCurvMinus = ipFromCurvature(curv, -1);
56 
57 
58  RangeD ipRangePlus(ipIntyPlus, ipCurvPlus); ipRangePlus.sort();
59  RangeD ipRangeMinus(-ipIntyPlus, ipCurvMinus); ipRangeMinus.sort();
60 
61  theIpRangePlus = ipRangePlus.intersection(ipRange);
62  theIpRangeMinus = ipRangeMinus.intersection(ipRange);
63 }
Basic2DVector< T > xy() const
double p2[4]
Definition: TauolaWrapper.h:90
T y() const
Cartesian y coordinate.
double ipFromCurvature(double curvature, double charge) const
double p1[4]
Definition: TauolaWrapper.h:89
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
T x() const
Cartesian x coordinate.
double ThirdHitPredictionFromInvParabola::ipFromCurvature ( double  curvature,
double  charge 
) const
inlineprivate

Definition at line 87 of file ThirdHitPredictionFromInvParabola.h.

References overDu, pv, and u1u2.

Referenced by init().

88 {
89  double overU1u2 = 1./u1u2;
90  double inInf = -charge*pv*overDu*overU1u2;
91  return inInf-curvature*overU1u2*0.5;
92 }
double charge(const std::vector< uint8_t > &Ampls)
T curvature(T InversePt, const edm::EventSetup &iSetup)
Range ThirdHitPredictionFromInvParabola::operator() ( double  radius,
int  charge 
) const
inline

Definition at line 39 of file ThirdHitPredictionFromInvParabola.h.

References rangeRPhi().

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

Definition at line 95 of file ThirdHitPredictionFromInvParabola.h.

References coeffA(), and coeffB().

96 {
97  return -charge*( coeffA(ip,charge) - coeffB(ip,charge)*u - ip*u*u);
98 }
double charge(const std::vector< uint8_t > &Ampls)
double coeffA(double impactParameter, double charge) const
double coeffB(double impactParameter, double charge) const
ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( double  radius,
int  charge 
) const

Definition at line 68 of file ThirdHitPredictionFromInvParabola.cc.

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

Referenced by operator()().

69 {
70  double charge = icharge; // will (icharge>0) ? 1. : -1; be faster?
71 
72  RangeD ip = (charge > 0) ? theIpRangePlus : theIpRangeMinus;
73 
74 
75  // it will vectorize with gcc 4.7 (with -O3 -fno-math-errno)
76  double ipv[2]={ip.min(),ip.max()};
77  double u[2], v[2];
78  for (int i=0; i!=2; ++i)
79  findPointAtCurve(radius, charge, ipv[i],u[i],v[i]);
80 
81 
82  double phi1 = theRotation.rotateBack(Point2D(u[0],v[0])).barePhi();
83  double phi2 = phi1+(v[1]-v[0]);
84 
85  if (ip.empty()) {
88  return r1.intersection(r2);
89  }
90 
91  if (phi2<phi1) std::swap(phi1, phi2);
92  return Range(radius*phi1-theTolerance, radius*phi2+theTolerance);
93 
94 }
int i
Definition: DBlmapReader.cc:9
T barePhi() const
T min() const
double charge(const std::vector< uint8_t > &Ampls)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
BasicVector rotateBack(const BasicVector &v) const
mathSSE::Vec4< T > v
void findPointAtCurve(double radius, double charge, double ip, double &u, double &v) const
Point2D ThirdHitPredictionFromInvParabola::transform ( Point2D const &  p) const
inlineprivate

Definition at line 52 of file ThirdHitPredictionFromInvParabola.h.

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

Referenced by init().

52  {
53  return theRotation.rotate(p)/p.mag2();
54  }
BasicVector rotate(const BasicVector &v) const
Point2D ThirdHitPredictionFromInvParabola::transformBack ( Point2D const &  p) const
inlineprivate

Member Data Documentation

double ThirdHitPredictionFromInvParabola::dv
private

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

Range fast ThirdHitPredictionFromInvParabola::math

Definition at line 41 of file ThirdHitPredictionFromInvParabola.h.

double ThirdHitPredictionFromInvParabola::overDu
private

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

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

double ThirdHitPredictionFromInvParabola::pv
private

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

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

double ThirdHitPredictionFromInvParabola::su
private

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

RangeD ThirdHitPredictionFromInvParabola::theIpRangeMinus
private

Definition at line 67 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

RangeD ThirdHitPredictionFromInvParabola::theIpRangePlus
private

Definition at line 67 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

Rotation ThirdHitPredictionFromInvParabola::theRotation
private

Definition at line 62 of file ThirdHitPredictionFromInvParabola.h.

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

double ThirdHitPredictionFromInvParabola::theTolerance
private

Definition at line 68 of file ThirdHitPredictionFromInvParabola.h.

Referenced by rangeRPhi().

double ThirdHitPredictionFromInvParabola::u1u2
private

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

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