CMS 3D CMS Logo

MultiVertexStateCombiner Class Reference

Class to collapse (combine) a Gaussian mixture of VertexStates into one. More...

#include <RecoVertex/GaussianSumVertexFit/interface/MultiVertexStateCombiner.h>

List of all members.

Public Types

typedef std::vector< VertexStateVSC

Public Member Functions

VertexState combine (const VSC &theMixture) const


Detailed Description

Class to collapse (combine) a Gaussian mixture of VertexStates into one.

(c.f. R. Fruewirth et.al., Comp.Phys.Comm 100 (1997) 1

Definition at line 14 of file MultiVertexStateCombiner.h.


Member Typedef Documentation

typedef std::vector<VertexState> MultiVertexStateCombiner::VSC

Definition at line 18 of file MultiVertexStateCombiner.h.


Member Function Documentation

VertexState MultiVertexStateCombiner::combine ( const VSC theMixture  )  const

Definition at line 6 of file MultiVertexStateCombiner.cc.

References s, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by BasicMultiVertexState::checkCombinedState().

00007 {
00008 
00009   if (theMixture.empty()) {
00010     throw VertexException
00011     ("MultiVertexStateCombiner:: VertexState container to collapse is empty");
00012   }
00013 
00014   if (theMixture.size()==1) {
00015 //     #ifndef CMS_NO_COMPLEX_RETURNS
00016       return VertexState(theMixture.front().position(), theMixture.front().error(), 1.0);
00017 //     #else
00018 //       VertexState theFinalVM(theMixture.front().position(), theMixture.front().error(), 1.0);
00019 //       return theFinalVM;
00020 //     #endif
00021   }
00022 
00023 
00024   AlgebraicVector meanPosition(3,0);
00025   double weightSum = 0.;
00026   double vtxWeight;
00027   AlgebraicSymMatrix measCovar1(3,0), measCovar2(3,0);
00028   for (VSC::const_iterator mixtureIter1 = theMixture.begin();
00029         mixtureIter1 != theMixture.end(); mixtureIter1++ ) {
00030     vtxWeight = mixtureIter1->weightInMixture();
00031 
00032     GlobalPoint vertexPosition = mixtureIter1->position();
00033     AlgebraicVector vertexCoord1(3);
00034     vertexCoord1[0] = vertexPosition.x();
00035     vertexCoord1[1] = vertexPosition.y();
00036     vertexCoord1[2] = vertexPosition.z();
00037 
00038 //    AlgebraicVector position = mixtureIter1->position().vector(); //???
00039     weightSum += vtxWeight;
00040     meanPosition += vtxWeight * vertexCoord1;
00041 
00042     measCovar1 += vtxWeight * mixtureIter1->error().matrix();
00043     for (VSC::const_iterator mixtureIter2 = mixtureIter1+1;
00044         mixtureIter2 != theMixture.end(); mixtureIter2++ ) {
00045       GlobalPoint vertexPosition2 = mixtureIter2->position();
00046       AlgebraicVector vertexCoord2(3);
00047       vertexCoord2[0] = vertexPosition2.x();
00048       vertexCoord2[1] = vertexPosition2.y();
00049       vertexCoord2[2] = vertexPosition2.z();
00050       AlgebraicVector posDiff = vertexCoord1 - vertexCoord2;
00051       AlgebraicSymMatrix s(1,1); //stupid trick to make CLHEP work decently
00052       measCovar2 +=vtxWeight * mixtureIter2->weightInMixture() * 
00053                                 s.similarity(posDiff.T().T());
00054     }
00055   }
00056   meanPosition /= weightSum;
00057   AlgebraicSymMatrix measCovar = measCovar1/weightSum + measCovar2/weightSum/weightSum;
00058 
00059   GlobalPoint newPos(meanPosition[0], meanPosition[1], meanPosition[2]);
00060 
00061 // #ifndef CMS_NO_COMPLEX_RETURNS
00062   return VertexState(newPos, GlobalError(measCovar), weightSum);
00063 // #else
00064 //   VertexState theFinalVS(newPos, GlobalError(measCovar), weightSum);
00065 //   return theFinalVS;
00066 // #endif
00067 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:36 2009 for CMSSW by  doxygen 1.5.4