CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TsosGaussianStateConversions.cc
Go to the documentation of this file.
2 
5 
6 using namespace SurfaceSideDefinition;
7 
8 namespace GaussianStateConversions {
9 
11  if (!tsos.isValid())
12  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>>(
21  ic.localParameters().vector(), ic.localError().matrix(), ic.weight());
22  singleStates.push_back(sgs);
23  }
24  }
25  return MultiGaussianState<5>(singleStates);
26  }
27 
29  const TrajectoryStateOnSurface& refTsos) {
30  if (multiState.components().empty())
31  return TrajectoryStateOnSurface();
32  const Surface& surface = refTsos.surface();
33  SurfaceSide side = refTsos.surfaceSide();
34  const MagneticField* field = refTsos.magneticField();
35  auto const& refTsos1 = refTsos.components().front();
36  auto pzSign = refTsos1.localParameters().pzSign();
37  bool charged = refTsos1.charge() != 0;
38 
39  auto const& singleStates = multiState.components();
40  std::vector<TrajectoryStateOnSurface> components;
41  components.reserve(singleStates.size());
42  for (auto const& ic : singleStates) {
43  components.emplace_back((*ic).weight(),
44  LocalTrajectoryParameters((*ic).mean(), pzSign, charged),
45  LocalTrajectoryError((*ic).covariance()),
46  surface,
47  field,
48  side);
49  }
51  }
52 } // namespace GaussianStateConversions
const SingleStateContainer & components() const
access to components (single Gaussian states)
const MagneticField * magneticField() const
Mixture of multi-variate gaussian states.
const SurfaceType & surface() const
std::vector< SingleStatePtr > SingleStateContainer
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)