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
reco::Track::outerPosition
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
Vector3DBase
Definition: Vector3DBase.h:8
reco::Track::outerMomentum
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
TrajectoryStateOnSurface.h
mps_fire.i
i
Definition: mps_fire.py:355
FreeTrajectoryState.h
GlobalTrajectoryParameters.h
PTrajectoryStateOnDet::error
float & error(int i)
Definition: PTrajectoryStateOnDet.h:63
trajectoryStateTransform::outerFreeState
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:98
TrackingGeometry
Definition: TrackingGeometry.h:26
TTTrack::momentum
GlobalVector momentum() const
Track momentum.
Definition: TTTrack.h:281
trajectoryStateTransform::initialFreeState
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:58
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
pos
Definition: PixelAliasList.h:18
TTTrack
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:26
TrackingGeometry.h
Surface
Definition: Surface.h:36
LocalTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: LocalTrajectoryError.h:60
TTTrack::rInv
double rInv() const
Track curvature.
Definition: TTTrack.h:286
reco::Track::extra
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139
trajectoryStateTransform::outerStateOnSurface
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:118
trajectoryStateTransform
Definition: TrajectoryStateTransform.h:15
AlgebraicMatrixID
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Definition: AlgebraicROOTObjects.h:72
DetId
Definition: DetId.h:17
TTTrack::POCA
GlobalPoint POCA() const
POCA.
Definition: TTTrack.h:316
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::Track::innerMomentum
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
Track.h
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
Surface.h
TrajectoryStateOnSurface::hasError
bool hasError() const
Definition: TrajectoryStateOnSurface.h:56
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
PTrajectoryStateOnDet::surfaceSide
int surfaceSide() const
Definition: PTrajectoryStateOnDet.h:66
reco::Track
Definition: Track.h:27
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:581
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
reco::TrackBase::covariance
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:683
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
runTheMatrix.err
err
Definition: runTheMatrix.py:288
reco::Track::innerPosition
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
SurfaceSideDefinition
Definition: SurfaceSideDefinition.h:7
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
trajectoryStateTransform::initialFreeStateL1TTrack
FreeTrajectoryState initialFreeStateL1TTrack(const TTTrack< Ref_Phase2TrackerDigi_ > &tk, const MagneticField *field, bool withErr=false)
Definition: TrajectoryStateTransform.cc:70
reco::TrackBase::vertex
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead
Definition: TrackBase.h:647
trajectoryStateTransform::innerFreeState
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:86
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GeomDet.h
PTrajectoryStateOnDet::hasError
bool hasError() const
Definition: PTrajectoryStateOnDet.h:62
PTrajectoryStateOnDet::parameters
const LocalTrajectoryParameters & parameters() const
Definition: PTrajectoryStateOnDet.h:60
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TrajectoryStateTransform.h
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trajectoryStateTransform::innerStateOnSurface
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:110
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:635
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
MagneticField
Definition: MagneticField.h:19
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
TrajectoryStateOnSurface::surfaceSide
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
Definition: TrajectoryStateOnSurface.h:89
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
Basic3DVector< float >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
InvalidError
Definition: TrivialError.h:8