CMS 3D CMS Logo

ThirdHitPredictionFromInvParabola.h
Go to the documentation of this file.
1 #ifndef ThirdHitPredictionFromInvParabola_H
2 #define ThirdHitPredictionFromInvParabola_H
3 
13 
16 #include <array>
17 
19 
20 class TrackingRegion;
21 class OrderedHitPair;
22 
23 // Function for testing ThirdHitPredictionFromInvParabola
24 namespace test {
25  namespace PixelTriplets_InvPrbl_prec {
26  int test();
27  }
28  namespace PixelTriplets_InvPrbl_t {
29  int test();
30  }
31 } // namespace test
32 
34  // For tests
37 
38 public:
39  using Scalar = double;
44 
48  init(x1, y1, x2, y2, ip, std::abs(curv));
49  }
50 
52  const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv, Scalar tolerance);
53 
54  // inline Range operator()(Scalar radius, int charge) const { return rangeRPhiSlow(radius,charge,1); }
55  inline Range operator()(Scalar radius, int charge) const { return rangeRPhi(radius, charge); }
56 
57  inline Range operator()(Scalar radius) const { return rangeRPhi(radius); }
58 
59  Range rangeRPhi(Scalar radius, int charge) const; // __attribute__ ((optimize(3, "fast-math")));
60 
62 
63  // Range rangeRPhiSlow(Scalar radius, int charge, int nIter=5) const;
64 
65  void init(const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv) {
66  init(P1.x(), P1.y(), P2.x(), P2.y(), ip, curv);
67  }
68  void init(Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv);
69 
70 private:
71  inline Scalar coeffA(Scalar impactParameter) const;
72  inline Scalar coeffB(Scalar impactParameter) const;
73  inline Scalar predV(Scalar u, Scalar ip) const;
74  inline Scalar ipFromCurvature(Scalar curvature, bool pos) const;
75 
76  Point2D transform(Point2D const &p) const { return theRotation.rotate(p) / p.mag2(); }
77 
78  Point2D transformBack(Point2D const &p) const { return theRotation.rotateBack(p) / p.mag2(); }
79 
80 private:
83 
84  // formula is symmetric for (ip,pos) -> (-ip,neg)
85  inline void findPointAtCurve(Scalar radius, Scalar ip, Scalar &u, Scalar &v) const;
86 
89  bool emptyP, emptyM;
90 };
91 
93  auto c = -pv * overDu;
94  return c - u1u2 * impactParameter;
95 }
96 
98  auto c = dv * overDu;
99  return c - su * impactParameter;
100 }
101 
103  bool pos) const {
104  Scalar overU1u2 = 1. / u1u2;
105  Scalar inInf = -pv * overDu * overU1u2;
106  return (pos ? inInf : -inInf) - curvature * overU1u2 * 0.5;
107 }
108 
110  auto c = -(coeffA(ip) - coeffB(ip * u) - ip * u * u);
111  return c;
112 }
113 
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 }
141 
142 #endif
Visibility.h
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
ThirdHitPredictionFromInvParabola::operator()
Range operator()(Scalar radius) const
Definition: ThirdHitPredictionFromInvParabola.h:57
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
ThirdHitPredictionFromInvParabola::Point2D
Basic2DVector< Scalar > Point2D
Definition: ThirdHitPredictionFromInvParabola.h:43
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ThirdHitPredictionFromInvParabola::coeffA
Scalar coeffA(Scalar impactParameter) const
Definition: ThirdHitPredictionFromInvParabola.h:92
pos
Definition: PixelAliasList.h:18
ThirdHitPredictionFromInvParabola::operator()
Range operator()(Scalar radius, int charge) const
Definition: ThirdHitPredictionFromInvParabola.h:55
Basic3DVector.h
ThirdHitPredictionFromInvParabola::Scalar
double Scalar
Definition: ThirdHitPredictionFromInvParabola.h:39
test::PixelTriplets_InvPrbl_prec::test
int test()
TkRotation2D::rotateBack
BasicVector rotateBack(const BasicVector &v) const
Definition: extTkRotation.h:342
ThirdHitPredictionFromInvParabola::su
Scalar su
Definition: ThirdHitPredictionFromInvParabola.h:82
TkRotation2D< Scalar >
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
ThirdHitPredictionFromInvParabola::transformBack
Point2D transformBack(Point2D const &p) const
Definition: ThirdHitPredictionFromInvParabola.h:78
ThirdHitPredictionFromInvParabola::rangeRPhi
Range rangeRPhi(Scalar radius, int charge) const
Definition: ThirdHitPredictionFromInvParabola.cc:70
ThirdHitPredictionFromInvParabola::predV
Scalar predV(Scalar u, Scalar ip) const
Definition: ThirdHitPredictionFromInvParabola.h:109
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
test
Definition: SmallWORMDict.h:13
ThirdHitPredictionFromInvParabola::overDu
Scalar overDu
Definition: ThirdHitPredictionFromInvParabola.h:82
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ThirdHitPredictionFromInvParabola::pv
Scalar pv
Definition: ThirdHitPredictionFromInvParabola.h:82
ThirdHitPredictionFromInvParabola::transform
Point2D transform(Point2D const &p) const
Definition: ThirdHitPredictionFromInvParabola.h:76
TkRotation.h
Point3DBase< float, GlobalTag >
test::PixelTriplets_InvPrbl_t::test
int test()
TkRotation2D::rotate
BasicVector rotate(const BasicVector &v) const
Definition: extTkRotation.h:338
Basic2DVector< Scalar >
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
PixelRecoRange< float >
ThirdHitPredictionFromInvParabola::theIpRangePlus
RangeD theIpRangePlus
Definition: ThirdHitPredictionFromInvParabola.h:87
a
double a
Definition: hdecay.h:119
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
A
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:27
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
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
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
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola
ThirdHitPredictionFromInvParabola(Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv, Scalar tolerance)
Definition: ThirdHitPredictionFromInvParabola.h:46
Basic2DVector.h
ThirdHitPredictionFromInvParabola::emptyM
bool emptyM
Definition: ThirdHitPredictionFromInvParabola.h:89
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
ThirdHitPredictionFromInvParabola
Definition: ThirdHitPredictionFromInvParabola.h:33
TrackingRegion
Definition: TrackingRegion.h:40
ThirdHitPredictionFromInvParabola::theIpRangeMinus
RangeD theIpRangeMinus
Definition: ThirdHitPredictionFromInvParabola.h:87
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
OrderedHitPair
Definition: OrderedHitPair.h:6
GlobalPoint.h
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola
ThirdHitPredictionFromInvParabola()
Definition: ThirdHitPredictionFromInvParabola.h:45
ThirdHitPredictionFromInvParabola::theRotation
Rotation theRotation
Definition: ThirdHitPredictionFromInvParabola.h:81
PixelRecoRange.h
ThirdHitPredictionFromInvParabola::coeffB
Scalar coeffB(Scalar impactParameter) const
Definition: ThirdHitPredictionFromInvParabola.h:97
ThirdHitPredictionFromInvParabola::RangeD
PixelRecoRange< Scalar > RangeD
Definition: ThirdHitPredictionFromInvParabola.h:42