CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
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) const
 
Range operator() (Scalar radius, int charge) const
 
Range rangeRPhi (Scalar radius) const
 
Range rangeRPhi (Scalar radius, int charge) const
 
 ThirdHitPredictionFromInvParabola ()
 
 ThirdHitPredictionFromInvParabola (const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv, Scalar tolerance)
 
 ThirdHitPredictionFromInvParabola (Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv, Scalar tolerance)
 

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
 
bool emptyM
 
bool emptyP
 
Scalar overDu
 
Scalar pv
 
Scalar su
 
RangeD theIpRangeMinus
 
RangeD theIpRangePlus
 
Rotation theRotation
 
Scalar theTolerance
 
Scalar u1u2
 

Friends

int test::PixelTriplets_InvPrbl_prec::test ()
 
int test::PixelTriplets_InvPrbl_t::test ()
 

Detailed Description

Definition at line 33 of file ThirdHitPredictionFromInvParabola.h.

Member Typedef Documentation

◆ Point2D

Definition at line 43 of file ThirdHitPredictionFromInvParabola.h.

◆ Range

Definition at line 41 of file ThirdHitPredictionFromInvParabola.h.

◆ RangeD

Definition at line 42 of file ThirdHitPredictionFromInvParabola.h.

◆ Rotation

Definition at line 40 of file ThirdHitPredictionFromInvParabola.h.

◆ Scalar

Definition at line 39 of file ThirdHitPredictionFromInvParabola.h.

Constructor & Destructor Documentation

◆ ThirdHitPredictionFromInvParabola() [1/3]

ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( )
inline

Definition at line 45 of file ThirdHitPredictionFromInvParabola.h.

45 {}

◆ ThirdHitPredictionFromInvParabola() [2/3]

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

◆ ThirdHitPredictionFromInvParabola() [3/3]

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

Definition at line 32 of file ThirdHitPredictionFromInvParabola.cc.

35  init(P1, P2, ip, std::abs(curv));
36 }

References funct::abs(), and init().

Member Function Documentation

◆ coeffA()

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffA ( Scalar  impactParameter) const
inlineprivate

Definition at line 92 of file ThirdHitPredictionFromInvParabola.h.

92  {
93  auto c = -pv * overDu;
94  return c - u1u2 * impactParameter;
95 }

References c, overDu, pv, and u1u2.

Referenced by findPointAtCurve(), and predV().

◆ coeffB()

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffB ( Scalar  impactParameter) const
inlineprivate

Definition at line 97 of file ThirdHitPredictionFromInvParabola.h.

97  {
98  auto c = dv * overDu;
99  return c - su * impactParameter;
100 }

References c, dv, overDu, and su.

Referenced by findPointAtCurve(), and predV().

◆ findPointAtCurve()

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

Definition at line 114 of file ThirdHitPredictionFromInvParabola.h.

114  {
115  //
116  // assume u=(1-alpha^2/2)/r v=alpha/r
117  // solve qudratic equation neglecting aplha^4 term
118  //
119  Scalar A = coeffA(ip);
120  Scalar B = coeffB(ip);
121 
122  // Scalar overR = 1./r;
123  Scalar ipOverR = ip / r; // *overR;
124 
125  Scalar a = 0.5 * B + ipOverR;
126  Scalar c = -B + A * r - ipOverR;
127 
128  Scalar delta = 1 - 4 * a * c;
129  // Scalar sqrtdelta = (delta > 0) ? std::sqrt(delta) : 0.;
130  Scalar sqrtdelta = std::sqrt(delta);
131  // Scalar alpha = (-1+sqrtdelta)/(2*a);
132  Scalar alpha = (-2 * c) / (1 + sqrtdelta);
133 
134  v = alpha; // *overR
135  Scalar d2 = 1. - v * v; // overR*overR - v*v
136  // u = (d2 > 0) ? std::sqrt(d2) : 0.;
137  u = std::sqrt(d2);
138 
139  // u,v not rotated! not multiplied by 1/r
140 }

References a, alpha, TtFullHadDaughter::B, c, coeffA(), coeffB(), dumpMFGeometry_cfg::delta, alignCSCRings::r, mathSSE::sqrt(), and findQualityFiles::v.

Referenced by rangeRPhi().

◆ init() [1/2]

void ThirdHitPredictionFromInvParabola::init ( const GlobalPoint P1,
const GlobalPoint P2,
Scalar  ip,
Scalar  curv 
)
inline

Definition at line 65 of file ThirdHitPredictionFromInvParabola.h.

65  {
66  init(P1.x(), P1.y(), P2.x(), P2.y(), ip, curv);
67  }

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

Referenced by ThirdHitPredictionFromInvParabola().

◆ init() [2/2]

void ThirdHitPredictionFromInvParabola::init ( Scalar  x1,
Scalar  y1,
Scalar  x2,
Scalar  y2,
Scalar  ip,
Scalar  curv 
)

Definition at line 38 of file ThirdHitPredictionFromInvParabola.cc.

38  {
39  // GlobalVector aX = GlobalVector( P2.x()-P1.x(), P2.y()-P1.y(), 0.).unit();
40 
41  Point2D p1(x1, y1);
42  Point2D p2(x2, y2);
44  p1 = transform(p1); // (1./P1.xy().mag(),0);
45  p2 = transform(p2);
46 
47  u1u2 = p1.x() * p2.x();
48  overDu = 1. / (p2.x() - p1.x());
49  pv = p1.y() * p2.x() - p2.y() * p1.x();
50  dv = p2.y() - p1.y();
51  su = p2.x() + p1.x();
52 
53  ip = std::abs(ip);
54  RangeD ipRange(-ip, ip);
55 
56  Scalar ipIntyPlus = ipFromCurvature(0., true);
57  Scalar ipCurvPlus = ipFromCurvature(curv, true);
58  Scalar ipCurvMinus = ipFromCurvature(curv, false);
59 
60  RangeD ipRangePlus(std::min(ipIntyPlus, ipCurvPlus), std::max(ipIntyPlus, ipCurvPlus));
61  RangeD ipRangeMinus(std::min(-ipIntyPlus, ipCurvMinus), std::max(-ipIntyPlus, ipCurvMinus));
62 
63  theIpRangePlus = ipRangePlus.intersection(ipRange);
64  theIpRangeMinus = ipRangeMinus.intersection(ipRange);
65 
68 }

References funct::abs(), dv, PixelRecoRange< T >::empty(), emptyM, emptyP, PixelRecoRange< T >::intersection(), ipFromCurvature(), SiStripPI::max, min(), overDu, p1, p2, pv, su, theIpRangeMinus, theIpRangePlus, theRotation, transform(), u1u2, testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

◆ ipFromCurvature()

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::ipFromCurvature ( Scalar  curvature,
bool  pos 
) const
inlineprivate

Definition at line 102 of file ThirdHitPredictionFromInvParabola.h.

103  {
104  Scalar overU1u2 = 1. / u1u2;
105  Scalar inInf = -pv * overDu * overU1u2;
106  return (pos ? inInf : -inInf) - curvature * overU1u2 * 0.5;
107 }

References PixelRecoUtilities::curvature(), overDu, pv, and u1u2.

Referenced by init().

◆ operator()() [1/2]

Range ThirdHitPredictionFromInvParabola::operator() ( Scalar  radius) const
inline

Definition at line 57 of file ThirdHitPredictionFromInvParabola.h.

57 { return rangeRPhi(radius); }

References CosmicsPD_Skims::radius, and rangeRPhi().

◆ operator()() [2/2]

Range ThirdHitPredictionFromInvParabola::operator() ( Scalar  radius,
int  charge 
) const
inline

◆ predV()

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::predV ( Scalar  u,
Scalar  ip 
) const
inlineprivate

Definition at line 109 of file ThirdHitPredictionFromInvParabola.h.

109  {
110  auto c = -(coeffA(ip) - coeffB(ip * u) - ip * u * u);
111  return c;
112 }

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

◆ rangeRPhi() [1/2]

ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( Scalar  radius) const

Definition at line 99 of file ThirdHitPredictionFromInvParabola.cc.

99  {
100  auto getRange = [&](Scalar phi1, Scalar phi2, bool empty) -> RangeD {
101  if (phi2 < phi1)
102  std::swap(phi1, phi2);
103  if (empty) {
104  RangeD r1(phi1 * radius - theTolerance, phi1 * radius + theTolerance);
105  RangeD r2(phi2 * radius - theTolerance, phi2 * radius + theTolerance);
106  return r1.intersection(r2);
107  }
108 
109  return RangeD(radius * phi1 - theTolerance, radius * phi2 + theTolerance);
110  };
111 
112  // it will vectorize with gcc 4.7 (with -O3 -fno-math-errno)
113  // change sign as intersect assume -ip for negative charge...
115  Scalar u[4], v[4];
116  for (int i = 0; i < 4; ++i)
117  findPointAtCurve(radius, ipv[i], u[i], v[i]);
118 
119  //
120  auto xr = theRotation.x();
121  auto yr = theRotation.y();
122 
123  Scalar phi1[2], phi2[2];
124  for (int i = 0; i < 2; ++i) {
125  auto x = xr[0] * u[i] + yr[0] * v[i];
126  auto y = xr[1] * u[i] + yr[1] * v[i];
127  phi1[i] = f_atan2f(y, x);
128  phi2[i] = phi1[i] + (v[i + 2] - v[i]);
129  }
130 
131  return getRange(phi1[1], phi2[1], emptyM).sum(getRange(phi1[0], phi2[0], emptyP));
132 }

References relativeConstraints::empty, emptyM, emptyP, findPointAtCurve(), mps_fire::i, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), diffTwoXMLs::r1, diffTwoXMLs::r2, CosmicsPD_Skims::radius, std::swap(), theIpRangeMinus, theIpRangePlus, theRotation, theTolerance, findQualityFiles::v, x, TkRotation2D< T >::x(), y, and TkRotation2D< T >::y().

◆ rangeRPhi() [2/2]

ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( Scalar  radius,
int  charge 
) const

Definition at line 70 of file ThirdHitPredictionFromInvParabola.cc.

71  {
72  bool pos = icharge > 0;
73 
75 
76  // it will vectorize with gcc 4.7 (with -O3 -fno-math-errno)
77  // change sign as intersect assume -ip for negative charge...
78  Scalar ipv[2] = {(pos) ? ip.min() : -ip.min(), (pos) ? ip.max() : -ip.max()};
79  Scalar u[2], v[2];
80  for (int i = 0; i != 2; ++i)
81  findPointAtCurve(radius, ipv[i], u[i], v[i]);
82 
83  //
84  Scalar phi1 = f_phi(theRotation.rotateBack(Point2D(u[0], v[0])));
85  Scalar phi2 = phi1 + (v[1] - v[0]);
86 
87  if (phi2 < phi1)
88  std::swap(phi1, phi2);
89 
90  if (ip.empty()) {
91  Range r1(phi1 * radius - theTolerance, phi1 * radius + theTolerance);
92  Range r2(phi2 * radius - theTolerance, phi2 * radius + theTolerance);
93  return r1.intersection(r2); // this range can be empty
94  }
95 
96  return Range(radius * phi1 - theTolerance, radius * phi2 + theTolerance);
97 }

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

Referenced by operator()().

◆ transform()

Point2D ThirdHitPredictionFromInvParabola::transform ( Point2D const &  p) const
inlineprivate

Definition at line 76 of file ThirdHitPredictionFromInvParabola.h.

76 { return theRotation.rotate(p) / p.mag2(); }

References AlCaHLTBitMon_ParallelJobs::p, TkRotation2D< T >::rotate(), and theRotation.

Referenced by init().

◆ transformBack()

Point2D ThirdHitPredictionFromInvParabola::transformBack ( Point2D const &  p) const
inlineprivate

Friends And Related Function Documentation

◆ test::PixelTriplets_InvPrbl_prec::test

◆ test::PixelTriplets_InvPrbl_t::test

Member Data Documentation

◆ dv

Scalar ThirdHitPredictionFromInvParabola::dv
private

Definition at line 82 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

◆ emptyM

bool ThirdHitPredictionFromInvParabola::emptyM
private

Definition at line 89 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

◆ emptyP

bool ThirdHitPredictionFromInvParabola::emptyP
private

Definition at line 89 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

◆ overDu

Scalar ThirdHitPredictionFromInvParabola::overDu
private

Definition at line 82 of file ThirdHitPredictionFromInvParabola.h.

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

◆ pv

Scalar ThirdHitPredictionFromInvParabola::pv
private

Definition at line 82 of file ThirdHitPredictionFromInvParabola.h.

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

◆ su

Scalar ThirdHitPredictionFromInvParabola::su
private

Definition at line 82 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

◆ theIpRangeMinus

RangeD ThirdHitPredictionFromInvParabola::theIpRangeMinus
private

Definition at line 87 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

◆ theIpRangePlus

RangeD ThirdHitPredictionFromInvParabola::theIpRangePlus
private

Definition at line 87 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

◆ theRotation

Rotation ThirdHitPredictionFromInvParabola::theRotation
private

Definition at line 81 of file ThirdHitPredictionFromInvParabola.h.

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

◆ theTolerance

Scalar ThirdHitPredictionFromInvParabola::theTolerance
private

Definition at line 88 of file ThirdHitPredictionFromInvParabola.h.

Referenced by rangeRPhi().

◆ u1u2

Scalar ThirdHitPredictionFromInvParabola::u1u2
private

Definition at line 82 of file ThirdHitPredictionFromInvParabola.h.

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

DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
ThirdHitPredictionFromInvParabola::theTolerance
Scalar theTolerance
Definition: ThirdHitPredictionFromInvParabola.h:88
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
ThirdHitPredictionFromInvParabola::u1u2
Scalar u1u2
Definition: ThirdHitPredictionFromInvParabola.h:82
min
T min(T a, T b)
Definition: MathUtil.h:58
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
ThirdHitPredictionFromInvParabola::coeffA
Scalar coeffA(Scalar impactParameter) const
Definition: ThirdHitPredictionFromInvParabola.h:92
TkRotation2D::x
BasicVector x() const
Definition: extTkRotation.h:330
pos
Definition: PixelAliasList.h:18
ThirdHitPredictionFromInvParabola::Scalar
double Scalar
Definition: ThirdHitPredictionFromInvParabola.h:39
alpha
float alpha
Definition: AMPTWrapper.h:105
TkRotation2D::rotateBack
BasicVector rotateBack(const BasicVector &v) const
Definition: extTkRotation.h:342
ThirdHitPredictionFromInvParabola::su
Scalar su
Definition: ThirdHitPredictionFromInvParabola.h:82
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
ThirdHitPredictionFromInvParabola::Range
PixelRecoRange< float > Range
Definition: ThirdHitPredictionFromInvParabola.h:41
PixelRecoRange::empty
bool empty() const
Definition: PixelRecoRange.h:29
PixelRecoRange::min
T min() const
Definition: PixelRecoRange.h:25
ThirdHitPredictionFromInvParabola::rangeRPhi
Range rangeRPhi(Scalar radius, int charge) const
Definition: ThirdHitPredictionFromInvParabola.cc:70
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
ThirdHitPredictionFromInvParabola::overDu
Scalar overDu
Definition: ThirdHitPredictionFromInvParabola.h:82
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
PixelRecoRange::max
T max() const
Definition: PixelRecoRange.h:26
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
ThirdHitPredictionFromInvParabola::pv
Scalar pv
Definition: ThirdHitPredictionFromInvParabola.h:82
ThirdHitPredictionFromInvParabola::transform
Point2D transform(Point2D const &p) const
Definition: ThirdHitPredictionFromInvParabola.h:76
PixelRecoRange::intersection
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
Definition: PixelRecoRange.h:40
TkRotation2D::rotate
BasicVector rotate(const BasicVector &v) const
Definition: extTkRotation.h:338
Basic2DVector< double >
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
ThirdHitPredictionFromInvParabola::emptyP
bool emptyP
Definition: ThirdHitPredictionFromInvParabola.h:89
ThirdHitPredictionFromInvParabola::theIpRangePlus
RangeD theIpRangePlus
Definition: ThirdHitPredictionFromInvParabola.h:87
a
double a
Definition: hdecay.h:119
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
A
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:29
p1
double p1[4]
Definition: TauolaWrapper.h:89
ThirdHitPredictionFromInvParabola::init
void init(const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)
Definition: ThirdHitPredictionFromInvParabola.h:65
ThirdHitPredictionFromInvParabola::dv
Scalar dv
Definition: ThirdHitPredictionFromInvParabola.h:82
ThirdHitPredictionFromInvParabola::findPointAtCurve
void findPointAtCurve(Scalar radius, Scalar ip, Scalar &u, Scalar &v) const
Definition: ThirdHitPredictionFromInvParabola.h:114
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ThirdHitPredictionFromInvParabola::Rotation
TkRotation2D< Scalar > Rotation
Definition: ThirdHitPredictionFromInvParabola.h:40
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
ThirdHitPredictionFromInvParabola::ipFromCurvature
Scalar ipFromCurvature(Scalar curvature, bool pos) const
Definition: ThirdHitPredictionFromInvParabola.h:102
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
ThirdHitPredictionFromInvParabola::emptyM
bool emptyM
Definition: ThirdHitPredictionFromInvParabola.h:89
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
ThirdHitPredictionFromInvParabola::theIpRangeMinus
RangeD theIpRangeMinus
Definition: ThirdHitPredictionFromInvParabola.h:87
TkRotation2D::y
BasicVector y() const
Definition: extTkRotation.h:331
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
ThirdHitPredictionFromInvParabola::theRotation
Rotation theRotation
Definition: ThirdHitPredictionFromInvParabola.h:81
ThirdHitPredictionFromInvParabola::coeffB
Scalar coeffB(Scalar impactParameter) const
Definition: ThirdHitPredictionFromInvParabola.h:97
ThirdHitPredictionFromInvParabola::RangeD
PixelRecoRange< Scalar > RangeD
Definition: ThirdHitPredictionFromInvParabola.h:42