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  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  //require states to be positive-definite
44  if (double det = 0; (*ic).covariance().Det2(det) && det > 0) {
45  components.emplace_back((*ic).weight(),
46  LocalTrajectoryParameters((*ic).mean(), pzSign, charged),
47  LocalTrajectoryError((*ic).covariance()),
48  surface,
49  field,
50  side);
51  }
52  }
53  return components.empty()
56  }
57 } // namespace GaussianStateConversions
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
const SurfaceType & surface() const
Mixture of multi-variate gaussian states.
Components const & components() const
std::vector< SingleStatePtr > SingleStateContainer
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 > &)
const MagneticField * magneticField() const
MultiGaussianState< 5 > multiGaussianStateFromTSOS(const TrajectoryStateOnSurface &tsos)