CMS 3D CMS Logo

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().

00012   {
00013     if ( !tsos.isValid() )  return MultiGaussianState<5>();
00014 
00015     typedef boost::shared_ptr< SingleGaussianState<5> > SingleStatePtr;
00016     const std::vector<TrajectoryStateOnSurface>& components = tsos.components();
00017     MultiGaussianState<5>::SingleStateContainer singleStates;
00018     singleStates.reserve(components.size());
00019     for ( std::vector<TrajectoryStateOnSurface>::const_iterator ic=components.begin();
00020           ic!=components.end(); ic ++ ) {
00021       if ( ic->isValid() ) {
00022         SingleStatePtr sgs(new SingleGaussianState<5>(ic->localParameters().vector(),
00023                                                               ic->localError().matrix(),
00024                                                               ic->weight()));
00025         singleStates.push_back(sgs);
00026       }
00027     }
00028     return MultiGaussianState<5>(singleStates);
00029   }

MultiGaussianState< 3 > GaussianStateConversions::multiGaussianStateFromVertex ( const VertexState  aState  ) 

Definition at line 10 of file VertexGaussianStateConversions.cc.

References VertexState::components(), and python::trackProbabilityAnalysis_cff::parameters.

Referenced by GsfVertexMerger::merge().

00011   {
00012     typedef boost::shared_ptr< SingleGaussianState<3> > SingleStatePtr;
00013     const std::vector<VertexState> components = aState.components();
00014     MultiGaussianState<3>::SingleStateContainer singleStates;
00015     singleStates.reserve(components.size());
00016     for ( std::vector<VertexState>::const_iterator ic=components.begin();
00017           ic!=components.end(); ic ++ ) {
00018       if ( ic->isValid() ) {
00019         GlobalPoint pos(ic->position());
00020         AlgebraicVector3 parameters;
00021         parameters(0) = pos.x(); parameters(1) = pos.y(); parameters(2) = pos.z();
00022         SingleStatePtr sgs(new SingleGaussianState<3>(parameters,
00023                                                          ic->error().matrix_new(),
00024                                                          ic->weightInMixture()));
00025         singleStates.push_back(sgs);
00026       }
00027     }
00028     return MultiGaussianState<3>(singleStates);
00029   }

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().

00033   {
00034     if ( multiState.components().empty() )  return TrajectoryStateOnSurface();
00035     const Surface& surface = refTsos.surface();
00036     SurfaceSide side = refTsos.surfaceSide();
00037     const MagneticField* field = refTsos.magneticField();
00038     TrajectoryStateOnSurface refTsos1 = refTsos.components().front();
00039     double pzSign = refTsos1.localParameters().pzSign();
00040     bool charged = refTsos1.charge()!=0;
00041 
00042     const MultiGaussianState<5>::SingleStateContainer& singleStates = 
00043       multiState.components();
00044     std::vector<TrajectoryStateOnSurface> components;
00045     components.reserve(singleStates.size());
00046     for ( MultiGaussianState<5>::SingleStateContainer::const_iterator ic=singleStates.begin();
00047           ic!=singleStates.end(); ic++ ) {
00048       components.push_back(TrajectoryStateOnSurface(LocalTrajectoryParameters((**ic).mean(),
00049                                                                               pzSign,charged),
00050                                                     LocalTrajectoryError((**ic).covariance()),
00051                                                     surface,field,side,(**ic).weight()));
00052     }
00053     return TrajectoryStateOnSurface(new BasicMultiTrajectoryState(components));
00054   }

VertexState GaussianStateConversions::vertexFromMultiGaussianState ( const MultiGaussianState< 3 > &  multiState  ) 

Definition at line 31 of file VertexGaussianStateConversions.cc.

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

Referenced by GsfVertexMerger::merge().

00032   {
00033     if ( multiState.components().empty() )  return VertexState();
00034 
00035     const MultiGaussianState<3>::SingleStateContainer& singleStates = 
00036       multiState.components();
00037     std::vector<VertexState> components;
00038     components.reserve(singleStates.size());
00039     for ( MultiGaussianState<3>::SingleStateContainer::const_iterator ic=singleStates.begin();
00040           ic!=singleStates.end(); ic++ ) {
00041       const AlgebraicVector3& par = (**ic).mean();
00042       GlobalPoint position(par(0),par(1),par(2));
00043       const AlgebraicSymMatrix33& cov = (**ic).covariance();
00044       GlobalError error(cov(0,0),cov(1,0),cov(2,0),cov(1,1),cov(2,1),cov(2,2));
00045       components.push_back(VertexState(position,error,(**ic).weight()));
00046     }
00047     return VertexState(new BasicMultiVertexState(components));
00048   }


Generated on Tue Jun 9 18:47:14 2009 for CMSSW by  doxygen 1.5.4