CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexGaussianStateConversions.cc
Go to the documentation of this file.
2 
5 #include "boost/shared_ptr.hpp"
6 
7 namespace GaussianStateConversions {
8 
10  {
11  typedef boost::shared_ptr< SingleGaussianState<3> > SingleStatePtr;
12  const std::vector<VertexState> components = aState.components();
14  singleStates.reserve(components.size());
15  for ( std::vector<VertexState>::const_iterator ic=components.begin();
16  ic!=components.end(); ic ++ ) {
17  if ( ic->isValid() ) {
18  GlobalPoint pos(ic->position());
20  parameters(0) = pos.x(); parameters(1) = pos.y(); parameters(2) = pos.z();
21  SingleStatePtr sgs(new SingleGaussianState<3>(parameters,
22  ic->error().matrix_new(),
23  ic->weightInMixture()));
24  singleStates.push_back(sgs);
25  }
26  }
27  return MultiGaussianState<3>(singleStates);
28  }
29 
31  {
32  if ( multiState.components().empty() ) return VertexState();
33 
34  const MultiGaussianState<3>::SingleStateContainer& singleStates =
35  multiState.components();
36  std::vector<VertexState> components;
37  components.reserve(singleStates.size());
39  ic!=singleStates.end(); ic++ ) {
40  const AlgebraicVector3& par = (**ic).mean();
41  GlobalPoint position(par(0),par(1),par(2));
42  const AlgebraicSymMatrix33& cov = (**ic).covariance();
43  GlobalError error(cov(0,0),cov(1,0),cov(2,0),cov(1,1),cov(2,1),cov(2,2));
44  components.push_back(VertexState(position,error,(**ic).weight()));
45  }
46  return VertexState(new BasicMultiVertexState(components));
47  }
48 }
49 
MultiGaussianState< 3 > multiGaussianStateFromVertex(const VertexState aState)
dictionary parameters
Definition: Parameters.py:2
const SingleStateContainer & components() const
access to components (single Gaussian states)
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
VertexState vertexFromMultiGaussianState(const MultiGaussianState< 3 > &multiState)
Mixture of multi-variate gaussian states.
std::vector< SingleStatePtr > SingleStateContainer
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
ROOT::Math::SVector< double, 3 > AlgebraicVector3
std::vector< VertexState > components() const
Definition: VertexState.h:61
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)