5 if (theMixture.empty()) {
6 throw VertexException(
"MultiVertexStateCombiner:: VertexState container to collapse is empty");
9 if (theMixture.size() == 1) {
11 return VertexState(theMixture.front().position(), theMixture.front().error(), 1.0);
19 double weightSum = 0.;
21 for (VSC::const_iterator mixtureIter1 = theMixture.begin(); mixtureIter1 != theMixture.end(); mixtureIter1++) {
22 double vtxWeight = mixtureIter1->weightInMixture();
24 GlobalPoint vertexPosition = mixtureIter1->position();
26 vertexCoord1[0] = vertexPosition.
x();
27 vertexCoord1[1] = vertexPosition.
y();
28 vertexCoord1[2] = vertexPosition.
z();
31 weightSum += vtxWeight;
32 meanPosition += vtxWeight * vertexCoord1;
34 measCovar1 += vtxWeight * mixtureIter1->error().matrix();
35 for (VSC::const_iterator mixtureIter2 = mixtureIter1 + 1; mixtureIter2 != theMixture.end(); mixtureIter2++) {
36 GlobalPoint vertexPosition2 = mixtureIter2->position();
38 vertexCoord2[0] = vertexPosition2.
x();
39 vertexCoord2[1] = vertexPosition2.
y();
40 vertexCoord2[2] = vertexPosition2.
z();
43 tmp.Place_in_row(posDiff, 0, 0);
45 measCovar2 += vtxWeight * mixtureIter2->weightInMixture() * ROOT::Math::SimilarityT(
tmp,
s);
48 meanPosition /= weightSum;
51 GlobalPoint newPos(meanPosition[0], meanPosition[1], meanPosition[2]);