CMS 3D CMS Logo

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

#include <ThirdHitPredictionFromInvParabola.h>

Classes

class  MappedPoint
 

Public Types

typedef PixelRecoRange< float > Range
 
typedef TkRotation< 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
 
Range rangeRPhiSlow (double radius, int charge, int nIter=5) const
 
 ThirdHitPredictionFromInvParabola (const GlobalPoint &P1, const GlobalPoint &P2, double ip, double curv, double tolerance)
 

Private Types

typedef MappedPoint< double > PointUV
 

Private Member Functions

double coeffA (double impactParameter, int charge) const
 
double coeffB (double impactParameter, int charge) const
 
PointUV findPointAtCurve (double radius, int charge, double ip) const
 
double ipFromCurvature (double curvature, int charge) const
 
double predV (double u, double ip, int charge) const
 

Private Attributes

PointUV p1
 
PointUV p2
 
Range theIpRangeMinus
 
Range theIpRangePlus
 
Rotation theRotation
 
double theTolerance
 

Detailed Description

Definition at line 24 of file ThirdHitPredictionFromInvParabola.h.

Member Typedef Documentation

Definition at line 79 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 ( const GlobalPoint P1,
const GlobalPoint P2,
double  ip,
double  curv,
double  tolerance 
)

Definition at line 25 of file ThirdHitPredictionFromInvParabola.cc.

References init().

27  : theTolerance(torlerance)
28 {
29  init(P1,P2,ip,fabs(curv));
30 }
void init(const GlobalPoint &P1, const GlobalPoint &P2, double ip, double curv)

Member Function Documentation

double ThirdHitPredictionFromInvParabola::coeffA ( double  impactParameter,
int  charge 
) const
inlineprivate
double ThirdHitPredictionFromInvParabola::coeffB ( double  impactParameter,
int  charge 
) const
inlineprivate
ThirdHitPredictionFromInvParabola::PointUV ThirdHitPredictionFromInvParabola::findPointAtCurve ( double  radius,
int  charge,
double  ip 
) const
private

Definition at line 61 of file ThirdHitPredictionFromInvParabola.cc.

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

Referenced by rangeRPhi().

63 {
64  //
65  // assume u=(1-alpha^2/2)/r v=alpha/r
66  // solve qudratic equation neglecting aplha^4 term
67  //
68  double A = coeffA(ip,c);
69  double B = coeffB(ip,c);
70 
71  double overR = 1./r;
72  double ipOverR = ip*overR;
73 
74  double delta = 1-4*(0.5*B+ipOverR)*(-B+A*r-ipOverR);
75  double sqrtdelta = (delta > 0) ? std::sqrt(delta) : 0.;
76  double alpha = (c>0)? (-c+sqrtdelta)/(B+2*ipOverR) : (-c-sqrtdelta)/(B+2*ipOverR);
77 
78  double v = alpha*overR;
79  double d2 = overR*overR - v*v;
80  double u = (d2 > 0) ? std::sqrt(d2) : 0.;
81 
82  return PointUV(u,v,&theRotation);
83 }
dbl * delta
Definition: mlp_gen.cc:36
float alpha
Definition: AMPTWrapper.h:95
double coeffB(double impactParameter, int charge) const
T sqrt(T t)
Definition: SSEVec.h:28
double coeffA(double impactParameter, int charge) const
mathSSE::Vec4< T > v
void ThirdHitPredictionFromInvParabola::init ( const GlobalPoint P1,
const GlobalPoint P2,
double  ip,
double  curv 
)

Definition at line 34 of file ThirdHitPredictionFromInvParabola.cc.

References abs, PixelRecoRange< T >::intersection(), ipFromCurvature(), p1, p2, PixelRecoRange< T >::sort(), theIpRangeMinus, theIpRangePlus, theRotation, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by ThirdHitPredictionFromInvParabola().

35 {
36 // GlobalVector aX = GlobalVector( P2.x()-P1.x(), P2.y()-P1.y(), 0.).unit();
37  GlobalVector aX = GlobalVector( P1.x(), P1.y(), 0.).unit();
38  GlobalVector aY( -aX.y(), aX.x(), 0.);
39  GlobalVector aZ( 0., 0., 1.);
40  theRotation = Rotation(aX,aY,aZ);
41 
42  p1 = PointUV(Point2D(P1.x(),P1.y()), &theRotation);
43  p2 = PointUV(Point2D(P2.x(),P2.y()), &theRotation);
44 
45  Range ipRange(-ip, ip);
46  ipRange.sort();
47 
48  double ipIntyPlus = ipFromCurvature(0.,1);
49  double ipCurvPlus = ipFromCurvature(std::abs(curv), 1);
50  double ipCurvMinus = ipFromCurvature(std::abs(curv), -1);
51 
52 
53  Range ipRangePlus = Range(ipIntyPlus, ipCurvPlus); ipRangePlus.sort();
54  Range ipRangeMinus = Range(-ipIntyPlus, ipCurvMinus); ipRangeMinus.sort();
55 
56  theIpRangePlus = ipRangePlus.intersection(ipRange);
57  theIpRangeMinus = ipRangeMinus.intersection(ipRange);
58 }
T y() const
Definition: PV3DBase.h:57
#define abs(x)
Definition: mlp_lapack.h:159
Basic2DVector< double > Point2D
Vector3DBase unit() const
Definition: Vector3DBase.h:57
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
T x() const
Definition: PV3DBase.h:56
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double ipFromCurvature(double curvature, int charge) const
double ThirdHitPredictionFromInvParabola::ipFromCurvature ( double  curvature,
int  charge 
) const
private

Definition at line 165 of file ThirdHitPredictionFromInvParabola.cc.

References p1, p2, ThirdHitPredictionFromInvParabola::MappedPoint< T >::u(), and ThirdHitPredictionFromInvParabola::MappedPoint< T >::v().

Referenced by init().

166 {
167  double u1u2 = p1.u()*p2.u();
168  double du = p2.u() - p1.u();
169  double pv = p1.v()*p2.u() - p2.v()*p1.u();
170 
171  double inInf = -charge*pv/(du*u1u2);
172  return inInf-curvature/(2.*u1u2);
173 }
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 35 of file ThirdHitPredictionFromInvParabola.h.

References rangeRPhi().

35 { return rangeRPhi(radius,charge); }
double charge(const std::vector< uint8_t > &Ampls)
Range rangeRPhi(double radius, int charge) const
double ThirdHitPredictionFromInvParabola::predV ( double  u,
double  ip,
int  charge 
) const
private

Definition at line 178 of file ThirdHitPredictionFromInvParabola.cc.

References coeffA(), coeffB(), and funct::sqr().

Referenced by rangeRPhiSlow().

179 {
180  return -charge*( coeffA(ip,charge) - coeffB(ip,charge)*u - ip*sqr(u));
181 }
double charge(const std::vector< uint8_t > &Ampls)
double coeffB(double impactParameter, int charge) const
double coeffA(double impactParameter, int charge) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( double  radius,
int  charge 
) const

Definition at line 85 of file ThirdHitPredictionFromInvParabola.cc.

References PixelRecoRange< T >::empty(), findPointAtCurve(), PixelRecoRange< T >::intersection(), M_PI, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), Basic2DVector< T >::phi(), csvReporter::r, PixelRecoRange< T >::sort(), theIpRangeMinus, theIpRangePlus, theTolerance, ThirdHitPredictionFromInvParabola::MappedPoint< T >::unmap(), and ThirdHitPredictionFromInvParabola::MappedPoint< T >::v().

Referenced by operator()().

87 {
88  Range predRPhi(1.,-1.);
90 
91  PointUV pred_tmp1 = findPointAtCurve(radius,charge,ip.min());
92  PointUV pred_tmp2 = findPointAtCurve(radius,charge,ip.max());
93 
94  double phi1 = pred_tmp1.unmap().phi();
95  while ( phi1 >= M_PI) phi1 -= 2*M_PI;
96  while ( phi1 < -M_PI) phi1 += 2*M_PI;
97  double phi2 = phi1+radius*(pred_tmp2.v()-pred_tmp1.v());
98 
99  if (ip.empty()) {
100  Range r1(phi1*radius-theTolerance, phi1*radius+theTolerance);
101  Range r2(phi2*radius-theTolerance, phi2*radius+theTolerance);
102  predRPhi = r1.intersection(r2);
103  } else {
104  Range r(phi1, phi2);
105  r.sort();
106  predRPhi= Range(radius*r.min()-theTolerance, radius*r.max()+theTolerance);
107  }
108 
109  return predRPhi;
110 }
double charge(const std::vector< uint8_t > &Ampls)
#define M_PI
Definition: BFit3D.cc:3
Geom::Phi< T > phi() const
PointUV findPointAtCurve(double radius, int charge, double ip) const
ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhiSlow ( double  radius,
int  charge,
int  nIter = 5 
) const

Definition at line 113 of file ThirdHitPredictionFromInvParabola.cc.

References DeDxDiscriminatorTools::charge(), PixelRecoRange< T >::empty(), i, PixelRecoRange< T >::intersection(), M_PI, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), Basic2DVector< T >::phi(), predV(), csvReporter::r, CosmicsPD_Skims::radius, PixelRecoRange< T >::sort(), funct::sqr(), mathSSE::sqrt(), theIpRangeMinus, theIpRangePlus, theRotation, theTolerance, ThirdHitPredictionFromInvParabola::MappedPoint< T >::unmap(), and v.

115 {
116  Range predRPhi(1.,-1.);
117 
118  double invr2 = 1/radius/radius;
119  double u = sqrt(invr2);
120  double v = 0.;
121 
123 
124  for (int i=0; i < nIter; ++i) {
125  v = predV(u, ip.min(), charge);
126  double d2 = invr2-sqr(v);
127  u = (d2 > 0) ? sqrt(d2) : 0.;
128  }
129  PointUV pred_tmp1(u, v, &theRotation);
130  double phi1 = pred_tmp1.unmap().phi();
131  while ( phi1 >= M_PI) phi1 -= 2*M_PI;
132  while ( phi1 < -M_PI) phi1 += 2*M_PI;
133 
134 
135  u = sqrt(invr2);
136  v=0;
137  for (int i=0; i < nIter; ++i) {
138  v = predV(u, ip.max(), charge);
139  double d2 = invr2-sqr(v);
140  u = (d2 > 0) ? sqrt(d2) : 0.;
141  }
142  PointUV pred_tmp2(u, v, &theRotation);
143  double phi2 = pred_tmp2.unmap().phi();
144  while ( phi2-phi1 >= M_PI) phi2 -= 2*M_PI;
145  while ( phi2-phi1 < -M_PI) phi2 += 2*M_PI;
146 
147 // check faster alternative, without while(..) it is enough to:
148 // phi2 = phi1+radius*(pred_tmp2.v()-pred_tmp1.v());
149 
150  if (ip.empty()) {
151  Range r1(phi1*radius-theTolerance, phi1*radius+theTolerance);
152  Range r2(phi2*radius-theTolerance, phi2*radius+theTolerance);
153  predRPhi = r1.intersection(r2);
154  } else {
155  Range r(phi1, phi2);
156  r.sort();
157  predRPhi= Range(radius*r.min()-theTolerance, radius*r.max()+theTolerance);
158  }
159  return predRPhi;
160 
161 }
int i
Definition: DBlmapReader.cc:9
double charge(const std::vector< uint8_t > &Ampls)
double predV(double u, double ip, int charge) const
T sqrt(T t)
Definition: SSEVec.h:28
#define M_PI
Definition: BFit3D.cc:3
Square< F >::type sqr(const F &f)
Definition: Square.h:13
mathSSE::Vec4< T > v

Member Data Documentation

PointUV ThirdHitPredictionFromInvParabola::p1
private

Definition at line 80 of file ThirdHitPredictionFromInvParabola.h.

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

PointUV ThirdHitPredictionFromInvParabola::p2
private

Definition at line 80 of file ThirdHitPredictionFromInvParabola.h.

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

Range ThirdHitPredictionFromInvParabola::theIpRangeMinus
private

Definition at line 83 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), rangeRPhi(), and rangeRPhiSlow().

Range ThirdHitPredictionFromInvParabola::theIpRangePlus
private

Definition at line 83 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), rangeRPhi(), and rangeRPhiSlow().

Rotation ThirdHitPredictionFromInvParabola::theRotation
private

Definition at line 78 of file ThirdHitPredictionFromInvParabola.h.

Referenced by findPointAtCurve(), init(), and rangeRPhiSlow().

double ThirdHitPredictionFromInvParabola::theTolerance
private

Definition at line 84 of file ThirdHitPredictionFromInvParabola.h.

Referenced by rangeRPhi(), and rangeRPhiSlow().