CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  {
72  Basic3DVector<float> pos( tk.vertex());
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 }
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:72
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
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)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:723
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:735
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:779
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
int j
Definition: DBlmapReader.cc:9
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
Definition: DetId.h:18
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
virtual const GeomDet * idToDet(DetId) const =0
GlobalVector globalMomentum() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
int charge() const
track electric charge
Definition: TrackBase.h:615
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)