CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 TrajectoryMeasurement &tm, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
 Fit for one TM. Return value "true" for success. More...
 
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...
 

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

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

Definition at line 25 of file CollinearFitAtTM.h.

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

Definition at line 24 of file CollinearFitAtTM.h.

Member Enumeration Documentation

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 ( )

Definition at line 4 of file CollinearFitAtTM.cc.

References i, j, jacobian_, ParQpIn, and ParQpOut.

5 {
6  //
7  // Jacobian
8  //
9  for ( int i=0; i<12; ++i ) {
10  for ( int j=0; j<6; ++j ) jacobian_(i,j) = 0;
11  }
12  for ( int i=1; i<5; ++i ) {
14  }
15  jacobian_(0,ParQpIn) = 1.;
16  jacobian_(5,ParQpOut) = 1.;
17 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
ROOT::Math::SMatrix< double, 12, 6 > jacobian_

Member Function Documentation

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

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

Definition at line 20 of file CollinearFitAtTM.cc.

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

24 {
25  //
26  // check input
27  //
28  if ( !tm.forwardPredictedState().isValid() ||
30  !tm.updatedState().isValid() ) {
31  edm::LogWarning("CollinearFitAtTM") << "Invalid state in TrajectoryMeasurement";
32  return false;
33  }
34  //
35  // prepare fit
36  //
41 
42  LocalPoint hitPos(0.,0.,0.);
43  LocalError hitErr(-1.,-1.,-1.);
44  if ( tm.recHit()->isValid() ) {
45  hitPos = tm.recHit()->localPosition();
46  hitErr = tm.recHit()->localPositionError();
47  }
48 
49  return fit(fwdPar,fwdCov,bwdPar,bwdCov,
50  hitPos,hitErr,
51  parameters,covariance,chi2);
52 }
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
bool fit(const TrajectoryMeasurement &tm, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
Fit for one TM. Return value &quot;true&quot; for success.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
AlgebraicVector5 vector() const
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
TrajectoryStateOnSurface const & updatedState() const
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
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 55 of file CollinearFitAtTM.cc.

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

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

Member Data Documentation

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

Definition at line 41 of file CollinearFitAtTM.h.

Referenced by CollinearFitAtTM(), and fit().

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

Definition at line 42 of file CollinearFitAtTM.h.

Referenced by fit().

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

Definition at line 44 of file CollinearFitAtTM.h.

Referenced by fit().

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

Definition at line 43 of file CollinearFitAtTM.h.

Referenced by fit().