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
MultiVertexStateCombiner Class Reference

#include <MultiVertexStateCombiner.h>

Public Types

typedef std::vector< VertexState > VSC
 

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 alignCSCRings::s, tmp, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by BasicMultiVertexState::checkCombinedState().

7 {
8 
9  if (theMixture.empty()) {
10  throw VertexException
11  ("MultiVertexStateCombiner:: VertexState container to collapse is empty");
12  }
13 
14  if (theMixture.size()==1) {
15 // #ifndef CMS_NO_COMPLEX_RETURNS
16  return VertexState(theMixture.front().position(), theMixture.front().error(), 1.0);
17 // #else
18 // VertexState theFinalVM(theMixture.front().position(), theMixture.front().error(), 1.0);
19 // return theFinalVM;
20 // #endif
21  }
22 
23 
24  AlgebraicVector3 meanPosition;
25  double weightSum = 0.;
26  AlgebraicSymMatrix33 measCovar1, measCovar2;
27  for (VSC::const_iterator mixtureIter1 = theMixture.begin();
28  mixtureIter1 != theMixture.end(); mixtureIter1++ ) {
29  double vtxWeight = mixtureIter1->weightInMixture();
30 
31  GlobalPoint vertexPosition = mixtureIter1->position();
32  AlgebraicVector3 vertexCoord1;
33  vertexCoord1[0] = vertexPosition.x();
34  vertexCoord1[1] = vertexPosition.y();
35  vertexCoord1[2] = vertexPosition.z();
36 
37 // AlgebraicVector position = mixtureIter1->position().vector(); //???
38  weightSum += vtxWeight;
39  meanPosition += vtxWeight * vertexCoord1;
40 
41  measCovar1 += vtxWeight * mixtureIter1->error().matrix();
42  for (VSC::const_iterator mixtureIter2 = mixtureIter1+1;
43  mixtureIter2 != theMixture.end(); mixtureIter2++ ) {
44  GlobalPoint vertexPosition2 = mixtureIter2->position();
45  AlgebraicVector3 vertexCoord2;
46  vertexCoord2[0] = vertexPosition2.x();
47  vertexCoord2[1] = vertexPosition2.y();
48  vertexCoord2[2] = vertexPosition2.z();
49  AlgebraicVector3 posDiff = vertexCoord1 - vertexCoord2;
50  AlgebraicMatrix13 tmp; tmp.Place_in_row(posDiff,0,0);
52  measCovar2 +=vtxWeight * mixtureIter2->weightInMixture() * ROOT::Math::SimilarityT(tmp,s);
53  }
54  }
55  meanPosition /= weightSum;
56  AlgebraicSymMatrix33 measCovar = measCovar1/weightSum + measCovar2/weightSum/weightSum;
57 
58  GlobalPoint newPos(meanPosition[0], meanPosition[1], meanPosition[2]);
59 
60 // #ifndef CMS_NO_COMPLEX_RETURNS
61  return VertexState(newPos, GlobalError(measCovar), weightSum);
62 // #else
63 // VertexState theFinalVS(newPos, GlobalError(measCovar), weightSum);
64 // return theFinalVS;
65 // #endif
66 }
Common base class.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
T y() const
Definition: PV3DBase.h:63
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:11
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
T z() const
Definition: PV3DBase.h:64
ROOT::Math::SMatrix< double, 1, 3, ROOT::Math::MatRepStd< double, 1, 3 > > AlgebraicMatrix13
ROOT::Math::SVector< double, 3 > AlgebraicVector3
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
T x() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > AlgebraicSymMatrix11