CMS 3D CMS Logo

Functions

GaussianStateConversions Namespace Reference

Functions

MultiGaussianState< 5 > multiGaussianStateFromTSOS (const TrajectoryStateOnSurface tsos)
MultiGaussianState< 3 > multiGaussianStateFromVertex (const VertexState aState)
TrajectoryStateOnSurface tsosFromMultiGaussianState (const MultiGaussianState< 5 > &multiState, const TrajectoryStateOnSurface refTsos)
VertexState vertexFromMultiGaussianState (const MultiGaussianState< 3 > &multiState)

Function Documentation

MultiGaussianState< 5 > GaussianStateConversions::multiGaussianStateFromTSOS ( const TrajectoryStateOnSurface  tsos)

Definition at line 11 of file TsosGaussianStateConversions.cc.

References TrajectoryStateOnSurface::components(), and TrajectoryStateOnSurface::isValid().

Referenced by MultiTrajectoryStateMerger::merge().

  {
    if ( !tsos.isValid() )  return MultiGaussianState<5>();

    typedef boost::shared_ptr< SingleGaussianState<5> > SingleStatePtr;
    const std::vector<TrajectoryStateOnSurface>& components = tsos.components();
    MultiGaussianState<5>::SingleStateContainer singleStates;
    singleStates.reserve(components.size());
    for ( std::vector<TrajectoryStateOnSurface>::const_iterator ic=components.begin();
          ic!=components.end(); ic ++ ) {
      if ( ic->isValid() ) {
        SingleStatePtr sgs(new SingleGaussianState<5>(ic->localParameters().vector(),
                                                              ic->localError().matrix(),
                                                              ic->weight()));
        singleStates.push_back(sgs);
      }
    }
    return MultiGaussianState<5>(singleStates);
  }
MultiGaussianState< 3 > GaussianStateConversions::multiGaussianStateFromVertex ( const VertexState  aState)

Definition at line 10 of file VertexGaussianStateConversions.cc.

References VertexState::components(), Parameters::parameters, and pos.

Referenced by GsfVertexMerger::merge().

  {
    typedef boost::shared_ptr< SingleGaussianState<3> > SingleStatePtr;
    const std::vector<VertexState> components = aState.components();
    MultiGaussianState<3>::SingleStateContainer singleStates;
    singleStates.reserve(components.size());
    for ( std::vector<VertexState>::const_iterator ic=components.begin();
          ic!=components.end(); ic ++ ) {
      if ( ic->isValid() ) {
        GlobalPoint pos(ic->position());
        AlgebraicVector3 parameters;
        parameters(0) = pos.x(); parameters(1) = pos.y(); parameters(2) = pos.z();
        SingleStatePtr sgs(new SingleGaussianState<3>(parameters,
                                                         ic->error().matrix_new(),
                                                         ic->weightInMixture()));
        singleStates.push_back(sgs);
      }
    }
    return MultiGaussianState<3>(singleStates);
  }
TrajectoryStateOnSurface GaussianStateConversions::tsosFromMultiGaussianState ( const MultiGaussianState< 5 > &  multiState,
const TrajectoryStateOnSurface  refTsos 
)

Definition at line 31 of file TsosGaussianStateConversions.cc.

References TrajectoryStateOnSurface::charge(), MultiGaussianState< N >::components(), TrajectoryStateOnSurface::components(), TrajectoryStateOnSurface::localParameters(), TrajectoryStateOnSurface::magneticField(), LocalTrajectoryParameters::pzSign(), TrajectoryStateOnSurface::surface(), and TrajectoryStateOnSurface::surfaceSide().

Referenced by MultiTrajectoryStateMerger::merge().

  {
    if ( multiState.components().empty() )  return TrajectoryStateOnSurface();
    const Surface& surface = refTsos.surface();
    SurfaceSide side = refTsos.surfaceSide();
    const MagneticField* field = refTsos.magneticField();
    TrajectoryStateOnSurface refTsos1 = refTsos.components().front();
    double pzSign = refTsos1.localParameters().pzSign();
    bool charged = refTsos1.charge()!=0;

    const MultiGaussianState<5>::SingleStateContainer& singleStates = 
      multiState.components();
    std::vector<TrajectoryStateOnSurface> components;
    components.reserve(singleStates.size());
    for ( MultiGaussianState<5>::SingleStateContainer::const_iterator ic=singleStates.begin();
          ic!=singleStates.end(); ic++ ) {
      components.push_back(TrajectoryStateOnSurface(LocalTrajectoryParameters((**ic).mean(),
                                                                              pzSign,charged),
                                                    LocalTrajectoryError((**ic).covariance()),
                                                    surface,field,side,(**ic).weight()));
    }
    return TrajectoryStateOnSurface(new BasicMultiTrajectoryState(components));
  }
VertexState GaussianStateConversions::vertexFromMultiGaussianState ( const MultiGaussianState< 3 > &  multiState)

Definition at line 31 of file VertexGaussianStateConversions.cc.

References MultiGaussianState< N >::components(), error, Gflash::par, and position.

Referenced by GsfVertexMerger::merge().

  {
    if ( multiState.components().empty() )  return VertexState();

    const MultiGaussianState<3>::SingleStateContainer& singleStates = 
      multiState.components();
    std::vector<VertexState> components;
    components.reserve(singleStates.size());
    for ( MultiGaussianState<3>::SingleStateContainer::const_iterator ic=singleStates.begin();
          ic!=singleStates.end(); ic++ ) {
      const AlgebraicVector3& par = (**ic).mean();
      GlobalPoint position(par(0),par(1),par(2));
      const AlgebraicSymMatrix33& cov = (**ic).covariance();
      GlobalError error(cov(0,0),cov(1,0),cov(2,0),cov(1,1),cov(2,1),cov(2,2));
      components.push_back(VertexState(position,error,(**ic).weight()));
    }
    return VertexState(new BasicMultiVertexState(components));
  }