CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ThirdHitPrediction Class Reference

#include <ThirdHitPrediction.h>

Public Types

typedef TkTrackingRegionsMargin< float > Margin
 
typedef PixelRecoRange< float > Range
 

Public Member Functions

void getRanges (const DetLayer *layer, float phi[], float rz[])
 
void getRanges (float rORz, float phi[], float rz[])
 
bool isCompatibleWithMultipleScattering (GlobalPoint g3, const std::vector< const TrackingRecHit *> &h, std::vector< GlobalVector > &localDirs, const MultipleScatteringParametrisationMaker &msmaker)
 
 ThirdHitPrediction (const TrackingRegion &region, GlobalPoint inner, GlobalPoint outer, const MagneticField &magfield, const TransientTrackingRecHitBuilder &ttrhBuilder, double nSigMultipleScattering, double maxAngleRatio)
 
 ~ThirdHitPrediction ()
 

Private Member Functions

float angleRatio (const Global2DVector &p3, const Global2DVector &c)
 
float areaParallelogram (const Global2DVector &a, const Global2DVector &b)
 
void calculateRanges (float rz3, float phi[2], float rz[2])
 
void calculateRangesBarrel (float r3, float phi[2], float z[2], bool keep)
 
void calculateRangesForward (float z3, float phi[2], float r[2], bool keep)
 
std::pair< float, float > findArcIntersection (std::pair< float, float > a, std::pair< float, float > b, bool &keep)
 
std::pair< float, float > findMinimalCircles (float r)
 
void findRectangle (const float x[3], const float y[3], const float par[3], float phi[2], float z[2])
 
std::pair< float, float > findTouchingCircles (float r)
 
void fitParabola (const float x[3], const float y[3], float par[3])
 
void initLayer (const DetLayer *layer)
 
void invertCircle (Global2DVector &c, float &r)
 
void invertPoint (Global2DVector &p)
 
void printOut (char *text)
 
void spinCloser (float phi[3])
 

Private Attributes

std::pair< float, float > arc_0m
 
float Bz
 
Global2DVector c0
 
Global2DVector dif
 
GlobalPoint g1
 
GlobalPoint g2
 
bool keep
 
double maxRatio
 
double nSigma
 
Global2DVector p1
 
Global2DVector p2
 
float r0
 
float rm
 
bool theBarrel
 
Range theDetRange
 
bool theForward
 
const DetLayertheLayer
 
PixelRecoLineRZ theLine
 
Margin theTolerance
 
const TransientTrackingRecHitBuildertheTTRecHitBuilder
 

Detailed Description

Definition at line 35 of file ThirdHitPrediction.h.

Member Typedef Documentation

◆ Margin

Definition at line 38 of file ThirdHitPrediction.h.

◆ Range

Definition at line 37 of file ThirdHitPrediction.h.

Constructor & Destructor Documentation

◆ ThirdHitPrediction()

ThirdHitPrediction::ThirdHitPrediction ( const TrackingRegion region,
GlobalPoint  inner,
GlobalPoint  outer,
const MagneticField magfield,
const TransientTrackingRecHitBuilder ttrhBuilder,
double  nSigMultipleScattering,
double  maxAngleRatio 
)

Definition at line 18 of file ThirdHitPrediction.cc.

References fftjetpileupestimator_calo_uncalib_cfi::c0, diffTwoXMLs::g1, diffTwoXMLs::g2, SurfaceOrientation::inner, runTheMatrix::keep, volumeBasedMagneticField_160812_cfi::magfield, AllPixelTracks_cfi::maxAngleRatio, HLTSiStripMonitoring_cff::nSigma, AllPixelTracks_cfi::nSigMultipleScattering, SurfaceOrientation::outer, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, nano_mu_digi_cff::region, and eostools::rm().

24  {
25  using namespace edm;
26  theTTRecHitBuilder = &ttrhBuilder;
27 
28  Bz = fabs(magfield.inInverseGeV(GlobalPoint(0, 0, 0)).z());
29 
30  c0 = Global2DVector(region.origin().x(), region.origin().y());
31 
32  r0 = region.originRBound();
33  rm = region.ptMin() / Bz;
34 
35  g1 = inner;
36  g2 = outer;
37 
38  p1 = Global2DVector(g1.x(), g1.y());
39  p2 = Global2DVector(g2.x(), g2.y());
40 
41  dif = p1 - p2;
42 
43  // Prepare circles of minimal pt (rm) and cylinder of origin (r0)
44  keep = true;
46 
49 }
Vector2DBase< float, GlobalTag > Global2DVector
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
std::pair< float, float > findMinimalCircles(float r)
HLT enums.
std::pair< float, float > findArcIntersection(std::pair< float, float > a, std::pair< float, float > b, bool &keep)
std::pair< float, float > findTouchingCircles(float r)
std::pair< float, float > arc_0m

◆ ~ThirdHitPrediction()

ThirdHitPrediction::~ThirdHitPrediction ( )

Definition at line 52 of file ThirdHitPrediction.cc.

52 {}

Member Function Documentation

◆ angleRatio()

float ThirdHitPrediction::angleRatio ( const Global2DVector p3,
const Global2DVector c 
)
private

Definition at line 167 of file ThirdHitPrediction.cc.

References DummyCfis::c, mag2(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, and chargedHadronTrackResolutionFilter_cfi::p3.

167  {
168  float rad2 = (p1 - c).mag2();
169 
170  float a12 = asin(fabsf(areaParallelogram(p1 - c, p2 - c)) / rad2);
171  float a23 = asin(fabsf(areaParallelogram(p2 - c, p3 - c)) / rad2);
172 
173  return a23 / a12;
174 }
float areaParallelogram(const Global2DVector &a, const Global2DVector &b)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)

◆ areaParallelogram()

float ThirdHitPrediction::areaParallelogram ( const Global2DVector a,
const Global2DVector b 
)
private

Definition at line 162 of file ThirdHitPrediction.cc.

References a, and b.

162  {
163  return a.x() * b.y() - a.y() * b.x();
164 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ calculateRanges()

void ThirdHitPrediction::calculateRanges ( float  rz3,
float  phi[2],
float  rz[2] 
)
private

Definition at line 284 of file ThirdHitPrediction.cc.

References runTheMatrix::keep.

284  {
285  // Clear
286  phi[0] = 0.;
287  rz[0] = 0.;
288  phi[1] = 0.;
289  rz[1] = 0.;
290 
291  // Calculate
292  if (theBarrel)
293  calculateRangesBarrel(rz3, phi, rz, keep);
294  else
295  calculateRangesForward(rz3, phi, rz, keep);
296 }
void calculateRangesForward(float z3, float phi[2], float r[2], bool keep)
void calculateRangesBarrel(float r3, float phi[2], float z[2], bool keep)

◆ calculateRangesBarrel()

void ThirdHitPrediction::calculateRangesBarrel ( float  r3,
float  phi[2],
float  z[2],
bool  keep 
)
private

Definition at line 190 of file ThirdHitPrediction.cc.

References angle(), DummyCfis::c, funct::cos(), dumpMFGeometry_cfg::delta, diffTwoXMLs::g1, diffTwoXMLs::g2, mps_fire::i, runTheMatrix::keep, mag(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, funct::sin(), sqr(), and mathSSE::sqrt().

190  {
191  pair<float, float> arc_all = findArcIntersection(arc_0m, findTouchingCircles(r3), keep);
192 
193  if (arc_all.second != 0.) {
194  Global2DVector c3(0., 0.); // barrel at r3
195  invertCircle(c3, r3); // inverted
196 
197  float angle[3]; // prepare angles
198  angle[0] = arc_all.first - arc_all.second;
199  angle[1] = arc_all.first;
200  angle[2] = arc_all.first + arc_all.second;
201 
202  float phi3[3], z3[3];
203  Global2DVector delta = c3 - p2;
204 
205  for (int i = 0; i < 3; i++) {
206  Global2DVector vec(cos(angle[i]), sin(angle[i])); // unit vector
207  float lambda = delta * vec - sqrt(sqr(delta * vec) - delta * delta + sqr(r3));
208 
209  Global2DVector p3 = p2 + lambda * vec; // inverted third hit
210  invertPoint(p3); // third hit
211  phi3[i] = p3.phi(); // phi of third hit
212 
213  float ratio;
214 
215  if (keep && i == 1) { // Straight line
216  ratio = (p2 - p3).mag() / (p1 - p2).mag();
217  } else { // Circle
218  Global2DVector c = p2 - vec * (vec * (p2 - p1)); // inverted antipodal
219  invertPoint(c); // antipodal
220  c = 0.5 * (p1 + c); // center
221 
222  ratio = angleRatio(p3, c);
223  }
224 
225  z3[i] = g2.z() + (g2.z() - g1.z()) * ratio; // z of third hit
226  }
227 
228  spinCloser(phi3);
229 
230  // Parabola on phi - z
231  float par[3];
232  fitParabola(phi3, z3, par);
233  findRectangle(phi3, z3, par, phi, z);
234  }
235 }
void findRectangle(const float x[3], const float y[3], const float par[3], float phi[2], float z[2])
void invertCircle(Global2DVector &c, float &r)
T z() const
Definition: PV3DBase.h:61
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float angleRatio(const Global2DVector &p3, const Global2DVector &c)
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void spinCloser(float phi[3])
std::pair< float, float > findArcIntersection(std::pair< float, float > a, std::pair< float, float > b, bool &keep)
void invertPoint(Global2DVector &p)
void fitParabola(const float x[3], const float y[3], float par[3])
std::pair< float, float > findTouchingCircles(float r)
std::pair< float, float > arc_0m
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
float sqr(float x)

◆ calculateRangesForward()

void ThirdHitPrediction::calculateRangesForward ( float  z3,
float  phi[2],
float  r[2],
bool  keep 
)
private

Definition at line 238 of file ThirdHitPrediction.cc.

References angle(), DummyCfis::c, funct::cos(), diffTwoXMLs::g1, diffTwoXMLs::g2, mps_fire::i, runTheMatrix::keep, mag2(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, funct::sin(), and x.

238  {
239  float angle[3]; // prepare angles
240  angle[0] = arc_0m.first - arc_0m.second;
241  angle[1] = arc_0m.first;
242  angle[2] = arc_0m.first + arc_0m.second;
243 
244  float ratio = (z3 - g2.z()) / (g2.z() - g1.z());
245 
246  if (0 < ratio && ratio < maxRatio) {
247  float phi3[3], r3[3];
248 
249  for (int i = 0; i < 3; i++) {
251 
252  if (keep && i == 1) { // Straight line
253  p3 = p2 + ratio * (p2 - p1);
254  } else { // Circle
255  Global2DVector vec(cos(angle[i]), sin(angle[i])); // unit vector
256 
257  Global2DVector c = p2 - vec * (vec * (p2 - p1)); // inverted antipodal
258  invertPoint(c); // antipodal
259  c = 0.5 * (p1 + c); // center
260 
261  float rad2 = (p1 - c).mag2();
262 
263  float a12 = asin(areaParallelogram(p1 - c, p2 - c) / rad2);
264  float a23 = ratio * a12;
265 
266  p3 = c + Global2DVector((p2 - c).x() * cos(a23) - (p2 - c).y() * sin(a23),
267  (p2 - c).x() * sin(a23) + (p2 - c).y() * cos(a23));
268  }
269 
270  phi3[i] = p3.phi();
271  r3[i] = p3.mag();
272  }
273 
274  spinCloser(phi3);
275 
276  // Parabola on phi - z
277  float par[3];
278  fitParabola(phi3, r3, par);
279  findRectangle(phi3, r3, par, phi, r);
280  }
281 }
void findRectangle(const float x[3], const float y[3], const float par[3], float phi[2], float z[2])
Vector2DBase< float, GlobalTag > Global2DVector
T z() const
Definition: PV3DBase.h:61
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float areaParallelogram(const Global2DVector &a, const Global2DVector &b)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
void spinCloser(float phi[3])
void invertPoint(Global2DVector &p)
void fitParabola(const float x[3], const float y[3], float par[3])
std::pair< float, float > arc_0m
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ findArcIntersection()

pair< float, float > ThirdHitPrediction::findArcIntersection ( std::pair< float, float >  a,
std::pair< float, float >  b,
bool &  keep 
)
private

Definition at line 91 of file ThirdHitPrediction.cc.

References a, b, DummyCfis::c, runTheMatrix::keep, M_PI, SiStripPI::max, and SiStripPI::min.

91  {
92  // spin closer
93  while (b.first < a.first - M_PI)
94  b.first += 2 * M_PI;
95  while (b.first > a.first + M_PI)
96  b.first -= 2 * M_PI;
97 
98  float min, max;
99 
100  if (a.first - a.second > b.first - b.second)
101  min = a.first - a.second;
102  else {
103  min = b.first - b.second;
104  keep = false;
105  }
106 
107  if (a.first + a.second < b.first + b.second)
108  max = a.first + a.second;
109  else {
110  max = b.first + b.second;
111  keep = false;
112  }
113 
114  pair<float, float> c(0., 0.);
115 
116  if (min < max) {
117  c.first = 0.5 * (max + min);
118  c.second = 0.5 * (max - min);
119  }
120 
121  return c;
122 }
#define M_PI
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ findMinimalCircles()

pair< float, float > ThirdHitPrediction::findMinimalCircles ( float  r)
private

Definition at line 70 of file ThirdHitPrediction.cc.

References a, and sqr().

70  {
71  pair<float, float> a(0., 0.);
72 
73  if (dif.mag2() < 2 * sqr(r))
74  a = pair<float, float>(dif.phi(), 0.5 * acos(1 - 0.5 * dif.mag2() / sqr(r)));
75 
76  return a;
77 }
Geom::Phi< T > phi() const
Definition: PV2DBase.h:49
double a
Definition: hdecay.h:121
T mag2() const
Definition: PV2DBase.h:45
float sqr(float x)

◆ findRectangle()

void ThirdHitPrediction::findRectangle ( const float  x[3],
const float  y[3],
const float  par[3],
float  phi[2],
float  z[2] 
)
private

Definition at line 140 of file ThirdHitPrediction.cc.

References SiStripPI::max, SiStripPI::min, sqr(), and x.

141  {
142  // Initial guess
143  phi[0] = min(x[0], x[2]);
144  z[0] = min(y[0], y[2]);
145  phi[1] = max(x[0], x[2]);
146  z[1] = max(y[0], y[2]);
147 
148  // Extremum: position and value
149  float xe = -par[1] / (2 * par[2]);
150  float ye = par[0] - sqr(par[1]) / (4 * par[2]);
151 
152  // Check if extremum is inside the phi range
153  if (phi[0] < xe && xe < phi[1]) {
154  if (ye < z[0])
155  z[0] = ye;
156  if (ye > z[1])
157  z[1] = ye;
158  }
159 }
float sqr(float x)

◆ findTouchingCircles()

pair< float, float > ThirdHitPrediction::findTouchingCircles ( float  r)
private

Definition at line 80 of file ThirdHitPrediction.cc.

References a, DummyCfis::c, fftjetpileupestimator_calo_uncalib_cfi::c0, mag2(), SiStripOfflineCRack_cfg::p2, and sqr().

80  {
82  invertCircle(c, r);
83 
84  pair<float, float> a(0., 0.);
85  a = pair<float, float>((c - p2).phi(), 0.5 * acos(1 - 2 * sqr(r) / (c - p2).mag2()));
86 
87  return a;
88 }
void invertCircle(Global2DVector &c, float &r)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double a
Definition: hdecay.h:121
float sqr(float x)

◆ fitParabola()

void ThirdHitPrediction::fitParabola ( const float  x[3],
const float  y[3],
float  par[3] 
)
private

Definition at line 125 of file ThirdHitPrediction.cc.

References photons_cff::s4, sqr(), and x.

125  {
126  float s2 = sqr(x[0]) * (y[1] - y[2]) + sqr(x[1]) * (y[2] - y[0]) + sqr(x[2]) * (y[0] - y[1]);
127 
128  float s1 = x[0] * (y[1] - y[2]) + x[1] * (y[2] - y[0]) + x[2] * (y[0] - y[1]);
129 
130  float s3 = (x[0] - x[1]) * (x[1] - x[2]) * (x[2] - x[0]);
131  float s4 =
132  x[0] * x[1] * y[2] * (x[0] - x[1]) + x[0] * y[1] * x[2] * (x[2] - x[0]) + y[0] * x[1] * x[2] * (x[1] - x[2]);
133 
134  par[2] = s1 / s3; // a2
135  par[1] = -s2 / s3; // a1
136  par[0] = -s4 / s3; // a0
137 }
float sqr(float x)

◆ getRanges() [1/2]

void ThirdHitPrediction::getRanges ( const DetLayer layer,
float  phi[],
float  rz[] 
)

Definition at line 299 of file ThirdHitPrediction.cc.

References M_PI, SiStripPI::max, and SiStripPI::min.

Referenced by PixelTripletLowPtGenerator::hitTriplets().

299  {
300  theLayer = layer;
301 
302  if (layer)
303  initLayer(layer);
304 
305  float phi_inner[2], rz_inner[2];
306  calculateRanges(theDetRange.min(), phi_inner, rz_inner);
307 
308  float phi_outer[2], rz_outer[2];
309  calculateRanges(theDetRange.max(), phi_outer, rz_outer);
310 
311  if ((phi_inner[0] == 0. && phi_inner[1] == 0.) || (phi_outer[0] == 0. && phi_outer[1] == 0.)) {
312  phi[0] = 0.;
313  phi[1] = 0.;
314 
315  rz[0] = 0.;
316  rz[1] = 0.;
317  } else {
318  while (phi_outer[0] > phi_inner[0] + M_PI) {
319  phi_outer[0] -= 2 * M_PI;
320  phi_outer[1] -= 2 * M_PI;
321  }
322 
323  while (phi_outer[0] < phi_inner[0] - M_PI) {
324  phi_outer[0] += 2 * M_PI;
325  phi_outer[1] += 2 * M_PI;
326  }
327 
328  phi[0] = min(phi_inner[0], phi_outer[0]);
329  phi[1] = max(phi_inner[1], phi_outer[1]);
330 
331  rz[0] = min(rz_inner[0], rz_outer[0]);
332  rz[1] = max(rz_inner[1], rz_outer[1]);
333  }
334 }
void initLayer(const DetLayer *layer)
const DetLayer * theLayer
#define M_PI
void calculateRanges(float rz3, float phi[2], float rz[2])

◆ getRanges() [2/2]

void ThirdHitPrediction::getRanges ( float  rORz,
float  phi[],
float  rz[] 
)

Definition at line 337 of file ThirdHitPrediction.cc.

337 { calculateRanges(rz3, phi, rz); }
void calculateRanges(float rz3, float phi[2], float rz[2])

◆ initLayer()

void ThirdHitPrediction::initLayer ( const DetLayer layer)
private

Definition at line 426 of file ThirdHitPrediction.cc.

References GeomDetEnumerators::barrel, Surface::bounds(), GeomDetEnumerators::endcap, GeometricSearchDet::position(), CosmicsPD_Skims::radius, BarrelDetLayer::specificSurface(), BarrelDetLayer::surface(), ForwardDetLayer::surface(), Bounds::thickness(), and PV3DBase< T, PVType, FrameType >::z().

426  {
427  if (layer->location() == GeomDetEnumerators::barrel) {
428  theBarrel = true;
429  theForward = false;
430  const BarrelDetLayer& bl = dynamic_cast<const BarrelDetLayer&>(*layer);
431  float halfThickness = bl.surface().bounds().thickness() / 2;
432  float radius = bl.specificSurface().radius();
433  theDetRange = Range(radius - halfThickness, radius + halfThickness);
434  } else if (layer->location() == GeomDetEnumerators::endcap) {
435  theBarrel = false;
436  theForward = true;
437  const ForwardDetLayer& fl = dynamic_cast<const ForwardDetLayer&>(*layer);
438  float halfThickness = fl.surface().bounds().thickness() / 2;
439  float zLayer = fl.position().z();
440  theDetRange = Range(zLayer - halfThickness, zLayer + halfThickness);
441  }
442 }
virtual const Surface::PositionType & position() const
Returns position of the surface.
const BoundSurface & surface() const final
GeometricSearchDet interface.
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
T z() const
Definition: PV3DBase.h:61
virtual float thickness() const =0
PixelRecoRange< float > Range
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
const Bounds & bounds() const
Definition: Surface.h:87

◆ invertCircle()

void ThirdHitPrediction::invertCircle ( Global2DVector c,
float &  r 
)
private

Definition at line 55 of file ThirdHitPrediction.cc.

References DummyCfis::c, mag2(), LaserDQM_cfg::p1, alignCSCRings::s, and sqr().

55  {
56  float s = dif.mag2() / ((c - p1).mag2() - sqr(r));
57 
58  c = p1 + (c - p1) * s;
59  r *= fabsf(s);
60 }
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T mag2() const
Definition: PV2DBase.h:45
float sqr(float x)

◆ invertPoint()

void ThirdHitPrediction::invertPoint ( Global2DVector p)
private

Definition at line 63 of file ThirdHitPrediction.cc.

References mag2(), AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, and alignCSCRings::s.

63  {
64  float s = dif.mag2() / (p - p1).mag2();
65 
66  p = p1 + (p - p1) * s;
67 }
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T mag2() const
Definition: PV2DBase.h:45

◆ isCompatibleWithMultipleScattering()

bool ThirdHitPrediction::isCompatibleWithMultipleScattering ( GlobalPoint  g3,
const std::vector< const TrackingRecHit *> &  h,
std::vector< GlobalVector > &  localDirs,
const MultipleScatteringParametrisationMaker msmaker 
)

Definition at line 340 of file ThirdHitPrediction.cc.

References HLT_2024v14_cff::beta, DummyCfis::c, PixelRecoUtilities::curvature(), DeadROC_duringRun::dir, diffTwoXMLs::g1, diffTwoXMLs::g2, h, m_pi, mag2(), SiStripPI::max, HLTSiStripMonitoring_cff::nSigma, AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, MultipleScatteringParametrisationMaker::parametrisation(), DiDispStaMuonMonitor_cfi::pt, sigma_z, slope, sqr(), mathSSE::sqrt(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PixelTripletLowPtGenerator::hitTriplets().

343  {
344  Global2DVector p1(g1.x(), g1.y());
345  Global2DVector p2(g2.x(), g2.y());
346  Global2DVector p3(g3.x(), g3.y());
347 
348  CircleFromThreePoints circle(g1, g2, g3);
349 
350  if (circle.curvature() != 0.) {
351  Global2DVector c(circle.center().x(), circle.center().y());
352 
353  float rad2 = (p1 - c).mag2();
354  float a12 = asin(fabsf(areaParallelogram(p1 - c, p2 - c)) / rad2);
355  float a23 = asin(fabsf(areaParallelogram(p2 - c, p3 - c)) / rad2);
356 
357  float slope = (g2.z() - g1.z()) / a12;
358 
359  float rz3 = g2.z() + slope * a23;
360  float delta_z = g3.z() - rz3;
361 
362  // Transform to tt
363  vector<TransientTrackingRecHit::RecHitPointer> th;
364  for (vector<const TrackingRecHit*>::const_iterator ih = h.begin(); ih != h.end(); ih++)
365  th.push_back(theTTRecHitBuilder->build(*ih));
366 
367  float sigma1_le2 = max(th[0]->parametersError()[0][0], th[0]->parametersError()[1][1]);
368  float sigma2_le2 = max(th[1]->parametersError()[0][0], th[1]->parametersError()[1][1]);
369 
370  float sigma_z2 = (1 + a23 / a12) * (1 + a23 / a12) * sigma2_le2 + (a23 / a12) * (a23 / a12) * sigma1_le2;
371 
372  float cotTheta = slope * circle.curvature(); // == sinhEta
373  float coshEta = sqrt(1 + sqr(cotTheta)); // == 1/sinTheta
374 
375  float pt = Bz / circle.curvature();
376  float p = pt * coshEta;
377 
378  float m_pi = 0.13957018;
379  float beta = p / sqrt(sqr(p) + sqr(m_pi));
380 
382  PixelRecoPointRZ rz2(g2.perp(), g2.z());
383 
384  float sigma_z = msp(pt, cotTheta, rz2) / beta;
385 
386  // Calculate globalDirs
387  float sinTheta = 1. / coshEta;
388  float cosTheta = cotTheta * sinTheta;
389 
390  int dir;
391  if (areaParallelogram(p1 - c, p2 - c) > 0)
392  dir = 1;
393  else
394  dir = -1;
395 
396  float curvature = circle.curvature();
397 
398  {
399  Global2DVector v = (p1 - c) * curvature * dir;
400  globalDirs.push_back(GlobalVector(-v.y() * sinTheta, v.x() * sinTheta, cosTheta));
401  }
402 
403  {
404  Global2DVector v = (p2 - c) * curvature * dir;
405  globalDirs.push_back(GlobalVector(-v.y() * sinTheta, v.x() * sinTheta, cosTheta));
406  }
407 
408  {
409  Global2DVector v = (p3 - c) * curvature * dir;
410  globalDirs.push_back(GlobalVector(-v.y() * sinTheta, v.x() * sinTheta, cosTheta));
411  }
412 
413  // Multiple scattering
414  float sigma_ms = sigma_z * coshEta;
415 
416  // Local error squared
417  float sigma_le2 = max(th[2]->parametersError()[0][0], th[2]->parametersError()[1][1]);
418 
419  return (delta_z * delta_z / (sigma_ms * sigma_ms + sigma_le2 + sigma_z2) < nSigma * nSigma);
420  }
421 
422  return false;
423 }
T perp() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:61
static const double slope[3]
T curvature(T InversePt, const MagneticField &field)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const DetLayer * theLayer
MultipleScatteringParametrisation parametrisation(const DetLayer *layer, X0Source x0Source=X0Source::useX0AtEta) const
T sqrt(T t)
Definition: SSEVec.h:23
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
float areaParallelogram(const Global2DVector &a, const Global2DVector &b)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
float sigma_z
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Global3DVector GlobalVector
Definition: GlobalVector.h:10
#define m_pi
Definition: RPCConst.cc:8
float sqr(float x)

◆ printOut()

void ThirdHitPrediction::printOut ( char *  text)
private

◆ spinCloser()

void ThirdHitPrediction::spinCloser ( float  phi[3])
private

Definition at line 177 of file ThirdHitPrediction.cc.

References M_PI.

177  {
178  while (phi[1] < phi[0] - M_PI)
179  phi[1] += 2 * M_PI;
180  while (phi[1] > phi[0] + M_PI)
181  phi[1] -= 2 * M_PI;
182 
183  while (phi[2] < phi[1] - M_PI)
184  phi[2] += 2 * M_PI;
185  while (phi[2] > phi[1] + M_PI)
186  phi[2] -= 2 * M_PI;
187 }
#define M_PI

Member Data Documentation

◆ arc_0m

std::pair<float, float> ThirdHitPrediction::arc_0m
private

Definition at line 95 of file ThirdHitPrediction.h.

◆ Bz

float ThirdHitPrediction::Bz
private

Definition at line 92 of file ThirdHitPrediction.h.

◆ c0

Global2DVector ThirdHitPrediction::c0
private

Definition at line 94 of file ThirdHitPrediction.h.

◆ dif

Global2DVector ThirdHitPrediction::dif
private

Definition at line 94 of file ThirdHitPrediction.h.

◆ g1

GlobalPoint ThirdHitPrediction::g1
private

Definition at line 93 of file ThirdHitPrediction.h.

◆ g2

GlobalPoint ThirdHitPrediction::g2
private

Definition at line 93 of file ThirdHitPrediction.h.

◆ keep

bool ThirdHitPrediction::keep
private

Definition at line 97 of file ThirdHitPrediction.h.

◆ maxRatio

double ThirdHitPrediction::maxRatio
private

Definition at line 100 of file ThirdHitPrediction.h.

◆ nSigma

double ThirdHitPrediction::nSigma
private

Definition at line 99 of file ThirdHitPrediction.h.

◆ p1

Global2DVector ThirdHitPrediction::p1
private

Definition at line 94 of file ThirdHitPrediction.h.

◆ p2

Global2DVector ThirdHitPrediction::p2
private

Definition at line 94 of file ThirdHitPrediction.h.

◆ r0

float ThirdHitPrediction::r0
private

Definition at line 92 of file ThirdHitPrediction.h.

◆ rm

float ThirdHitPrediction::rm
private

Definition at line 92 of file ThirdHitPrediction.h.

◆ theBarrel

bool ThirdHitPrediction::theBarrel
private

Definition at line 82 of file ThirdHitPrediction.h.

◆ theDetRange

Range ThirdHitPrediction::theDetRange
private

Definition at line 83 of file ThirdHitPrediction.h.

◆ theForward

bool ThirdHitPrediction::theForward
private

Definition at line 82 of file ThirdHitPrediction.h.

◆ theLayer

const DetLayer* ThirdHitPrediction::theLayer
private

Definition at line 87 of file ThirdHitPrediction.h.

◆ theLine

PixelRecoLineRZ ThirdHitPrediction::theLine
private

Definition at line 85 of file ThirdHitPrediction.h.

◆ theTolerance

Margin ThirdHitPrediction::theTolerance
private

Definition at line 84 of file ThirdHitPrediction.h.

◆ theTTRecHitBuilder

const TransientTrackingRecHitBuilder* ThirdHitPrediction::theTTRecHitBuilder
private

Definition at line 89 of file ThirdHitPrediction.h.