#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 | |
double | chi2 () const |
chi2 | |
CollinearFitAtTM2 (const TrajectoryMeasurement &tm) | |
CollinearFitAtTM2 (const AlgebraicVector5 &fwdParameters, const AlgebraicSymMatrix55 &fwdCovariance, const AlgebraicVector5 &bwdParameters, const AlgebraicSymMatrix55 &bwdCovariance, const LocalPoint &hitPosition, const LocalError &hitErrors) | |
const ResultMatrix & | covariance () const |
covariance matrix of fitted parameters | |
Measurement1D | deltaP () const |
estimated deltaP (out-in) from fit parameters | |
int | ndof () const |
degrees of freedom | |
const ResultVector & | parameters () const |
vector of fitted parameters | |
bool | valid () const |
status of the fit | |
Private Member Functions | |
bool | fit (const AlgebraicVector5 &fwdParameters, const AlgebraicSymMatrix55 &fwdCovariance, const AlgebraicVector5 &bwdParameters, const AlgebraicSymMatrix55 &bwdCovariance, const LocalPoint &hitPosition, const LocalError &hitErrors) |
Perform the fit. Return value "true" for success. | |
void | initJacobian () |
initialise the jacobian | |
Private Attributes | |
double | chi2_ |
ResultMatrix | covariance_ |
ROOT::Math::SMatrix< double, 12, 6 > | jacobian_ |
ROOT::Math::SVector< double, 12 > | measurements_ |
int | ndof_ |
ResultVector | parameters_ |
ROOT::Math::SVector< double, 6 > | projectedMeasurements_ |
bool | valid_ |
ROOT::Math::SMatrix< double, 12, 12, ROOT::Math::MatRepSym < double, 12 > > | weightMatrix_ |
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 18 of file CollinearFitAtTM.h.
typedef ROOT::Math::SMatrix<double,6,6,ROOT::Math::MatRepSym<double,6> > CollinearFitAtTM2::ResultMatrix |
Definition at line 32 of file CollinearFitAtTM.h.
typedef ROOT::Math::SVector<double,6> CollinearFitAtTM2::ResultVector |
Definition at line 31 of file CollinearFitAtTM.h.
anonymous enum |
CollinearFitAtTM2::CollinearFitAtTM2 | ( | const TrajectoryMeasurement & | tm | ) |
Definition at line 4 of file CollinearFitAtTM.cc.
References TrajectoryMeasurement::backwardPredictedState(), fit(), TrajectoryMeasurement::forwardPredictedState(), initJacobian(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LocalTrajectoryError::matrix(), TrajectoryMeasurement::recHit(), TrajectoryMeasurement::updatedState(), and LocalTrajectoryParameters::vector().
: valid_(false),chi2_(-1),ndof_(-1) { // // check input // if ( !tm.forwardPredictedState().isValid() || !tm.backwardPredictedState().isValid() || !tm.updatedState().isValid() ) { edm::LogWarning("CollinearFitAtTM2") << "Invalid state in TrajectoryMeasurement"; return; } // // prepare fit // initJacobian(); AlgebraicVector5 fwdPar = tm.forwardPredictedState().localParameters().vector(); AlgebraicSymMatrix55 fwdCov = tm.forwardPredictedState().localError().matrix(); AlgebraicVector5 bwdPar = tm.backwardPredictedState().localParameters().vector(); AlgebraicSymMatrix55 bwdCov = tm.backwardPredictedState().localError().matrix(); LocalPoint hitPos(0.,0.,0.); LocalError hitErr(-1.,-1.,-1.); if ( tm.recHit()->isValid() ) { hitPos = tm.recHit()->localPosition(); hitErr = tm.recHit()->localPositionError(); } fit(fwdPar,fwdCov,bwdPar,bwdCov,hitPos,hitErr); }
CollinearFitAtTM2::CollinearFitAtTM2 | ( | const AlgebraicVector5 & | fwdParameters, |
const AlgebraicSymMatrix55 & | fwdCovariance, | ||
const AlgebraicVector5 & | bwdParameters, | ||
const AlgebraicSymMatrix55 & | bwdCovariance, | ||
const LocalPoint & | hitPosition, | ||
const LocalError & | hitErrors | ||
) |
Definition at line 34 of file CollinearFitAtTM.cc.
References fit(), and initJacobian().
: valid_(false),chi2_(-1),ndof_(-1) { // // prepare fit // initJacobian(); fit(fwdParameters,fwdCovariance,bwdParameters,bwdCovariance,hitPosition,hitErrors); }
double CollinearFitAtTM2::chi2 | ( | void | ) | const [inline] |
const ResultMatrix& CollinearFitAtTM2::covariance | ( | void | ) | const [inline] |
covariance matrix of fitted parameters
Definition at line 42 of file CollinearFitAtTM.h.
References covariance_.
{return covariance_;}
Measurement1D CollinearFitAtTM2::deltaP | ( | ) | const |
estimated deltaP (out-in) from fit parameters
Definition at line 131 of file CollinearFitAtTM.cc.
References covariance_, parameters_, mathSSE::sqrt(), and valid_.
Referenced by GsfTrackProducerBase::computeModeAtTM().
{ // // check validity // if ( !valid_ ) return Measurement1D(); // // deltaP = 1/qpout - 1/qpin ; uncertainty from linear error propagation // double qpIn = parameters_(0); double sig2In = covariance_(0,0); double qpOut = parameters_(1); double sig2Out = covariance_(1,1); double corrInOut = covariance_(0,1); double pIn = 1./fabs(qpIn); double pOut = 1./fabs(qpOut); double sig2DeltaP = pIn/qpIn*pIn/qpIn*sig2In - 2*pIn/qpIn*pOut/qpOut*corrInOut + pOut/qpOut*pOut/qpOut*sig2Out; return Measurement1D(pOut-pIn,sig2DeltaP?sqrt(sig2DeltaP):0.); }
bool CollinearFitAtTM2::fit | ( | const AlgebraicVector5 & | fwdParameters, |
const AlgebraicSymMatrix55 & | fwdCovariance, | ||
const AlgebraicVector5 & | bwdParameters, | ||
const AlgebraicSymMatrix55 & | bwdCovariance, | ||
const LocalPoint & | hitPosition, | ||
const LocalError & | hitErrors | ||
) | [private] |
Perform the fit. Return value "true" for success.
Definition at line 66 of file CollinearFitAtTM.cc.
References chi2_, covariance_, i, j, jacobian_, measurements_, ndof_, parameters_, ParX, ParY, projectedMeasurements_, valid_, weightMatrix_, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().
Referenced by CollinearFitAtTM2().
{ if ( hitErr.xx()>0 ) jacobian_(10,ParX) = jacobian_(11,ParY) = 1; else jacobian_(10,ParX) = jacobian_(11,ParY) = 0; for ( int i=0; i<12; ++i ) { for ( int j=0; j<12; ++j ) weightMatrix_(i,j) = 0; } for ( int i=0; i<5; ++i ) measurements_(i) = fwdParameters(i); weightMatrix_.Place_at(fwdCovariance,0,0); for ( int i=0; i<5; ++i ) measurements_(i+5) = bwdParameters(i); weightMatrix_.Place_at(bwdCovariance,5,5); if ( hitErr.xx()>0 ) { measurements_(10) = hitPos.x(); measurements_(11) = hitPos.y(); weightMatrix_(10,10) = hitErr.xx(); weightMatrix_(10,11) = weightMatrix_(11,10) = hitErr.xy(); weightMatrix_(11,11) = hitErr.yy(); } else { measurements_(10) = measurements_(11) = 0.; weightMatrix_(10,10) = weightMatrix_(11,11) = 1.; weightMatrix_(10,11) = weightMatrix_(11,10) = 0.; } // // invert covariance matrix // if ( !weightMatrix_.Invert() ) { edm::LogWarning("CollinearFitAtTM2") << "Inversion of input covariance matrix failed"; return false; } // projectedMeasurements_ = ROOT::Math::Transpose(jacobian_)*(weightMatrix_*measurements_); // // Fitted parameters and covariance matrix // covariance_ = ROOT::Math::SimilarityT(jacobian_,weightMatrix_); if ( !covariance_.Invert() ) { edm::LogWarning("CollinearFitAtTM2") << "Inversion of resulting weight matrix failed"; return false; } parameters_ = covariance_*projectedMeasurements_; // // chi2 // chi2_ = ROOT::Math::Similarity(measurements_,weightMatrix_) - ROOT::Math::Similarity(projectedMeasurements_,covariance_); ndof_ = hitErr.xx()>0 ? 6 : 4; valid_ = true; return true; }
void CollinearFitAtTM2::initJacobian | ( | ) | [private] |
initialise the jacobian
Definition at line 50 of file CollinearFitAtTM.cc.
References i, j, jacobian_, ParQpIn, and ParQpOut.
Referenced by CollinearFitAtTM2().
int CollinearFitAtTM2::ndof | ( | ) | const [inline] |
degrees of freedom
Definition at line 38 of file CollinearFitAtTM.h.
References ndof_.
{return ndof_;}
const ResultVector& CollinearFitAtTM2::parameters | ( | void | ) | const [inline] |
vector of fitted parameters
Definition at line 40 of file CollinearFitAtTM.h.
References parameters_.
{return parameters_;}
bool CollinearFitAtTM2::valid | ( | ) | const [inline] |
status of the fit
Definition at line 34 of file CollinearFitAtTM.h.
References valid_.
{return valid_;}
double CollinearFitAtTM2::chi2_ [private] |
Definition at line 66 of file CollinearFitAtTM.h.
ResultMatrix CollinearFitAtTM2::covariance_ [private] |
Definition at line 65 of file CollinearFitAtTM.h.
Referenced by covariance(), deltaP(), and fit().
ROOT::Math::SMatrix<double,12,6> CollinearFitAtTM2::jacobian_ [private] |
Definition at line 57 of file CollinearFitAtTM.h.
Referenced by fit(), and initJacobian().
ROOT::Math::SVector<double,12> CollinearFitAtTM2::measurements_ [private] |
Definition at line 58 of file CollinearFitAtTM.h.
Referenced by fit().
int CollinearFitAtTM2::ndof_ [private] |
Definition at line 67 of file CollinearFitAtTM.h.
ResultVector CollinearFitAtTM2::parameters_ [private] |
Definition at line 64 of file CollinearFitAtTM.h.
Referenced by deltaP(), fit(), and parameters().
ROOT::Math::SVector<double,6> CollinearFitAtTM2::projectedMeasurements_ [private] |
Definition at line 60 of file CollinearFitAtTM.h.
Referenced by fit().
bool CollinearFitAtTM2::valid_ [private] |
Definition at line 63 of file CollinearFitAtTM.h.
ROOT::Math::SMatrix<double,12,12,ROOT::Math::MatRepSym<double,12> > CollinearFitAtTM2::weightMatrix_ [private] |
Definition at line 59 of file CollinearFitAtTM.h.
Referenced by fit().