CMS 3D CMS Logo

PixelFitterByConformalMappingAndLine.cc
Go to the documentation of this file.
2 
5 
9 
14 
17 
18 #include "ConformalMappingFit.h"
21 
24 
25 using namespace std;
26 
27 template <class T>
28 T sqr(T t) {
29  return t * t;
30 }
31 
33  const TransientTrackingRecHitBuilder *ttrhBuilder,
34  const TrackerGeometry *tracker,
35  const MagneticField *field,
36  double fixImpactParameter,
37  bool useFixImpactParameter)
38  : theTTRHBuilder(ttrhBuilder),
39  theTracker(tracker),
40  theField(field),
41  theFixImpactParameter(fixImpactParameter),
42  theUseFixImpactParameter(useFixImpactParameter) {}
43 
44 std::unique_ptr<reco::Track> PixelFitterByConformalMappingAndLine::run(const std::vector<const TrackingRecHit *> &hits,
45  const TrackingRegion &region) const {
46  int nhits = hits.size();
47 
48  vector<GlobalPoint> points;
49  vector<GlobalError> errors;
50  vector<bool> isBarrel;
51 
52  for (vector<const TrackingRecHit *>::const_iterator ih = hits.begin(); ih != hits.end(); ih++) {
54  points.push_back(recHit->globalPosition());
55  errors.push_back(recHit->globalPositionError());
56  isBarrel.push_back(recHit->detUnit()->type().isBarrel());
57  }
58 
59  // if (useMultScatt) {
60  // MultipleScatteringParametrisation ms(hits[i].layer());
61  // float cotTheta = (p.z()-zVtx)/p.perp();
62  // err += sqr( ms( pt, cotTheta, PixelRecoPointRZ(0.,zVtx) ) );
63  // }
64 
65  //
66  // simple fit to get pt, phi0 used for precise calcul.
67  //
68  typedef ConformalMappingFit::PointXY PointXY;
69  vector<PointXY> xy;
70  vector<float> errRPhi2;
71  for (int i = 0; i < nhits; ++i) {
72  const GlobalPoint &point = points[i];
73  xy.push_back(PointXY(point.x() - region.origin().x(), point.y() - region.origin().y()));
74  float phiErr2 = errors[i].phierr(point);
75  errRPhi2.push_back(point.perp2() * phiErr2);
76  }
77  ConformalMappingFit parabola(xy, errRPhi2);
80  else if (nhits < 3)
81  parabola.fixImpactParmaeter(0.);
82 
83  Measurement1D curv = parabola.curvature();
84  float invPt = PixelRecoUtilities::inversePt(curv.value(), *theField);
85  float valPt = (invPt > 1.e-4) ? 1. / invPt : 1.e4;
86  float errPt = PixelRecoUtilities::inversePt(curv.error(), *theField) * sqr(valPt);
87  Measurement1D pt(valPt, errPt);
88  Measurement1D phi = parabola.directionPhi();
89  Measurement1D tip = parabola.impactParameter();
90 
91  //
92  // precalculate theta to correct errors:
93  //
94  vector<float> r(nhits), z(nhits), errZ(nhits);
95  float simpleCot = (points.back().z() - points.front().z()) / (points.back().perp() - points.front().perp());
96  for (int i = 0; i < nhits; ++i) {
97  const GlobalPoint &point = points[i];
98  const GlobalError &error = errors[i];
99  r[i] = sqrt(sqr(point.x() - region.origin().x()) + sqr(point.y() - region.origin().y()));
101  z[i] = point.z() - region.origin().z();
102  errZ[i] = (isBarrel[i]) ? sqrt(error.czz()) : sqrt(error.rerr(point)) * simpleCot;
103  }
104 
105  //
106  // line fit (R-Z plane)
107  //
108  RZLine rzLine(r, z, errZ);
109 
110  //
111  // parameters for track builder
112  //
113  Measurement1D zip(rzLine.intercept(), sqrt(rzLine.covii()));
114  Measurement1D cotTheta(rzLine.cotTheta(), sqrt(rzLine.covss()));
115  float chi2 = parabola.chi2() + rzLine.chi2();
116  int charge = parabola.charge();
117 
118  PixelTrackBuilder builder;
119  return std::unique_ptr<reco::Track>(
120  builder.build(pt, phi, cotTheta, tip, zip, chi2, charge, hits, theField, region.origin()));
121 }
float intercept() const
Definition: RZLine.h:90
Measurement1D directionPhi() const
float covss() const
Definition: RZLine.h:91
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:90
reco::Track * build(const Measurement1D &pt, const Measurement1D &phi, const Measurement1D &cotTheta, const Measurement1D &tip, const Measurement1D &zip, float chi2, int charge, const std::vector< const TrackingRecHit *> &hits, const MagneticField *mf, const GlobalPoint &reference=GlobalPoint(0, 0, 0)) const
PixelFitterByConformalMappingAndLine(const TransientTrackingRecHitBuilder *ttrhBuilder, const TrackerGeometry *tracker, const MagneticField *field, double fixImpactParameter, bool useFixImpactParameter)
T sqrt(T t)
Definition: SSEVec.h:23
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
float covii() const
Definition: RZLine.h:92
T inversePt(T curvature, const MagneticField &field)
std::shared_ptr< TrackingRecHit const > RecHitPointer
void fixImpactParmaeter(double ip)
Definition: RZLine.h:12
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit *> &hits, const TrackingRegion &region) const override
Measurement1D impactParameter() const
float chi2() const
Definition: RZLine.h:95
double value() const
Definition: Measurement1D.h:25
float cotTheta() const
Definition: RZLine.h:89
double error() const
Definition: Measurement1D.h:27
Definition: errors.py:1
Measurement1D curvature() const
long double T
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const TransientTrackingRecHitBuilder * theTTRHBuilder