CMS 3D CMS Logo

VectorHitBuilderAlgorithm.cc
Go to the documentation of this file.
7 
9  VectorHitCollection& vhAcc,
10  VectorHitCollection& vhRej,
13  LogDebug("VectorHitBuilderAlgorithm") << "Run VectorHitBuilderAlgorithm ... \n";
14  const auto* clustersPhase2Collection = clusters.product();
15 
16  //loop over the DetSetVector
17  LogDebug("VectorHitBuilderAlgorithm") << "with #clusters : " << clustersPhase2Collection->size() << std::endl;
18  for (auto dSViter : *clustersPhase2Collection) {
19  unsigned int rawDetId1(dSViter.detId());
20  DetId detId1(rawDetId1);
21  DetId lowerDetId, upperDetId;
22  if (tkTopo_->isLower(detId1)) {
23  lowerDetId = detId1;
24  upperDetId = tkTopo_->partnerDetId(detId1);
25  } else
26  continue;
27 
28  DetId detIdStack = tkTopo_->stack(detId1);
29 
30  //debug
31  LogDebug("VectorHitBuilderAlgorithm") << " DetId stack : " << detIdStack.rawId() << std::endl;
32  LogDebug("VectorHitBuilderAlgorithm") << " DetId lower set of clusters : " << lowerDetId.rawId();
33  LogDebug("VectorHitBuilderAlgorithm") << " DetId upper set of clusters : " << upperDetId.rawId() << std::endl;
34 
35  const GeomDet* gd;
36  const StackGeomDet* stackDet;
37  const auto& it_detLower = dSViter;
38  const auto& it_detUpper = clustersPhase2Collection->find(upperDetId);
39 
40  if (it_detUpper != clustersPhase2Collection->end()) {
41  gd = tkGeom_->idToDet(detIdStack);
42  stackDet = dynamic_cast<const StackGeomDet*>(gd);
43  buildVectorHits(vhAcc, vhRej, detIdStack, stackDet, clusters, it_detLower, *it_detUpper);
44  }
45  }
46  LogDebug("VectorHitBuilderAlgorithm") << "End run VectorHitBuilderAlgorithm ... \n";
47 }
48 
51  const Detset& theLowerDetSet,
52  const Detset& theUpperDetSet) const {
53  if (theLowerDetSet.size() == 1 && theUpperDetSet.size() == 1)
54  return true;
55 
56  //order lower clusters in u
57  std::vector<Phase2TrackerCluster1D> lowerClusters;
58  lowerClusters.reserve(theLowerDetSet.size());
59  if (theLowerDetSet.size() > 1)
60  LogDebug("VectorHitBuilderAlgorithm") << " more than 1 lower cluster! " << std::endl;
61  if (theUpperDetSet.size() > 1)
62  LogDebug("VectorHitBuilderAlgorithm") << " more than 1 upper cluster! " << std::endl;
63  for (const_iterator cil = theLowerDetSet.begin(); cil != theLowerDetSet.end(); ++cil) {
65  lowerClusters.push_back(*clusterLower);
66  }
67  return true;
68 }
69 
71  Local3DPoint& posupper,
72  LocalError& errlower,
73  LocalError& errupper) const {
74  return true;
75 }
76 
77 //----------------------------------------------------------------------------
78 //ERICA::in the DT code the global position is used to compute the alpha angle and put a cut on that.
80  VectorHitCollection& vhRej,
81  DetId detIdStack,
82  const StackGeomDet* stack,
84  const Detset& theLowerDetSet,
85  const Detset& theUpperDetSet,
86  const std::vector<bool>& phase2OTClustersToSkip) const {
87  if (checkClustersCompatibilityBeforeBuilding(clusters, theLowerDetSet, theUpperDetSet)) {
88  LogDebug("VectorHitBuilderAlgorithm") << " compatible -> continue ... " << std::endl;
89  } else {
90  LogTrace("VectorHitBuilderAlgorithm") << " not compatible, going to the next cluster";
91  }
92 
93  edmNew::DetSetVector<VectorHit>::FastFiller vh_colAcc(vhAcc, detIdStack);
94  edmNew::DetSetVector<VectorHit>::FastFiller vh_colRej(vhRej, detIdStack);
95 
96  unsigned int layerStack = tkTopo_->layer(stack->geographicalId());
97  if (stack->subDetector() == GeomDetEnumerators::SubDetector::P2OTB)
98  LogDebug("VectorHitBuilderAlgorithm") << " \t is barrel. " << std::endl;
99  if (stack->subDetector() == GeomDetEnumerators::SubDetector::P2OTEC)
100  LogDebug("VectorHitBuilderAlgorithm") << " \t is endcap. " << std::endl;
101  LogDebug("VectorHitBuilderAlgorithm") << " \t layer is : " << layerStack << std::endl;
102 
103  float cut = 0.0;
104  if (stack->subDetector() == GeomDetEnumerators::SubDetector::P2OTB)
105  cut = barrelCut_.at(layerStack);
106  if (stack->subDetector() == GeomDetEnumerators::SubDetector::P2OTEC)
107  cut = endcapCut_.at(layerStack);
108  LogDebug("VectorHitBuilderAlgorithm") << " \t the cut is:" << cut << std::endl;
109 
110  //only cache local parameters for upper cluster as we loop over lower clusters only once anyway
111  std::vector<std::pair<LocalPoint, LocalError>> localParamsUpper;
112  std::vector<const PixelGeomDetUnit*> localGDUUpper;
113 
114  const PixelGeomDetUnit* gduUpp = dynamic_cast<const PixelGeomDetUnit*>(stack->upperDet());
115  for (auto const& clusterUpper : theUpperDetSet) {
116  localGDUUpper.push_back(gduUpp);
117  localParamsUpper.push_back(cpe_->localParameters(clusterUpper, *gduUpp));
118  }
119  int upperIterator = 0;
120  const PixelGeomDetUnit* gduLow = dynamic_cast<const PixelGeomDetUnit*>(stack->lowerDet());
121  for (const_iterator cil = theLowerDetSet.begin(); cil != theLowerDetSet.end(); ++cil) {
122  LogDebug("VectorHitBuilderAlgorithm") << " lower clusters " << std::endl;
124 #ifdef EDM_ML_DEBUG
125  printCluster(stack->lowerDet(), &*cluL);
126 #endif
127  auto&& lparamsLow = cpe_->localParameters(*cluL, *gduLow);
128  upperIterator = 0;
129  for (const_iterator ciu = theUpperDetSet.begin(); ciu != theUpperDetSet.end(); ++ciu) {
130  LogDebug("VectorHitBuilderAlgorithm") << "\t upper clusters " << std::endl;
132 #ifdef EDM_ML_DEBUG
133  printCluster(stack->upperDet(), &*cluU);
134 #endif
135  //applying the parallax correction
136  double pC = computeParallaxCorrection(
137  gduLow, lparamsLow.first, localGDUUpper[upperIterator], localParamsUpper[upperIterator].first);
138  LogDebug("VectorHitBuilderAlgorithm") << " \t parallax correction:" << pC << std::endl;
139  double lpos_upp_corr = 0.0;
140  double lpos_low_corr = 0.0;
141  auto const localUpperX = localParamsUpper[upperIterator].first.x();
142  if (localUpperX > lparamsLow.first.x()) {
143  if (localUpperX > 0) {
144  lpos_low_corr = lparamsLow.first.x();
145  lpos_upp_corr = localParamsUpper[upperIterator].first.x() - std::abs(pC);
146  } else if (localUpperX < 0) {
147  lpos_low_corr = lparamsLow.first.x() + std::abs(pC);
148  lpos_upp_corr = localUpperX;
149  }
150  } else if (localUpperX < lparamsLow.first.x()) {
151  if (localUpperX > 0) {
152  lpos_low_corr = lparamsLow.first.x() - std::abs(pC);
153  lpos_upp_corr = localUpperX;
154  } else if (localUpperX < 0) {
155  lpos_low_corr = lparamsLow.first.x();
156  lpos_upp_corr = localUpperX + std::abs(pC);
157  }
158  } else {
159  if (localUpperX > 0) {
160  lpos_low_corr = lparamsLow.first.x();
161  lpos_upp_corr = localUpperX - std::abs(pC);
162  } else if (localUpperX < 0) {
163  lpos_low_corr = lparamsLow.first.x();
164  lpos_upp_corr = localUpperX + std::abs(pC);
165  }
166  }
167 
168  LogDebug("VectorHitBuilderAlgorithm") << " \t local pos upper corrected (x):" << lpos_upp_corr << std::endl;
169  LogDebug("VectorHitBuilderAlgorithm") << " \t local pos lower corrected (x):" << lpos_low_corr << std::endl;
170 
171  double width = lpos_low_corr - lpos_upp_corr;
172  LogDebug("VectorHitBuilderAlgorithm") << " \t width: " << width << std::endl;
173 
174  //old cut: indipendent from layer
175  //building my tolerance : 10*sigma
176  //double delta = 10.0 * sqrt(lparamsLow.second.xx() + localParamsUpper[upperIterator].second.xx());
177  //LogDebug("VectorHitBuilderAlgorithm") << " \t delta: " << delta << std::endl;
178  //if( (lpos_upp_corr < lpos_low_corr + delta) &&
179  // (lpos_upp_corr > lpos_low_corr - delta) ){
180  //new cut: dependent on layers
181  if (std::abs(width) < cut) {
182  LogDebug("VectorHitBuilderAlgorithm") << " accepting VH! " << std::endl;
183  VectorHit vh = buildVectorHit(stack, cluL, cluU);
184  //protection: the VH can also be empty!!
185  if (vh.isValid()) {
186  vh_colAcc.push_back(vh);
187  }
188 
189  } else {
190  LogDebug("VectorHitBuilderAlgorithm") << " rejecting VH: " << std::endl;
191  //storing vh rejected for combinatiorial studies
192  VectorHit vh = buildVectorHit(stack, cluL, cluU);
193  if (vh.isValid()) {
194  vh_colRej.push_back(vh);
195  }
196  }
197  upperIterator += 1;
198  }
199  }
200 }
201 
204  Phase2TrackerCluster1DRef upper) const {
205  LogTrace("VectorHitBuilderAlgorithm") << "Build VH with: ";
206 #ifdef EDM_ML_DEBUG
207  printCluster(stack->upperDet(), &*upper);
208 #endif
209  const PixelGeomDetUnit* geomDetLower = static_cast<const PixelGeomDetUnit*>(stack->lowerDet());
210  const PixelGeomDetUnit* geomDetUpper = static_cast<const PixelGeomDetUnit*>(stack->upperDet());
211 
212  auto&& lparamsLower = cpe_->localParameters(*lower, *geomDetLower); // x, y, z, e2_xx, e2_xy, e2_yy
213  Global3DPoint gparamsLower = geomDetLower->surface().toGlobal(lparamsLower.first);
214  LogTrace("VectorHitBuilderAlgorithm") << "\t lower global pos: " << gparamsLower;
215 
216  auto&& lparamsUpper = cpe_->localParameters(*upper, *geomDetUpper);
217  Global3DPoint gparamsUpper = geomDetUpper->surface().toGlobal(lparamsUpper.first);
218  LogTrace("VectorHitBuilderAlgorithm") << "\t upper global pos: " << gparamsUpper;
219 
220  //local parameters of upper cluster in lower system of reference
221  Local3DPoint lparamsUpperInLower = geomDetLower->surface().toLocal(gparamsUpper);
222 
223  LogTrace("VectorHitBuilderAlgorithm") << "\t lower global pos: " << gparamsLower;
224  LogTrace("VectorHitBuilderAlgorithm") << "\t upper global pos: " << gparamsUpper;
225 
226  LogTrace("VectorHitBuilderAlgorithm") << "A:\t lower local pos: " << lparamsLower.first
227  << " with error: " << lparamsLower.second << std::endl;
228  LogTrace("VectorHitBuilderAlgorithm") << "A:\t upper local pos in the lower sof " << lparamsUpperInLower
229  << " with error: " << lparamsUpper.second << std::endl;
230 
231  bool ok =
232  checkClustersCompatibility(lparamsLower.first, lparamsUpper.first, lparamsLower.second, lparamsUpper.second);
233 
234  if (ok) {
235  AlgebraicSymMatrix22 covMat2Dzx;
236  double chi22Dzx = 0.0;
237  Local3DPoint pos2Dzx;
238  Local3DVector dir2Dzx;
239  fit2Dzx(lparamsLower.first,
240  lparamsUpperInLower,
241  lparamsLower.second,
242  lparamsUpper.second,
243  pos2Dzx,
244  dir2Dzx,
245  covMat2Dzx,
246  chi22Dzx);
247  LogTrace("VectorHitBuilderAlgorithm") << "\t pos2Dzx: " << pos2Dzx;
248  LogTrace("VectorHitBuilderAlgorithm") << "\t dir2Dzx: " << dir2Dzx;
249  LogTrace("VectorHitBuilderAlgorithm") << "\t cov2Dzx: " << covMat2Dzx;
250  VectorHit2D vh2Dzx = VectorHit2D(pos2Dzx, dir2Dzx, covMat2Dzx, chi22Dzx);
251 
252  AlgebraicSymMatrix22 covMat2Dzy;
253  double chi22Dzy = 0.0;
254  Local3DPoint pos2Dzy;
255  Local3DVector dir2Dzy;
256  fit2Dzy(lparamsLower.first,
257  lparamsUpperInLower,
258  lparamsLower.second,
259  lparamsUpper.second,
260  pos2Dzy,
261  dir2Dzy,
262  covMat2Dzy,
263  chi22Dzy);
264  LogTrace("VectorHitBuilderAlgorithm") << "\t pos2Dzy: " << pos2Dzy;
265  LogTrace("VectorHitBuilderAlgorithm") << "\t dir2Dzy: " << dir2Dzy;
266  LogTrace("VectorHitBuilderAlgorithm") << "\t cov2Dzy: " << covMat2Dzy;
267  VectorHit2D vh2Dzy = VectorHit2D(pos2Dzy, dir2Dzy, covMat2Dzy, chi22Dzy);
268 
269  OmniClusterRef lowerOmni(lower);
270  OmniClusterRef upperOmni(upper);
271 
272  Global3DPoint gPositionLower = VectorHit::phase2clusterGlobalPos(geomDetLower, lower);
273  Global3DPoint gPositionUpper = VectorHit::phase2clusterGlobalPos(geomDetUpper, upper);
274  GlobalError gErrorLower = VectorHit::phase2clusterGlobalPosErr(geomDetLower);
275  GlobalError gErrorUpper = VectorHit::phase2clusterGlobalPosErr(geomDetUpper);
276 
277  if (gPositionLower.perp() > gPositionUpper.perp()) {
278  std::swap(gPositionLower, gPositionUpper);
279  std::swap(gErrorLower, gErrorUpper);
280  }
281 
282  const CurvatureAndPhi curvatureAndPhi = curvatureANDphi(gPositionLower, gPositionUpper, gErrorLower, gErrorUpper);
283  VectorHit vh = VectorHit(*stack,
284  vh2Dzx,
285  vh2Dzy,
286  lowerOmni,
287  upperOmni,
288  curvatureAndPhi.curvature,
289  curvatureAndPhi.curvatureError,
290  curvatureAndPhi.phi);
291  return vh;
292  }
293 
294  return VectorHit();
295 }
296 
298  const Local3DPoint lpCO,
299  const LocalError leCI,
300  const LocalError leCO,
301  Local3DPoint& pos,
303  AlgebraicSymMatrix22& covMatrix,
304  double& chi2) const {
305  float x[2] = {lpCI.z(), lpCO.z()};
306  float y[2] = {lpCI.x(), lpCO.x()};
307  float sqCI = sqrt(leCI.xx());
308  float sqCO = sqrt(leCO.xx());
309  float sigy2[2] = {sqCI * sqCI, sqCO * sqCO};
310 
311  fit(x, y, sigy2, pos, dir, covMatrix, chi2);
312 
313  return;
314 }
315 
317  const Local3DPoint lpCO,
318  const LocalError leCI,
319  const LocalError leCO,
320  Local3DPoint& pos,
322  AlgebraicSymMatrix22& covMatrix,
323  double& chi2) const {
324  float x[2] = {lpCI.z(), lpCO.z()};
325  float y[2] = {lpCI.y(), lpCO.y()};
326  float sqCI = sqrt(leCI.yy());
327  float sqCO = sqrt(leCO.yy());
328  float sigy2[2] = {sqCI * sqCI, sqCO * sqCO};
329 
330  fit(x, y, sigy2, pos, dir, covMatrix, chi2);
331 
332  return;
333 }
334 
336  float y[2],
337  float sigy2[2],
338  Local3DPoint& pos,
340  AlgebraicSymMatrix22& covMatrix,
341  double& chi2) const {
342  float slope = 0.;
343  float intercept = 0.;
344  float covss = 0.;
345  float covii = 0.;
346  float covsi = 0.;
347 
348  linearFit(x, y, 2, sigy2, slope, intercept, covss, covii, covsi);
349 
350  covMatrix[0][0] = covss; // this is var(dy/dz)
351  covMatrix[1][1] = covii; // this is var(y)
352  covMatrix[1][0] = covsi; // this is cov(dy/dz,y)
353 
354  for (unsigned int j = 0; j < 2; j++) {
355  const double ypred = intercept + slope * x[j];
356  const double dy = (y[j] - ypred) / sqrt(sigy2[j]);
357  chi2 += dy * dy;
358  }
359 
360  pos = Local3DPoint(intercept, 0., 0.);
361  //difference in z is the difference of the lowermost and the uppermost cluster z pos
362  float slopeZ = x[1] - x[0];
363  dir = LocalVector(slope, 0., slopeZ);
364 }
365 
367  Global3DPoint gPositionUpper,
368  GlobalError gErrorLower,
369  GlobalError gErrorUpper) const {
371 
372  float curvature = -999.;
373  float errorCurvature = -999.;
374  float phi = -999.;
375 
376  float h1 = gPositionLower.x() * gPositionUpper.y() - gPositionUpper.x() * gPositionLower.y();
377 
378  //determine sign of curvature
379  AlgebraicVector2 n1;
380  n1[0] = -gPositionLower.y();
381  n1[1] = gPositionLower.x();
382  AlgebraicVector2 n2;
383  n2[0] = gPositionUpper.x() - gPositionLower.x();
384  n2[1] = gPositionUpper.y() - gPositionLower.y();
385 
386  double n3 = n1[0] * n2[0] + n1[1] * n2[1];
387  double signCurv = -copysign(1.0, n3);
388  double phi1 = atan2(gPositionUpper.y() - gPositionLower.y(), gPositionUpper.x() - gPositionLower.x());
389 
390  double x2Low = pow(gPositionLower.x(), 2);
391  double y2Low = pow(gPositionLower.y(), 2);
392  double x2Up = pow(gPositionUpper.x(), 2);
393  double y2Up = pow(gPositionUpper.y(), 2);
394 
395  if (h1 != 0) {
396  double h2 = 2 * h1;
397  double h2Inf = 1. / (2 * h1);
398  double r12 = gPositionLower.perp2();
399  double r22 = gPositionUpper.perp2();
400  double h3 = pow(n2[0], 2) + pow(n2[1], 2);
401  double h4 = -x2Low * gPositionUpper.x() + gPositionLower.x() * x2Up + gPositionLower.x() * y2Up -
402  gPositionUpper.x() * y2Low;
403  double h5 =
404  x2Low * gPositionUpper.y() - x2Up * gPositionLower.y() + y2Low * gPositionUpper.y() - gPositionLower.y() * y2Up;
405 
406  //radius of circle
407  double invRho2 = (4. * h1 * h1) / (r12 * r22 * h3);
408  curvature = sqrt(invRho2);
409 
410  //center of circle
411  double xcentre = h5 / h2;
412  double ycentre = h4 / h2;
413 
414  //to compute phi at the cluster points
415  double xtg = gPositionLower.y() - ycentre;
416  double ytg = -(gPositionLower.x() - xcentre);
417 
418  //to compute phi at the origin
419  phi = atan2(ytg, xtg);
420 
422 
423  double denom1 = 1. / sqrt(r12 * r22 * h3);
424  double denom2 = 1. / (pow(r12 * r22 * h3, 1.5));
425  jacobian[0][0] = 1.0; // dx1/dx1 dx1/dy1 dx2/dx1 dy2/dx1
426  jacobian[1][1] = 1.0; //dy1/dx1 dy1/dy1 dy2/dx1 dy2/dx1
427  jacobian[2][0] =
428  -2. * ((h1 * (gPositionLower.x() * r22 * h3 + (gPositionLower.x() - gPositionUpper.x()) * r12 * r22)) * denom2 -
429  (gPositionUpper.y()) * denom1); // dkappa/dx1
430  jacobian[2][1] =
431  -2. * ((gPositionUpper.x()) * denom1 +
432  (h1 * (gPositionLower.y() * r22 * h3 + r12 * r22 * (gPositionLower.y() - gPositionUpper.y()))) *
433  denom2); // dkappa/dy1
434  jacobian[2][2] =
435  -2. * ((gPositionLower.y()) * denom1 +
436  (h1 * (gPositionUpper.x() * r12 * h3 - (gPositionLower.x() - gPositionUpper.x()) * r12 * r22)) *
437  denom2); // dkappa/dx2
438  jacobian[2][3] =
439  -2. * ((h1 * (gPositionUpper.y() * r12 * h3 - r12 * r22 * (gPositionLower.y() - gPositionUpper.y()))) * denom2 -
440  (gPositionLower.x()) * denom1); // dkappa/dy2
441  AlgebraicVector2 mVector;
442  //to compute phi at the cluster points
443  mVector[0] = (gPositionLower.y() - ycentre) * invRho2; // dphi/dxcentre
444  mVector[1] = -(gPositionLower.x() - xcentre) * invRho2; // dphi/dycentre
445  //to compute phi at the origin
446 
447  double h22Inv = 1. / pow(h2, 2);
448 
450  kMatrix[0][0] =
451  2. * ((gPositionLower.x() * gPositionUpper.y()) * h2Inf - (gPositionUpper.y() * h5) * h22Inv); // dxm/dx1
452  kMatrix[0][1] = (2. * gPositionUpper.x() * h5) * h22Inv -
453  (x2Up + y2Up - 2. * gPositionLower.y() * gPositionUpper.y()) * h2Inf; // dxm/dy1
454  kMatrix[0][2] =
455  2. * ((gPositionLower.y() * h5) * h22Inv - (gPositionUpper.x() * gPositionLower.y()) * h2Inf); // dxm/dx2
456  kMatrix[0][3] = (x2Low + y2Low - 2. * gPositionUpper.y() * gPositionLower.y()) * h2Inf -
457  (2. * gPositionLower.x() * h5) * h22Inv; // dxm/dy2
458  kMatrix[1][0] = (x2Up - 2. * gPositionLower.x() * gPositionUpper.x() + y2Up) * h2Inf -
459  (2. * gPositionUpper.y() * h4) * h22Inv; // dym/dx1
460  kMatrix[1][1] =
461  2. * ((gPositionUpper.x() * h4) * h22Inv - (gPositionUpper.x() * gPositionLower.y()) * h2Inf); // dym/dy1
462  kMatrix[1][2] = (2. * gPositionLower.y() * h4) * h22Inv -
463  (x2Low - 2. * gPositionUpper.x() * gPositionLower.x() + y2Low) * h2Inf; // dym/dx2
464  kMatrix[1][3] =
465  2. * (gPositionLower.x() * gPositionUpper.y()) * h2Inf - (gPositionLower.x() * h4) * h22Inv; // dym/dy2
466 
467  AlgebraicVector4 nMatrix = mVector * kMatrix;
468  jacobian[3][0] = nMatrix[0]; // dphi/(dx1,dy1,dx2,dy2)
469  jacobian[3][1] = nMatrix[1]; // dphi/(dx1,dy1,dx2,dy2)
470  jacobian[3][2] = nMatrix[2]; // dphi/(dx1,dy1,dx2,dy2)
471  jacobian[3][3] = nMatrix[3]; // dphi/(dx1,dy1,dx2,dy2)
472 
473  //assign correct sign to the curvature errors
474  if ((signCurv < 0 && curvature > 0) || (signCurv > 0 && curvature < 0)) {
475  curvature = -curvature;
476  for (int i = 0; i < 4; i++) {
477  jacobian[2][i] = -jacobian[2][i];
478  }
479  }
480 
481  // bring phi in the same quadrant as phi1
482  if (deltaPhi(phi, phi1) > M_PI / 2.) {
483  phi = phi + M_PI;
484  if (phi > M_PI)
485  phi = phi - 2. * M_PI;
486  }
487 
488  //computing the curvature error
489  AlgebraicVector4 curvatureJacobian;
490  for (int i = 0; i < 4; i++) {
491  curvatureJacobian[i] = jacobian[2][i];
492  }
493 
495 
496  gErrors[0][0] = gErrorLower.cxx();
497  gErrors[0][1] = gErrorLower.cyx();
498  gErrors[1][0] = gErrorLower.cyx();
499  gErrors[1][1] = gErrorLower.cyy();
500  gErrors[2][2] = gErrorUpper.cxx();
501  gErrors[2][3] = gErrorUpper.cyx();
502  gErrors[3][2] = gErrorUpper.cyx();
503  gErrors[3][3] = gErrorUpper.cyy();
504 
505  AlgebraicVector4 temp = curvatureJacobian;
506  temp = temp * gErrors;
507  errorCurvature = temp[0] * curvatureJacobian[0] + temp[1] * curvatureJacobian[1] + temp[2] * curvatureJacobian[2] +
508  temp[3] * curvatureJacobian[3];
509  }
510 
511  result.curvature = curvature;
512  result.curvatureError = errorCurvature;
513  result.phi = phi;
514  return result;
515 }
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
void push_back(data_type const &d)
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit *geomDet, ClusterRef cluster)
Definition: VectorHit.cc:114
Local3DVector LocalVector
Definition: LocalVector.h:12
T perp() const
Definition: PV3DBase.h:69
void buildVectorHits(VectorHitCollection &vhAcc, VectorHitCollection &vhRej, DetId detIdStack, const StackGeomDet *stack, edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D >> clusters, const Detset &DSVinner, const Detset &DSVouter, const std::vector< bool > &phase2OTClustersToSkip=std::vector< bool >()) const override
void fit(float x[2], float y[2], float sigy[2], Local3DPoint &pos, Local3DVector &dir, AlgebraicSymMatrix22 &covMatrix, double &chi2) const
T z() const
Definition: PV3DBase.h:61
static const double slope[3]
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
VectorHit buildVectorHit(const StackGeomDet *stack, Phase2TrackerCluster1DRef lower, Phase2TrackerCluster1DRef upper) const override
T curvature(T InversePt, const MagneticField &field)
unsigned int layer(const DetId &id) const
#define LogTrace(id)
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
void fit2Dzy(const Local3DPoint lpCI, const Local3DPoint lpCO, const LocalError leCI, const LocalError leCO, Local3DPoint &pos, Local3DVector &dir, AlgebraicSymMatrix22 &covMatrix, double &chi2) const
ROOT::Math::SVector< double, 2 > AlgebraicVector2
bool isValid() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
T sqrt(T t)
Definition: SSEVec.h:19
bool checkClustersCompatibilityBeforeBuilding(edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D >> clusters, const Detset &theLowerDetSet, const Detset &theUpperDetSet) const
const ClusterParameterEstimator< Phase2TrackerCluster1D > * cpe_
stack
Definition: svgfig.py:559
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint32_t stack(const DetId &id) const
DetId partnerDetId(const DetId &id) const
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit *geomDet)
Definition: VectorHit.cc:135
ROOT::Math::SVector< double, 4 > AlgebraicVector4
const TrackerGeomDet * idToDet(DetId) const override
#define M_PI
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
bool isLower(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void run(edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D >> clusters, VectorHitCollection &vhAcc, VectorHitCollection &vhRej, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersAcc, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersRej) const override
bool checkClustersCompatibility(Local3DPoint &posinner, Local3DPoint &posouter, LocalError &errinner, LocalError &errouter) const
void printCluster(const GeomDet *geomDetUnit, const Phase2TrackerCluster1D *cluster) const
T perp2() const
Definition: PV3DBase.h:68
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
double computeParallaxCorrection(const PixelGeomDetUnit *, const Point3DBase< float, LocalTag > &, const PixelGeomDetUnit *, const Point3DBase< float, LocalTag > &) const
size_type size() const
Definition: DetSetNew.h:65
void linearFit(T const *__restrict__ x, T const *__restrict__ y, int ndat, T const *__restrict__ sigy2, T &slope, T &intercept, T &covss, T &covii, T &covsi)
Definition: LinearFit.h:29
void fit2Dzx(const Local3DPoint lpCI, const Local3DPoint lpCO, const LocalError leCI, const LocalError leCO, Local3DPoint &pos, Local3DVector &dir, AlgebraicSymMatrix22 &covMatrix, double &chi2) const
iterator end()
Definition: DetSetNew.h:53
float x
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
float xx() const
Definition: LocalError.h:22
#define LogDebug(id)
CurvatureAndPhi curvatureANDphi(Global3DPoint gPositionLower, Global3DPoint gPositionUpper, GlobalError gErrorLower, GlobalError gErrorUpper) const
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
iterator begin()
Definition: DetSetNew.h:51