CMS 3D CMS Logo

TsosGaussianStateConversions.cc
Go to the documentation of this file.
2 
5 
6 using namespace SurfaceSideDefinition;
7 
8 namespace GaussianStateConversions {
9 
11  {
12  if ( !tsos.isValid() ) return MultiGaussianState<5>();
13 
14  using SingleStatePtr = std::shared_ptr<SingleGaussianState<5>>;
15  auto const & components = tsos.components();
17  singleStates.reserve(components.size());
18  for (auto const & ic : components) {
19  if ( ic.isValid() ) {
20  auto sgs = std::make_shared<SingleGaussianState<5>>(ic.localParameters().vector(),
21  ic.localError().matrix(),
22  ic.weight());
23  singleStates.push_back(sgs);
24  }
25  }
26  return MultiGaussianState<5>(singleStates);
27  }
28 
30  const TrajectoryStateOnSurface & refTsos)
31  {
32  if ( multiState.components().empty() ) return TrajectoryStateOnSurface();
33  const Surface & surface = refTsos.surface();
34  SurfaceSide side = refTsos.surfaceSide();
35  const MagneticField* field = refTsos.magneticField();
36  auto const & refTsos1 = refTsos.components().front();
37  auto pzSign = refTsos1.localParameters().pzSign();
38  bool charged = refTsos1.charge()!=0;
39 
40  auto const & singleStates = multiState.components();
41  std::vector<TrajectoryStateOnSurface> components;
42  components.reserve(singleStates.size());
43  for ( auto const & ic : singleStates ) {
44  components.emplace_back((*ic).weight(),
45  LocalTrajectoryParameters((*ic).mean(), pzSign,charged),
46  LocalTrajectoryError((*ic).covariance()),
47  surface,field,side);
48  }
50  }
51 }
52 
const SingleStateContainer & components() const
access to components (single Gaussian states)
const MagneticField * magneticField() const
Mixture of multi-variate gaussian states.
std::vector< SingleStatePtr > SingleStateContainer
const SurfaceType & surface() const
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
TrajectoryStateOnSurface tsosFromMultiGaussianState(const MultiGaussianState< 5 > &multiState, const TrajectoryStateOnSurface &refTsos)
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)
Components const & components() const
MultiGaussianState< 5 > multiGaussianStateFromTSOS(const TrajectoryStateOnSurface &tsos)