CMS 3D CMS Logo

PixelFitterByConformalMappingAndLine.cc
Go to the documentation of this file.
2 
5 
8 
12 
17 
20 
21 #include "ConformalMappingFit.h"
24 
27 
28 using namespace std;
29 
30 template <class T>
31 T sqr(T t) {
32  return t * t;
33 }
34 
36  const TransientTrackingRecHitBuilder *ttrhBuilder,
37  const TrackerGeometry *tracker,
38  const MagneticField *field,
39  double fixImpactParameter,
40  bool useFixImpactParameter)
41  : theTTRHBuilder(ttrhBuilder),
42  theTracker(tracker),
43  theField(field),
44  theFixImpactParameter(fixImpactParameter),
45  theUseFixImpactParameter(useFixImpactParameter) {}
46 
47 std::unique_ptr<reco::Track> PixelFitterByConformalMappingAndLine::run(const std::vector<const TrackingRecHit *> &hits,
48  const TrackingRegion &region,
49  const edm::EventSetup &setup) const {
50  int nhits = hits.size();
51 
52  vector<GlobalPoint> points;
53  vector<GlobalError> errors;
54  vector<bool> isBarrel;
55 
56  for (vector<const TrackingRecHit *>::const_iterator ih = hits.begin(); ih != hits.end(); ih++) {
58  points.push_back(recHit->globalPosition());
59  errors.push_back(recHit->globalPositionError());
60  isBarrel.push_back(recHit->detUnit()->type().isBarrel());
61  }
62 
63  // if (useMultScatt) {
64  // MultipleScatteringParametrisation ms(hits[i].layer());
65  // float cotTheta = (p.z()-zVtx)/p.perp();
66  // err += sqr( ms( pt, cotTheta, PixelRecoPointRZ(0.,zVtx) ) );
67  // }
68 
69  //
70  // simple fit to get pt, phi0 used for precise calcul.
71  //
72  typedef ConformalMappingFit::PointXY PointXY;
73  vector<PointXY> xy;
74  vector<float> errRPhi2;
75  for (int i = 0; i < nhits; ++i) {
76  const GlobalPoint &point = points[i];
77  xy.push_back(PointXY(point.x() - region.origin().x(), point.y() - region.origin().y()));
78  float phiErr2 = errors[i].phierr(point);
79  errRPhi2.push_back(point.perp2() * phiErr2);
80  }
81  ConformalMappingFit parabola(xy, errRPhi2);
84  else if (nhits < 3)
85  parabola.fixImpactParmaeter(0.);
86 
87  Measurement1D curv = parabola.curvature();
88  float invPt = PixelRecoUtilities::inversePt(curv.value(), setup);
89  float valPt = (invPt > 1.e-4) ? 1. / invPt : 1.e4;
90  float errPt = PixelRecoUtilities::inversePt(curv.error(), setup) * sqr(valPt);
91  Measurement1D pt(valPt, errPt);
92  Measurement1D phi = parabola.directionPhi();
93  Measurement1D tip = parabola.impactParameter();
94 
95  //
96  // precalculate theta to correct errors:
97  //
98  vector<float> r(nhits), z(nhits), errZ(nhits);
99  float simpleCot = (points.back().z() - points.front().z()) / (points.back().perp() - points.front().perp());
100  for (int i = 0; i < nhits; ++i) {
101  const GlobalPoint &point = points[i];
102  const GlobalError &error = errors[i];
103  r[i] = sqrt(sqr(point.x() - region.origin().x()) + sqr(point.y() - region.origin().y()));
105  z[i] = point.z() - region.origin().z();
106  errZ[i] = (isBarrel[i]) ? sqrt(error.czz()) : sqrt(error.rerr(point)) * simpleCot;
107  }
108 
109  //
110  // line fit (R-Z plane)
111  //
112  RZLine rzLine(r, z, errZ);
113 
114  //
115  // parameters for track builder
116  //
117  Measurement1D zip(rzLine.intercept(), sqrt(rzLine.covii()));
118  Measurement1D cotTheta(rzLine.cotTheta(), sqrt(rzLine.covss()));
119  float chi2 = parabola.chi2() + rzLine.chi2();
120  int charge = parabola.charge();
121 
122  PixelTrackBuilder builder;
123  return std::unique_ptr<reco::Track>(
124  builder.build(pt, phi, cotTheta, tip, zip, chi2, charge, hits, theField, region.origin()));
125 }
fftjetvertexadder_cfi.errZ
errZ
Definition: fftjetvertexadder_cfi.py:39
Measurement1D
Definition: Measurement1D.h:11
ConformalMappingFit
Definition: ConformalMappingFit.h:16
mps_fire.i
i
Definition: mps_fire.py:428
TrackerGeometry.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21469
ConformalMappingFit.h
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
Measurement1D::value
double value() const
Definition: Measurement1D.h:25
Measurement1D.h
GeomDetType.h
PixelRecoUtilities::inversePt
T inversePt(T curvature, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:48
LinearFit.h
TrackingRecHit::RecHitPointer
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: TrackingRecHit.h:24
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PixelFitterByConformalMappingAndLine::theUseFixImpactParameter
const bool theUseFixImpactParameter
Definition: PixelFitterByConformalMappingAndLine.h:31
relativeConstraints.error
error
Definition: relativeConstraints.py:53
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
RZLine::chi2
float chi2() const
Definition: RZLine.h:94
ConformalMappingFit::fixImpactParmaeter
void fixImpactParmaeter(double ip)
Definition: ConformalMappingFit.h:36
TrackingRecHit.h
RZLine::covii
float covii() const
Definition: RZLine.h:91
ConformalMappingFit::curvature
Measurement1D curvature() const
Definition: ConformalMappingFit.cc:40
errors
Definition: errors.py:1
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
PixelTrackBuilder
Definition: PixelTrackBuilder.h:13
PixelFitterByConformalMappingAndLine::theTTRHBuilder
const TransientTrackingRecHitBuilder * theTTRHBuilder
Definition: PixelFitterByConformalMappingAndLine.h:27
PixelRecoUtilities.h
Point3DBase< float, GlobalTag >
nhits
Definition: HIMultiTrackSelector.h:42
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
Measurement1D::error
double error() const
Definition: Measurement1D.h:27
qcdUeDQM_cfi.tip
tip
Definition: qcdUeDQM_cfi.py:23
Basic2DVector< double >
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
ConformalMappingFit::chi2
double chi2() const
Definition: ConformalMappingFit.h:32
PixelFitterByConformalMappingAndLine::run
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region, const edm::EventSetup &setup) const override
Definition: PixelFitterByConformalMappingAndLine.cc:47
RZLine.h
ConformalMappingFit::directionPhi
Measurement1D directionPhi() const
Definition: ConformalMappingFit.cc:46
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
ConformalMappingFit::charge
int charge() const
Definition: ConformalMappingFit.cc:58
GlobalError.h
RZLine::cotTheta
float cotTheta() const
Definition: RZLine.h:88
GlobalErrorBase< double, ErrorMatrixTag >
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41
PixelTrackBuilder::build
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
Definition: PixelTrackBuilder.cc:123
PixelTrackBuilder.h
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
RZLine::covss
float covss() const
Definition: RZLine.h:90
RZLine
Definition: RZLine.h:12
GeomDet.h
std
Definition: JetResolutionObject.h:76
sqr
T sqr(T t)
Definition: PixelFitterByConformalMappingAndLine.cc:31
T
long double T
Definition: Basic3DVectorLD.h:48
ConformalMappingFit::impactParameter
Measurement1D impactParameter() const
Definition: ConformalMappingFit.cc:52
PixelFitterByConformalMappingAndLine::theField
const MagneticField * theField
Definition: PixelFitterByConformalMappingAndLine.h:29
DetLayer.h
EventSetup.h
RZLine::intercept
float intercept() const
Definition: RZLine.h:89
PixelFitterByConformalMappingAndLine.h
pixelrecoutilities::LongitudinalBendingCorrection
Definition: LongitudinalBendingCorrection.h:6
TrackingRegion
Definition: TrackingRegion.h:41
TransientTrackingRecHitBuilder.h
PixelFitterByConformalMappingAndLine::PixelFitterByConformalMappingAndLine
PixelFitterByConformalMappingAndLine(const TransientTrackingRecHitBuilder *ttrhBuilder, const TrackerGeometry *tracker, const MagneticField *field, double fixImpactParameter, bool useFixImpactParameter)
Definition: PixelFitterByConformalMappingAndLine.cc:35
point
*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
LongitudinalBendingCorrection.h
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MagneticField
Definition: MagneticField.h:19
TransientTrackingRecHitBuilder
Definition: TransientTrackingRecHitBuilder.h:6
GlobalPoint.h
vertexPlots.e4
e4
Definition: vertexPlots.py:64
TrackerGeometry
Definition: TrackerGeometry.h:14
PixelFitterByConformalMappingAndLine::theFixImpactParameter
const double theFixImpactParameter
Definition: PixelFitterByConformalMappingAndLine.h:30
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54