CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TsosGaussianStateConversions.cc
Go to the documentation of this file.
2 
5 #include "boost/shared_ptr.hpp"
6 
7 using namespace SurfaceSideDefinition;
8 
9 namespace GaussianStateConversions {
10 
12  {
13  if ( !tsos.isValid() ) return MultiGaussianState<5>();
14 
15  typedef boost::shared_ptr< SingleGaussianState<5> > SingleStatePtr;
16  const std::vector<TrajectoryStateOnSurface>& components = tsos.components();
18  singleStates.reserve(components.size());
19  for ( std::vector<TrajectoryStateOnSurface>::const_iterator ic=components.begin();
20  ic!=components.end(); ic ++ ) {
21  if ( ic->isValid() ) {
22  SingleStatePtr sgs(new SingleGaussianState<5>(ic->localParameters().vector(),
23  ic->localError().matrix(),
24  ic->weight()));
25  singleStates.push_back(sgs);
26  }
27  }
28  return MultiGaussianState<5>(singleStates);
29  }
30 
32  const TrajectoryStateOnSurface refTsos)
33  {
34  if ( multiState.components().empty() ) return TrajectoryStateOnSurface();
35  const Surface& surface = refTsos.surface();
36  SurfaceSide side = refTsos.surfaceSide();
37  const MagneticField* field = refTsos.magneticField();
38  TrajectoryStateOnSurface refTsos1 = refTsos.components().front();
39  double pzSign = refTsos1.localParameters().pzSign();
40  bool charged = refTsos1.charge()!=0;
41 
42  const MultiGaussianState<5>::SingleStateContainer& singleStates =
43  multiState.components();
44  std::vector<TrajectoryStateOnSurface> components;
45  components.reserve(singleStates.size());
47  ic!=singleStates.end(); ic++ ) {
48  components.push_back(TrajectoryStateOnSurface((**ic).weight(), LocalTrajectoryParameters((**ic).mean(),
49  pzSign,charged),
50  LocalTrajectoryError((**ic).covariance()),
51  surface,field,side));
52  }
54  }
55 }
56 
const LocalTrajectoryParameters & localParameters() const
const SingleStateContainer & components() const
access to components (single Gaussian states)
const MagneticField * magneticField() const
Mixture of multi-variate gaussian states.
MultiGaussianState< 5 > multiGaussianStateFromTSOS(const TrajectoryStateOnSurface tsos)
std::vector< SingleStatePtr > SingleStateContainer
const SurfaceType & surface() const
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)
float pzSign() const
Sign of the z-component of the momentum in the local frame.
std::vector< TrajectoryStateOnSurface > components() const
TrajectoryStateOnSurface tsosFromMultiGaussianState(const MultiGaussianState< 5 > &multiState, const TrajectoryStateOnSurface refTsos)