ATLAS Offline Software
Loading...
Searching...
No Matches
TrackParametersCovarianceCnv.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id$
14
15
16#ifndef TRKEVENTTPCNV_TRACKPARAMETERSCOVARIANCECNV_H
17#define TRKEVENTTPCNV_TRACKPARAMETERSCOVARIANCECNV_H
18
19
21
22template <typename PARMS>
24{
25public:
26 static void setCovariance (PARMS* p,
27 const Trk::ErrorMatrix& mat);
28};
29
30
31template <typename PARMS>
33 const Trk::ErrorMatrix& mat)
34{
35 if (!p->m_covariance || p->m_covariance->size() != PARMS::dim) {
36 p->m_covariance.emplace();
37 }
38 if (mat.values.size() == PARMS::dim*(PARMS::dim+1)/2){
39 EigenHelpers::vectorToEigenMatrix(mat.values, *(p->m_covariance), "TrackParametersCovarianceCnv");
40 }
41 else if (mat.values.size() == 6) {
42 auto& cov = *(p->m_covariance);
43 cov.setZero();
44 unsigned int pos = 0;
45 for (unsigned int i=0; i < 3; i++)
46 for (unsigned int j=0; j <= i; j++)
47 cov.fillSymmetric (i, j, mat.values[pos++]);
48 }
49 else
50 std::abort();
51}
52
53
54#endif // not TRKEVENTTPCNV_TRACKPARAMETERSCOVARIANCECNV_H
static void setCovariance(PARMS *p, const Trk::ErrorMatrix &mat)