CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajectoryStateCombiner.cc
Go to the documentation of this file.
3 
5 
7 TrajectoryStateCombiner::combine(const TSOS& Tsos1, const TSOS& Tsos2) const {
8 
9  double pzSign = Tsos1.localParameters().pzSign();
12  const AlgebraicSymMatrix55 &C1 = (Tsos1.localError().matrix());
13  const AlgebraicSymMatrix55 &C2 = (Tsos2.localError().matrix());
14 
15  AlgebraicSymMatrix55 Csum = C1 + C2;
16  bool ok = invertPosDefMatrix(Csum);
17  AlgebraicMatrix55 K = C1*Csum;
18 
19  if(!ok) {
20  edm::LogError("MatrixInversionFailure")
21  <<"the inversion of the combined error matrix failed. Impossible to get a combined state."
22  <<"\nmatrix 1:"<<C1
23  <<"\nmatrix 2:"<<C2;
24  return TSOS();
25  }
26 
27  AlgebraicVector5 xcomb = x1 + K*(x2 - x1);
28  //AlgebraicSymMatrix55 Ccomb; Ccomb.assign(K*C2);
29  AlgebraicSymMatrix55 Ccomb = (AlgebraicMatrix55(K*C2)).LowerBlock();
30 
31  TSOS combTsos( LocalTrajectoryParameters(xcomb, pzSign),
32  LocalTrajectoryError(Ccomb), Tsos1.surface(),
33  &(Tsos1.globalParameters().magneticField()));
34  return combTsos;
35 }
TrajectoryStateOnSurface TSOS
double pzSign() const
Sign of the z-component of the momentum in the local frame.
const LocalTrajectoryParameters & localParameters() const
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
AlgebraicVector5 vector() const
const SurfaceType & surface() const
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const GlobalTrajectoryParameters & globalParameters() const
const MagneticField & magneticField() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55