CMS 3D CMS Logo

TrajectoryStateTransform.cc
Go to the documentation of this file.
9 
10 namespace trajectoryStateTransform {
11 
12  using namespace SurfaceSideDefinition;
13 
15  int surfaceSide = static_cast<int>(ts.surfaceSide());
16  auto pt = ts.globalMomentum().perp();
17 
18  if (ts.hasError()) {
19  AlgebraicSymMatrix55 const& m = ts.localError().matrix();
20 
21  int dim = 5;
22  float localErrors[15];
23 
24  int k = 0;
25  for (int i = 0; i < dim; i++) {
26  for (int j = 0; j <= i; j++) {
27  localErrors[k++] = m(i, j);
28  }
29  }
30  return PTrajectoryStateOnDet(ts.localParameters(), pt, localErrors, detid, surfaceSide);
31  }
32  return PTrajectoryStateOnDet(ts.localParameters(), pt, detid, surfaceSide);
33  }
34 
36  const Surface* surface,
37  const MagneticField* field) {
39  bool errInv = true;
40  if (ts.hasError()) {
41  errInv = false;
42  int dim = 5;
43  int k = 0;
44  for (int i = 0; i < dim; i++) {
45  for (int j = 0; j <= i; j++) {
46  m(i, j) = ts.error(k++); // NOTE: here we do a cast float => double.
47  }
48  }
49  }
50 
53  *surface,
54  field,
55  static_cast<SurfaceSide>(ts.surfaceSide()));
56  }
57 
58  FreeTrajectoryState initialFreeState(const reco::Track& tk, const MagneticField* field, bool withErr) {
60  GlobalPoint gpos(pos);
62  GlobalVector gmom(mom);
63  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
64  if (!withErr)
65  return FreeTrajectoryState(par);
67  return FreeTrajectoryState(par, err);
68  }
69 
71  const MagneticField* field,
72  bool withErr) {
74  GlobalPoint gpos(pos);
75  GlobalVector gmom = tk.momentum();
76  int charge = tk.rInv() > 0.f ? 1 : -1;
77 
78  GlobalTrajectoryParameters par(gpos, gmom, charge, field);
79  if (!withErr)
80  return FreeTrajectoryState(par);
82  mat *= 1e-8;
83  return FreeTrajectoryState(par, mat);
84  }
85 
86  FreeTrajectoryState innerFreeState(const reco::Track& tk, const MagneticField* field, bool withErr) {
88  GlobalPoint gpos(pos);
90  GlobalVector gmom(mom);
91  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
92  if (!withErr)
93  return FreeTrajectoryState(par);
94  CurvilinearTrajectoryError err(tk.extra()->innerStateCovariance());
95  return FreeTrajectoryState(par, err);
96  }
97 
98  FreeTrajectoryState outerFreeState(const reco::Track& tk, const MagneticField* field, bool withErr) {
100  GlobalPoint gpos(pos);
102  GlobalVector gmom(mom);
103  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
104  if (!withErr)
105  return FreeTrajectoryState(par);
106  CurvilinearTrajectoryError err(tk.extra()->outerStateCovariance());
107  return FreeTrajectoryState(par, err);
108  }
109 
111  const TrackingGeometry& geom,
112  const MagneticField* field,
113  bool withErr) {
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,
121  bool withErr) {
122  const Surface& surface = geom.idToDet(DetId(tk.extra()->outerDetId()))->surface();
123  return TrajectoryStateOnSurface(outerFreeState(tk, field, withErr), surface);
124  }
125 
126 } // namespace trajectoryStateTransform
T perp() const
Definition: PV3DBase.h:69
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
const LocalTrajectoryError & localError() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const LocalTrajectoryParameters & localParameters() const
GlobalVector momentum() const
Track momentum.
Definition: TTTrack.h:295
int charge() const
track electric charge
Definition: TrackBase.h:596
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
double rInv() const
Track curvature.
Definition: TTTrack.h:300
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:676
const LocalTrajectoryParameters & parameters() const
Definition: DetId.h:17
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalVector globalMomentum() const
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
FreeTrajectoryState initialFreeStateL1TTrack(const TTTrack< Ref_Phase2TrackerDigi_ > &tk, const MagneticField *field, bool withErr=false)
const AlgebraicSymMatrix55 & matrix() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
GlobalPoint POCA() const
POCA.
Definition: TTTrack.h:335
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139