CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
CollinearFitAtTM Class Reference

#include <CollinearFitAtTM.h>

Public Types

enum  {
  ParQpIn = 0, ParQpOut, ParDxDz, ParDyDz,
  ParX, ParY
}
 parameter indices in the result vector / covariance matrix More...
 
typedef ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > ResultMatrix
 
typedef ROOT::Math::SVector< double, 6 > ResultVector
 

Public Member Functions

 CollinearFitAtTM ()
 
bool fit (const AlgebraicVector5 &fwdParameters, const AlgebraicSymMatrix55 &fwdCovariance, const AlgebraicVector5 &bwdParameters, const AlgebraicSymMatrix55 &bwdCovariance, const LocalPoint &hitPosition, const LocalError &hitErrors, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
 Fit with explicit input parameters. Return value "true" for success. More...
 
bool fit (const TrajectoryMeasurement &tm, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
 Fit for one TM. Return value "true" for success. More...
 

Private Attributes

ROOT::Math::SMatrix< double, 12, 6 > jacobian_
 
ROOT::Math::SVector< double, 12 > measurements_
 
ROOT::Math::SVector< double, 6 > projectedMeasurements_
 
ROOT::Math::SMatrix< double, 12, 12, ROOT::Math::MatRepSym< double, 12 > > weightMatrix_
 

Detailed Description

Constrained fit at a TrajectoryMeasurement assuming collinearity of incoming / outgoing momenta. The result of the fit is a vector of 6 variables: the first five correspond to local trajectory parameters for the incoming momentum, the 6th is the estimated remaining energy fraction (p_out / p_in). The NDF are 6 (4) for a valid (invalid) RecHit.

Definition at line 17 of file CollinearFitAtTM.h.

Member Typedef Documentation

◆ ResultMatrix

typedef ROOT::Math::SMatrix<double, 6, 6, ROOT::Math::MatRepSym<double, 6> > CollinearFitAtTM::ResultMatrix

Definition at line 25 of file CollinearFitAtTM.h.

◆ ResultVector

typedef ROOT::Math::SVector<double, 6> CollinearFitAtTM::ResultVector

Definition at line 24 of file CollinearFitAtTM.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

parameter indices in the result vector / covariance matrix

Enumerator
ParQpIn 
ParQpOut 
ParDxDz 
ParDyDz 
ParX 
ParY 

Definition at line 20 of file CollinearFitAtTM.h.

Constructor & Destructor Documentation

◆ CollinearFitAtTM()

CollinearFitAtTM::CollinearFitAtTM ( )

Definition at line 4 of file CollinearFitAtTM.cc.

4  {
5  //
6  // Jacobian
7  //
8  for (int i = 0; i < 12; ++i) {
9  for (int j = 0; j < 6; ++j)
10  jacobian_(i, j) = 0;
11  }
12  for (int i = 1; i < 5; ++i) {
13  jacobian_(i, ParQpOut + i) = jacobian_(i + 5, ParQpOut + i) = 1;
14  }
15  jacobian_(0, ParQpIn) = 1.;
16  jacobian_(5, ParQpOut) = 1.;
17 }

References mps_fire::i, dqmiolumiharvest::j, jacobian_, ParQpIn, and ParQpOut.

Member Function Documentation

◆ fit() [1/2]

bool CollinearFitAtTM::fit ( const AlgebraicVector5 fwdParameters,
const AlgebraicSymMatrix55 fwdCovariance,
const AlgebraicVector5 bwdParameters,
const AlgebraicSymMatrix55 bwdCovariance,
const LocalPoint hitPosition,
const LocalError hitErrors,
ResultVector parameters,
ResultMatrix covariance,
double &  chi2 
)

Fit with explicit input parameters. Return value "true" for success.

Definition at line 48 of file CollinearFitAtTM.cc.

56  {
57  if (hitErr.xx() > 0)
58  jacobian_(10, ParX) = jacobian_(11, ParY) = 1;
59  else
60  jacobian_(10, ParX) = jacobian_(11, ParY) = 0;
61 
62  for (int i = 0; i < 12; ++i) {
63  for (int j = 0; j < 12; ++j)
64  weightMatrix_(i, j) = 0;
65  }
66 
67  for (int i = 0; i < 5; ++i)
68  measurements_(i) = fwdParameters(i);
69  weightMatrix_.Place_at(fwdCovariance, 0, 0);
70  for (int i = 0; i < 5; ++i)
71  measurements_(i + 5) = bwdParameters(i);
72  weightMatrix_.Place_at(bwdCovariance, 5, 5);
73  if (hitErr.xx() > 0) {
74  measurements_(10) = hitPos.x();
75  measurements_(11) = hitPos.y();
76  weightMatrix_(10, 10) = hitErr.xx();
77  weightMatrix_(10, 11) = weightMatrix_(11, 10) = hitErr.xy();
78  weightMatrix_(11, 11) = hitErr.yy();
79  } else {
80  measurements_(10) = measurements_(11) = 0.;
81  weightMatrix_(10, 10) = weightMatrix_(11, 11) = 1.;
82  weightMatrix_(10, 11) = weightMatrix_(11, 10) = 0.;
83  }
84  //
85  // invert covariance matrix
86  //
87  if (!weightMatrix_.Invert()) {
88  edm::LogWarning("CollinearFitAtTM") << "Inversion of input covariance matrix failed";
89  return false;
90  }
91 
92  //
93  projectedMeasurements_ = ROOT::Math::Transpose(jacobian_) * (weightMatrix_ * measurements_);
94  //
95  // Fitted parameters and covariance matrix
96  //
97  covariance = ROOT::Math::SimilarityT(jacobian_, weightMatrix_);
98  if (!covariance.Invert()) {
99  edm::LogWarning("CollinearFitAtTM") << "Inversion of resulting weight matrix failed";
100  return false;
101  }
102 
103  parameters = covariance * projectedMeasurements_;
104 
105  //
106  // chi2
107  //
108  chi2 =
109  ROOT::Math::Similarity(measurements_, weightMatrix_) - ROOT::Math::Similarity(projectedMeasurements_, covariance);
110 
111  return true;
112 }

References hltPixelTracks_cff::chi2, mps_fire::i, dqmiolumiharvest::j, jacobian_, measurements_, ParX, ParY, projectedMeasurements_, weightMatrix_, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by trackingPlots.Iteration::modules().

◆ fit() [2/2]

bool CollinearFitAtTM::fit ( const TrajectoryMeasurement tm,
ResultVector parameters,
ResultMatrix covariance,
double &  chi2 
)

Fit for one TM. Return value "true" for success.

Definition at line 19 of file CollinearFitAtTM.cc.

22  {
23  //
24  // check input
25  //
27  edm::LogWarning("CollinearFitAtTM") << "Invalid state in TrajectoryMeasurement";
28  return false;
29  }
30  //
31  // prepare fit
32  //
37 
38  LocalPoint hitPos(0., 0., 0.);
39  LocalError hitErr(-1., -1., -1.);
40  if (tm.recHit()->isValid()) {
41  hitPos = tm.recHit()->localPosition();
42  hitErr = tm.recHit()->localPositionError();
43  }
44 
45  return fit(fwdPar, fwdCov, bwdPar, bwdCov, hitPos, hitErr, parameters, covariance, chi2);
46 }

References TrajectoryMeasurement::backwardPredictedState(), hltPixelTracks_cff::chi2, TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LocalTrajectoryError::matrix(), TrajectoryMeasurement::recHit(), TrajectoryMeasurement::updatedState(), and LocalTrajectoryParameters::vector().

Referenced by trackingPlots.Iteration::modules(), and PFGsfHelper::PFGsfHelper().

Member Data Documentation

◆ jacobian_

ROOT::Math::SMatrix<double, 12, 6> CollinearFitAtTM::jacobian_
private

Definition at line 40 of file CollinearFitAtTM.h.

Referenced by CollinearFitAtTM(), and fit().

◆ measurements_

ROOT::Math::SVector<double, 12> CollinearFitAtTM::measurements_
private

Definition at line 41 of file CollinearFitAtTM.h.

Referenced by fit().

◆ projectedMeasurements_

ROOT::Math::SVector<double, 6> CollinearFitAtTM::projectedMeasurements_
private

Definition at line 43 of file CollinearFitAtTM.h.

Referenced by fit().

◆ weightMatrix_

ROOT::Math::SMatrix<double, 12, 12, ROOT::Math::MatRepSym<double, 12> > CollinearFitAtTM::weightMatrix_
private

Definition at line 42 of file CollinearFitAtTM.h.

Referenced by fit().

BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
mps_fire.i
i
Definition: mps_fire.py:428
CollinearFitAtTM::measurements_
ROOT::Math::SVector< double, 12 > measurements_
Definition: CollinearFitAtTM.h:41
CollinearFitAtTM::ParDxDz
Definition: CollinearFitAtTM.h:20
CollinearFitAtTM::ParY
Definition: CollinearFitAtTM.h:20
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
LocalTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: LocalTrajectoryError.h:60
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
TrajectoryMeasurement::backwardPredictedState
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Definition: TrajectoryMeasurement.h:179
TrajectoryMeasurement::forwardPredictedState
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
Definition: TrajectoryMeasurement.h:177
LocalTrajectoryParameters::vector
AlgebraicVector5 vector() const
Definition: LocalTrajectoryParameters.h:120
Point3DBase< float, LocalTag >
CollinearFitAtTM::ParQpIn
Definition: CollinearFitAtTM.h:20
CollinearFitAtTM::projectedMeasurements_
ROOT::Math::SVector< double, 6 > projectedMeasurements_
Definition: CollinearFitAtTM.h:43
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
LocalError
Definition: LocalError.h:12
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
CollinearFitAtTM::jacobian_
ROOT::Math::SMatrix< double, 12, 6 > jacobian_
Definition: CollinearFitAtTM.h:40
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
CollinearFitAtTM::ParQpOut
Definition: CollinearFitAtTM.h:20
CollinearFitAtTM::ParDyDz
Definition: CollinearFitAtTM.h:20
CollinearFitAtTM::fit
bool fit(const TrajectoryMeasurement &tm, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
Fit for one TM. Return value "true" for success.
Definition: CollinearFitAtTM.cc:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
CollinearFitAtTM::ParX
Definition: CollinearFitAtTM.h:20
CollinearFitAtTM::weightMatrix_
ROOT::Math::SMatrix< double, 12, 12, ROOT::Math::MatRepSym< double, 12 > > weightMatrix_
Definition: CollinearFitAtTM.h:42
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54