CMS 3D CMS Logo

TrajectoryStateTransform.cc
Go to the documentation of this file.
9 
10 
11 namespace trajectoryStateTransform {
12 
13  using namespace SurfaceSideDefinition;
14 
17  unsigned int detid)
18  {
19  int surfaceSide = static_cast<int>(ts.surfaceSide());
20  auto pt = ts.globalMomentum().perp();
21 
22  if (ts.hasError()) {
23  AlgebraicSymMatrix55 const & m = ts.localError().matrix();
24 
25  int dim = 5;
26  float localErrors[15];
27 
28  int k = 0;
29  for (int i=0; i<dim; i++) {
30  for (int j=0; j<=i; j++) {
31  localErrors[k++] = m(i,j);
32  }
33  }
35  localErrors, detid,
36  surfaceSide);
37  }
39  detid,
40  surfaceSide);
41  }
42 
45  const Surface* surface,
46  const MagneticField* field)
47  {
49  bool errInv=true;
50  if (ts.hasError()) {
51  errInv = false;
52  int dim = 5;
53  int k = 0;
54  for (int i=0; i<dim; i++) {
55  for (int j=0; j<=i; j++) {
56  m(i,j) = ts.error(k++); // NOTE: here we do a cast float => double.
57  }
58  }
59  }
60 
61 
63  errInv ? LocalTrajectoryError(InvalidError()) : LocalTrajectoryError(m),
64  *surface, field,
65  static_cast<SurfaceSide>(ts.surfaceSide()));
66 
67 }
68 
70  const MagneticField* field, bool withErr)
71  {
73  GlobalPoint gpos( pos);
74  Basic3DVector<float> mom( tk.momentum());
75  GlobalVector gmom( mom);
76  GlobalTrajectoryParameters par( gpos, gmom, tk.charge(), field);
77  if (!withErr) return FreeTrajectoryState(par);
79  return FreeTrajectoryState( par, err);
80  }
81 
83  const MagneticField* field, bool withErr)
84  {
86  GlobalPoint gpos( pos);
88  GlobalVector gmom( mom);
89  GlobalTrajectoryParameters par( gpos, gmom, tk.charge(), field);
90  if (!withErr) return FreeTrajectoryState(par);
91  CurvilinearTrajectoryError err( tk.extra()->innerStateCovariance());
92  return FreeTrajectoryState( par, err);
93  }
94 
95 
97  const MagneticField* field, bool withErr)
98  {
100  GlobalPoint gpos( pos);
102  GlobalVector gmom( mom);
103  GlobalTrajectoryParameters par( gpos, gmom, tk.charge(), field);
104  if (!withErr) return FreeTrajectoryState(par);
105  CurvilinearTrajectoryError err( tk.extra()->outerStateCovariance());
106  return FreeTrajectoryState( par, err);
107  }
108 
109 
111  const TrackingGeometry& geom,
112  const MagneticField* field, bool withErr)
113  {
114  const Surface& surface = geom.idToDet( DetId( tk.extra()->innerDetId()))->surface();
115  return TrajectoryStateOnSurface( innerFreeState( tk, field, withErr), surface);
116  }
117 
119  const TrackingGeometry& geom,
120  const MagneticField* field, bool withErr)
121  {
122  const Surface& surface = geom.idToDet( DetId( tk.extra()->outerDetId()))->surface();
123  return TrajectoryStateOnSurface( outerFreeState( tk, field, withErr), surface);
124  }
125 
126 }
T perp() const
Definition: PV3DBase.h:72
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:194
const LocalTrajectoryParameters & localParameters() const
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
virtual const GeomDet * idToDet(DetId) const =0
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:714
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:67
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:57
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:738
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:782
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
int k[5][pyjets_maxn]
Definition: DetId.h:18
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:72
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
GlobalVector globalMomentum() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:62
int charge() const
track electric charge
Definition: TrackBase.h:606
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
const LocalTrajectoryParameters & parameters() const
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)