CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajectoryToResiduals.cc
Go to the documentation of this file.
5 
7 
10 {
11  reco::TrackResiduals residuals(type);
12  int i_residual = 0;
13  Trajectory::DataContainer::const_iterator i_fwd =
14  trajectory.measurements().begin();
15  Trajectory::DataContainer::const_reverse_iterator i_bwd =
16  trajectory.measurements().rbegin();
17  Trajectory::DataContainer::const_iterator i_end =
18  trajectory.measurements().end();
19  Trajectory::DataContainer::const_reverse_iterator i_rend =
20  trajectory.measurements().rend();
21  bool forward = trajectory.direction() == alongMomentum;
22  for (; forward ? i_fwd != i_end : i_bwd != i_rend;
23  ++i_fwd, ++i_bwd, ++i_residual) {
24  const TrajectoryMeasurement *i = forward ? &*i_fwd : &*i_bwd;
25  if (!i->recHit()->isValid()||i->recHit()->det()==0)
26  continue;
29  {
30  edm::LogError("InvalideState")<<"one of the step is invalid";
31  continue;
32  }
33 
36 
37  if (!combo.isValid()){
38  edm::LogError("InvalideState")<<"the combined state is invalid";
39  continue;
40  }
41 
42  LocalPoint combo_localpos = combo.localPosition();
43  LocalError combo_localerr = combo.localError().positionError();
44  LocalPoint dethit_localpos = i->recHit()->localPosition();
45  LocalError dethit_localerr = i->recHit()->localPositionError();
47  AlgebraicSymMatrix error_including_alignment =
48  helper.parError(dethit_localerr, *i->recHit()->det());
49  switch (type) {
51  {
52  double x = (dethit_localpos.x() - combo_localpos.x()) /
53  sqrt(error_including_alignment[0][0]);
54  double y = (dethit_localpos.y() - combo_localpos.y()) /
55  sqrt(error_including_alignment[1][1]);
56  residuals.setResidualXY(i_residual, x, y);
57  break;
58  }
60  {
61  double x = (dethit_localpos.x() - combo_localpos.x()) /
62  sqrt(error_including_alignment[0][0] + combo_localerr.xx());
63  double y = (dethit_localpos.y() - combo_localpos.y()) /
64  sqrt(error_including_alignment[1][1] + combo_localerr.yy());
65  residuals.setPullXY(i_residual, x, y);
66  break;
67  }
68  default:
69  assert(0);
70  }
71  }
72  return residuals;
73 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
ConstRecHitPointer const & recHit() const
T y() const
Definition: PV3DBase.h:63
static AlgebraicSymMatrix parError(const LocalError &le, const GeomDet &det)
void setPullXY(int idx, double pullX, double pullY)
LocalError positionError() const
PropagationDirection const & direction() const
Definition: Trajectory.cc:118
DataContainer const & measurements() const
Definition: Trajectory.h:203
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
static type combine(const A &_1, const B &_2)
Definition: Factorize.h:186
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
void setResidualXY(int idx, double residualX, double residualY)
CLHEP::HepSymMatrix AlgebraicSymMatrix
reco::TrackResiduals trajectoryToResiduals(const Trajectory &trajectory, enum reco::TrackResiduals::ResidualType type)
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)