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  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
BasicMultiTrajectoryState
Definition: BasicMultiTrajectoryState.h:17
MultiGaussianState
Mixture of multi-variate gaussian states.
Definition: MultiGaussianState.h:18
TsosGaussianStateConversions.h
Surface
Definition: Surface.h:36
SurfaceSideDefinition::SurfaceSide
SurfaceSide
Definition: SurfaceSideDefinition.h:8
GaussianStateConversions::tsosFromMultiGaussianState
TrajectoryStateOnSurface tsosFromMultiGaussianState(const MultiGaussianState< 5 > &multiState, const TrajectoryStateOnSurface &refTsos)
Definition: TsosGaussianStateConversions.cc:28
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
GaussianStateConversions
Definition: VertexGaussianStateConversions.h:6
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
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
GaussianStateConversions::multiGaussianStateFromTSOS
MultiGaussianState< 5 > multiGaussianStateFromTSOS(const TrajectoryStateOnSurface &tsos)
Definition: TsosGaussianStateConversions.cc:10
TrajectoryStateOnSurface::components
Components const & components() const
Definition: TrajectoryStateOnSurface.h:85
SurfaceSideDefinition
Definition: SurfaceSideDefinition.h:7
BasicTrajectoryState
Definition: BasicTrajectoryState.h:66
makeMuonMisalignmentScenario.components
string components
Definition: makeMuonMisalignmentScenario.py:58
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
MultiGaussianState::SingleStateContainer
std::vector< SingleStatePtr > SingleStateContainer
Definition: MultiGaussianState.h:25
BasicMultiTrajectoryState.h
MagneticField
Definition: MagneticField.h:19
TrajectoryStateOnSurface::surfaceSide
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
Definition: TrajectoryStateOnSurface.h:89
TrajectoryStateOnSurface::magneticField
const MagneticField * magneticField() const
Definition: TrajectoryStateOnSurface.h:62
SingleGaussianState.h
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54