CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfConstraintAtVertex.cc
Go to the documentation of this file.
2 
4 
12 // #include "TrackingTools/GsfTools/interface/GaussianSumUtilities1D.h"
13 // #include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h"
14 // #include "TrackingTools/GsfTools/interface/MultiGaussianStateTransform.h"
19 
21 {
22  edm::ESHandle<TrackerGeometry> geometryHandle;
23  setup.get<TrackerDigiGeometryRecord>().get(geometryHandle);
24  geometry_ = geometryHandle.product();
25 
26  edm::ESHandle<MagneticField> magFieldHandle;
27  setup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
28  magField_ = magFieldHandle.product();
29 
30 // edm::ESHandle<Propagator> propagatorHandle;
31 // setup.get<TrackingComponentsRecord>().get(propagatorName_,propagatorHandle);
32 // propagator_ = propagatorHandle.product();
35 }
36 
38 {
39  delete tipExtrapolator_;
40  delete gsfPropagator_;
41 }
42 
43 
46  const reco::BeamSpot& beamSpot) const
47 {
48  //
49  // Beamspot (global co-ordinates)
50  //
51  GlobalPoint bsPosGlobal(beamSpot.x0(),beamSpot.y0(),beamSpot.z0());
52  GlobalError bsCovGlobal(beamSpot.rotatedCovariance3D());
53  //
54  return constrainAtPoint(track,bsPosGlobal,bsCovGlobal);
55 }
56 
59  const reco::Vertex& vertex) const
60 {
61  //
62  // Beamspot (global co-ordinates)
63  //
64  GlobalPoint vtxPosGlobal(vertex.position().x(),vertex.position().y(),vertex.position().z());
65  GlobalError vtxCovGlobal(vertex.covariance());
66  //
67  return constrainAtPoint(track,vtxPosGlobal,vtxCovGlobal);
68 }
69 
72  const GlobalPoint& globalPosition,
73  const GlobalError& globalError) const
74 {
75  //
76  // Track on TIP plane
77  //
78  TrajectoryStateOnSurface innerState =
80  if ( !innerState.isValid() ) return TrajectoryStateOnSurface();
81  TrajectoryStateOnSurface tipState = tipExtrapolator_->extrapolate(innerState,globalPosition);
82  if ( !tipState.isValid() ) return TrajectoryStateOnSurface();
83  //
84  // RecHit from beam spot
85  //
86  LocalError bsCovLocal = ErrorFrameTransformer().transform(globalError,tipState.surface());
88  TRecHit2DPosConstraint::build(tipState.surface().toLocal(globalPosition),
89  bsCovLocal,&tipState.surface());
90  //
91  // update with constraint
92  //
93  TrajectoryStateOnSurface updatedState = gsfUpdator_.update(tipState,*bsHit);
94  if ( !updatedState.isValid() ) {
95  edm::LogWarning("GsfConstraintAtVertex") << " GSF update with vertex constraint failed";
96  return TrajectoryStateOnSurface();
97  }
98 
99  return updatedState;
100 }
101 
TrajectoryStateOnSurface constrainAtBeamSpot(const reco::GsfTrack &, const reco::BeamSpot &) const
(multi)TSOS after including the beamspot
double z0() const
z coordinate
Definition: BeamSpot.h:68
static GlobalError transform(const LocalError &le, const Surface &surf)
TransverseImpactPointExtrapolator * tipExtrapolator_
static RecHitPointer build(const LocalPoint &pos, const LocalError &err, const Surface *surface)
GsfConstraintAtVertex(const edm::EventSetup &)
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:123
GsfPropagatorAdapter * gsfPropagator_
const Point & position() const
position
Definition: Vertex.h:106
TrajectoryStateOnSurface constrainAtPoint(const reco::GsfTrack &, const GlobalPoint &globalPosition, const GlobalError &globalError) const
(multi)TSOS after including a point with covariance matrix
const SurfaceType & surface() const
LocalPoint toLocal(const GlobalPoint &gp) const
MultiTrajectoryStateTransform multiStateTransformer_
const MagneticField * magField_
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
const TrackerGeometry * geometry_
std::shared_ptr< TrackingRecHit const > RecHitPointer
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack &tk) const
GsfMultiStateUpdator gsfUpdator_
TrajectoryStateOnSurface constrainAtVertex(const reco::GsfTrack &, const reco::Vertex &) const
(multi)TSOS after include a vertex
double y0() const
y coordinate
Definition: BeamSpot.h:66
Covariance3DMatrix rotatedCovariance3D() const
Definition: BeamSpot.cc:78
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
double x0() const
x coordinate
Definition: BeamSpot.h:64