CMS 3D CMS Logo

Public Types | Public Member Functions | Private Types

GsfVertexWeightCalculator Class Reference

#include <GsfVertexWeightCalculator.h>

List of all members.

Public Types

typedef
ReferenceCountingPointer
< LinearizedTrackState< 5 > > 
RefCountedLinearizedTrackState

Public Member Functions

double calculate (const VertexState &oldVertex, const RefCountedLinearizedTrackState track, double cov) const

Private Types

typedef LinearizedTrackState
< 5 >::AlgebraicMatrixN3 
AlgebraicMatrixN3
typedef LinearizedTrackState
< 5 >::AlgebraicMatrixNM 
AlgebraicMatrixNM
typedef LinearizedTrackState
< 5 >::AlgebraicSymMatrixNN 
AlgebraicSymMatrixNN
typedef LinearizedTrackState
< 5 >::AlgebraicVectorN 
AlgebraicVectorN

Detailed Description

Calulates the (non-normalised) weight of a component the new mixture of vertices for the Gaussian Sum vertex filter. (c.f. Th.Speer & R. Fruewirth, Comp.Phys.Comm 174, 935 (2006) )

Definition at line 14 of file GsfVertexWeightCalculator.h.


Member Typedef Documentation

Definition at line 31 of file GsfVertexWeightCalculator.h.

Definition at line 32 of file GsfVertexWeightCalculator.h.

Definition at line 33 of file GsfVertexWeightCalculator.h.

Definition at line 30 of file GsfVertexWeightCalculator.h.

Definition at line 18 of file GsfVertexWeightCalculator.h.


Member Function Documentation

double GsfVertexWeightCalculator::calculate ( const VertexState oldVertex,
const RefCountedLinearizedTrackState  track,
double  cov 
) const

Method to calculate the weight A negative weight is returned in case of error.

Definition at line 7 of file GsfVertexWeightCalculator.cc.

References a, b, diffTreeTool::diff, VertexState::error(), funct::exp(), edm::isNotFinite(), M_PI, GlobalErrorBase< T, ErrorWeightType >::matrix_new(), VertexState::position(), funct::pow(), mathSSE::sqrt(), CommonMethods::weight(), VertexState::weightInMixture(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GsfVertexUpdator::createNewComponent(), and GsfVertexSmoother::createNewComponent().

{
  double previousWeight = oldVertex.weightInMixture() * track->weightInMixture();
  // Jacobians
  const AlgebraicMatrixN3 & a = track->positionJacobian();
  const AlgebraicMatrixNM & b = track->momentumJacobian();

  //track information
  AlgebraicVectorN trackParameters = track->predictedStateParameters();
  AlgebraicSymMatrixNN trackParametersError = track->predictedStateError();
  //vertex information
  AlgebraicSymMatrix33 oldVertexError  = oldVertex.error().matrix_new();
  //Vertex position
  GlobalPoint oldVertexPosition = oldVertex.position();
  AlgebraicVector3 oldVertexCoord;
  oldVertexCoord[0] = oldVertexPosition.x();
  oldVertexCoord[1] = oldVertexPosition.y();
  oldVertexCoord[2] = oldVertexPosition.z();

  // prior momentum information
  AlgebraicVector3 priorMomentum = track->predictedStateMomentumParameters();

  AlgebraicSymMatrix33 priorMomentumCov;
  priorMomentumCov(0,0) = 1.0E-9;
  priorMomentumCov(1,1) = 1.0E-6;
  priorMomentumCov(2,2) = 1.0E-6;
  priorMomentumCov *= cov;

  AlgebraicVectorN diff = trackParameters - track->constantTerm() -
    a*oldVertexCoord -b*priorMomentum;
  track->checkParameters(diff);
  AlgebraicSymMatrixNN sigmaM = trackParametersError +
        ROOT::Math::Similarity(a,oldVertexError) +
        ROOT::Math::Similarity(b,priorMomentumCov);

  double sigmaDet;
  sigmaM.Det(sigmaDet);
  int  ifail = ! sigmaM.Invert(); 
  if(ifail != 0) {
    edm::LogWarning("GsfVertexWeightCalculator") << "S matrix inversion failed";
    return -1.;
  }
  
        
  double chi = ROOT::Math::Similarity(diff,sigmaM);;  //SigmaM is now inverted !!!
  double weight = pow(2. * M_PI, -0.5 * 5) * sqrt(1./sigmaDet) * exp(-0.5 * chi);

  if (edm::isNotFinite(weight) || sigmaDet<=0.) {
    edm::LogWarning("GsfVertexWeightCalculator") << "Weight is NaN";
    return -1.;
  }

  return weight*previousWeight;

}