CMS 3D CMS Logo

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