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 Types
GsfVertexWeightCalculator Class Reference

#include <GsfVertexWeightCalculator.h>

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(), create_public_lumi_plots::exp, edm::isNotFinite(), M_PI, GlobalErrorBase< T, ErrorWeightType >::matrix_new(), VertexState::position(), funct::pow(), mathSSE::sqrt(), histoStyle::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().

9 {
10  double previousWeight = oldVertex.weightInMixture() * track->weightInMixture();
11  // Jacobians
12  const AlgebraicMatrixN3 & a = track->positionJacobian();
13  const AlgebraicMatrixNM & b = track->momentumJacobian();
14 
15  //track information
16  AlgebraicVectorN trackParameters = track->predictedStateParameters();
17  AlgebraicSymMatrixNN trackParametersError = track->predictedStateError();
18  //vertex information
19  AlgebraicSymMatrix33 oldVertexError = oldVertex.error().matrix_new();
20  //Vertex position
21  GlobalPoint oldVertexPosition = oldVertex.position();
22  AlgebraicVector3 oldVertexCoord;
23  oldVertexCoord[0] = oldVertexPosition.x();
24  oldVertexCoord[1] = oldVertexPosition.y();
25  oldVertexCoord[2] = oldVertexPosition.z();
26 
27  // prior momentum information
28  AlgebraicVector3 priorMomentum = track->predictedStateMomentumParameters();
29 
30  AlgebraicSymMatrix33 priorMomentumCov;
31  priorMomentumCov(0,0) = 1.0E-9;
32  priorMomentumCov(1,1) = 1.0E-6;
33  priorMomentumCov(2,2) = 1.0E-6;
34  priorMomentumCov *= cov;
35 
36  AlgebraicVectorN diff = trackParameters - track->constantTerm() -
37  a*oldVertexCoord -b*priorMomentum;
38  track->checkParameters(diff);
39  AlgebraicSymMatrixNN sigmaM = trackParametersError +
40  ROOT::Math::Similarity(a,oldVertexError) +
41  ROOT::Math::Similarity(b,priorMomentumCov);
42 
43  double sigmaDet;
44  sigmaM.Det(sigmaDet);
45  int ifail = ! sigmaM.Invert();
46  if(ifail != 0) {
47  edm::LogWarning("GsfVertexWeightCalculator") << "S matrix inversion failed";
48  return -1.;
49  }
50 
51 
52  double chi = ROOT::Math::Similarity(diff,sigmaM);; //SigmaM is now inverted !!!
53  double weight = pow(2. * M_PI, -0.5 * 5) * sqrt(1./sigmaDet) * exp(-0.5 * chi);
54 
55  if (edm::isNotFinite(weight) || sigmaDet<=0.) {
56  edm::LogWarning("GsfVertexWeightCalculator") << "Weight is NaN";
57  return -1.;
58  }
59 
60  return weight*previousWeight;
61 
62 }
LinearizedTrackState< 5 >::AlgebraicMatrixNM AlgebraicMatrixNM
T y() const
Definition: PV3DBase.h:63
GlobalPoint position() const
Definition: VertexState.h:50
const AlgebraicSymMatrix33 & matrix_new() const
bool isNotFinite(T x)
Definition: isFinite.h:10
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
double weightInMixture() const
Definition: VertexState.h:70
virtual AlgebraicSymMatrixNN predictedStateError() const =0
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
virtual AlgebraicVectorN predictedStateParameters() const =0
ROOT::Math::SVector< double, 3 > AlgebraicVector3
#define M_PI
LinearizedTrackState< 5 >::AlgebraicMatrixN3 AlgebraicMatrixN3
LinearizedTrackState< 5 >::AlgebraicSymMatrixNN AlgebraicSymMatrixNN
double b
Definition: hdecay.h:120
LinearizedTrackState< 5 >::AlgebraicVectorN AlgebraicVectorN
double a
Definition: hdecay.h:121
GlobalError error() const
Definition: VertexState.h:55
int weight
Definition: histoStyle.py:50
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40