RecoVertex
GaussianSumVertexFit
src
VertexGaussianStateConversions.cc
Go to the documentation of this file.
1
#include "
RecoVertex/GaussianSumVertexFit/interface/VertexGaussianStateConversions.h
"
2
3
#include "
RecoVertex/GaussianSumVertexFit/interface/BasicMultiVertexState.h
"
4
#include "
TrackingTools/GsfTools/interface/SingleGaussianState.h
"
5
6
namespace
GaussianStateConversions
{
7
8
MultiGaussianState<3>
multiGaussianStateFromVertex
(
const
VertexState
aState) {
9
typedef
std::shared_ptr<SingleGaussianState<3> > SingleStatePtr;
10
const
std::vector<VertexState>
components
= aState.
components
();
11
MultiGaussianState<3>::SingleStateContainer
singleStates;
12
singleStates.reserve(
components
.size());
13
for
(std::vector<VertexState>::const_iterator ic =
components
.begin(); ic !=
components
.end(); ic++) {
14
if
(ic->isValid()) {
15
GlobalPoint
pos
(ic->position());
16
AlgebraicVector3
parameters
;
17
parameters
(0) =
pos
.x();
18
parameters
(1) =
pos
.y();
19
parameters
(2) =
pos
.z();
20
SingleStatePtr sgs(
new
SingleGaussianState<3>
(
parameters
, ic->error().matrix(), ic->weightInMixture()));
21
singleStates.push_back(sgs);
22
}
23
}
24
return
MultiGaussianState<3>
(singleStates);
25
}
26
27
VertexState
vertexFromMultiGaussianState
(
const
MultiGaussianState<3>
&
multiState
) {
28
if
(
multiState
.components().empty())
29
return
VertexState
();
30
31
const
MultiGaussianState<3>::SingleStateContainer
& singleStates =
multiState
.components();
32
std::vector<VertexState>
components
;
33
components
.reserve(singleStates.size());
34
for
(
MultiGaussianState<3>::SingleStateContainer::const_iterator
ic = singleStates.begin();
35
ic != singleStates.end();
36
ic++) {
37
const
AlgebraicVector3
& par = (**ic).mean();
38
GlobalPoint
position
(par(0), par(1), par(2));
39
const
AlgebraicSymMatrix33
& cov = (**ic).covariance();
40
GlobalError
error
(cov(0, 0), cov(1, 0), cov(2, 0), cov(1, 1), cov(2, 1), cov(2, 2));
41
components
.push_back(
VertexState
(
position
,
error
, (**ic).weight()));
42
}
43
return
VertexState
(
new
BasicMultiVertexState
(
components
));
44
}
45
}
// namespace GaussianStateConversions
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition:
AlgebraicROOTObjects.h:12
BeamSpotPI::parameters
parameters
Definition:
BeamSpotPayloadInspectorHelper.h:29
AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition:
AlgebraicROOTObjects.h:21
BasicMultiVertexState.h
pos
Definition:
PixelAliasList.h:18
MultiGaussianState
Mixture of multi-variate gaussian states.
Definition:
MultiGaussianState.h:18
relativeConstraints.error
error
Definition:
relativeConstraints.py:53
GaussianStateConversions
Definition:
VertexGaussianStateConversions.h:6
Point3DBase< float, GlobalTag >
BasicMultiVertexState
Definition:
BasicMultiVertexState.h:12
MultiGaussianStateTransform::multiState
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)
Definition:
MultiGaussianStateTransform.cc:39
SingleGaussianState
Definition:
SingleGaussianState.h:14
GaussianStateConversions::multiGaussianStateFromVertex
MultiGaussianState< 3 > multiGaussianStateFromVertex(const VertexState aState)
Definition:
VertexGaussianStateConversions.cc:8
VertexState::components
std::vector< VertexState > components() const
Definition:
VertexState.h:90
position
static int position[264][3]
Definition:
ReadPGInfo.cc:289
VertexGaussianStateConversions.h
GlobalErrorBase< double, ErrorMatrixTag >
GaussianStateConversions::vertexFromMultiGaussianState
VertexState vertexFromMultiGaussianState(const MultiGaussianState< 3 > &multiState)
Definition:
VertexGaussianStateConversions.cc:27
VertexState
Definition:
VertexState.h:13
makeMuonMisalignmentScenario.components
string components
Definition:
makeMuonMisalignmentScenario.py:58
MultiGaussianState::SingleStateContainer
std::vector< SingleStatePtr > SingleStateContainer
Definition:
MultiGaussianState.h:25
SingleGaussianState.h
Generated for CMSSW Reference Manual by
1.8.16