CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
TrajectoryToResiduals.cc File Reference
#include "TrajectoryToResiduals.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h"
#include "TrackingTools/TransientTrackingRecHit/interface/HelpertRecHit2DLocalPos.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

reco::TrackResiduals trajectoryToResiduals (const Trajectory &trajectory, enum reco::TrackResiduals::ResidualType type)
 

Function Documentation

reco::TrackResiduals trajectoryToResiduals ( const Trajectory trajectory,
enum reco::TrackResiduals::ResidualType  type 
)

Definition at line 8 of file TrajectoryToResiduals.cc.

References alongMomentum, TrajectoryMeasurement::backwardPredictedState(), funct::combine(), Trajectory::direction(), TrajectoryMeasurement::forwardPredictedState(), i, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), Trajectory::measurements(), HelpertRecHit2DLocalPos::parError(), LocalTrajectoryError::positionError(), TrajectoryMeasurement::recHit(), reco::TrackResiduals::setPullXY(), reco::TrackResiduals::setResidualXY(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, reco::TrackResiduals::X_Y_PULLS, reco::TrackResiduals::X_Y_RESIDUALS, LocalError::xx(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by KfTrackProducerBase::putInEvt().

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:22
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
TrajectoryStateOnSurface forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
T y() const
Definition: PV3DBase.h:62
ConstRecHitPointer recHit() const
LocalError positionError() const
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
DataContainer const & measurements() const
Definition: Trajectory.h:203
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:46
static type combine(const A &_1, const B &_2)
Definition: Factorize.h:186
const LocalTrajectoryError & localError() const
CLHEP::HepSymMatrix AlgebraicSymMatrix
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface backwardPredictedState() const
Access to backward predicted state (from smoother)
static AlgebraicSymMatrix parError(const LocalError &le, const GeomDet &det)