ATLAS Offline Software
RecVertexCnv_p2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "VxVertex/RecVertex.h"
7 
11 
12 static const FitQualityCnv_p1 fitQualityCnv;
13 
14 void RecVertexCnv_p2::persToTrans(const Trk::RecVertex_p2 * persObj, Trk::RecVertex * transObj, MsgStream &log) {
15 
16  // fillTransFromPStore( &m_vertexConverter, persObj->vtx, transObj, log);
17  Amg::Vector3D trans_position(persObj->m_position[0], persObj->m_position[1], persObj->m_position[2]);
18 
19  // fillTransFromPStore( &m_errorMatrixConverter, persObj->m_positionError, &transObj->m_positionCovariance, log );
20 
23  AmgSymMatrix(3) cov;
24  if (!dummy.values.empty()){
25  if (dummy.values.empty()) dummy.values.resize(6);
26  EigenHelpers::vectorToEigenMatrix(dummy.values, cov, "RecVertexCnv_p2");
27  } else {
28  // Seems we didn't write out an error matrix - set it to an identity
29  cov.setIdentity();
30  }
31 
32 
33  *transObj = Trk::RecVertex (trans_position, cov,
34  persObj->m_fitQuality.m_numberDoF,
35  persObj->m_fitQuality.m_chiSquared);
36 }
37 
38 void RecVertexCnv_p2::transToPers(const Trk::RecVertex * transObj, Trk::RecVertex_p2 * persObj, MsgStream &log) {
39 
40  // persObj->vtx = baseToPersistent(&m_vertexConverter, transObj, log );
41  const Amg::Vector3D& trans_position = transObj->position();
42  persObj->m_position[0] = trans_position(0);
43  persObj->m_position[1] = trans_position(1);
44  persObj->m_position[2] = trans_position(2);
45 
46  // persObj->m_positionError = toPersistent( &m_errorMatrixConverter, &(transObj->m_positionCovariance), log );
47  Trk::ErrorMatrix pMat;
48  EigenHelpers::eigenMatrixToVector(pMat.values, transObj->covariancePosition(), "RecVertexCnv_p2");
50 
51  // persObj->m_fitQuality = toPersistent( &m_fitQualityConverter, &(transObj->m_fitQuality), log );
52  fitQualityCnv.transToPers(&transObj->fitQuality(), &persObj->m_fitQuality, log);
53 
54  // std::cout<<"ILIJA written RecVertex_p2 "<<(*transObj)<<std::endl;
55 }
RecVertex.h
Trk::RecVertex_p2::m_positionError
TPObjRef m_positionError
Definition: RecVertex_p2.h:26
Trk::RecVertex_p2::m_fitQuality
FitQuality_p1 m_fitQuality
Definition: RecVertex_p2.h:29
RecVertexCnv_p2::persToTrans
void persToTrans(const Trk::RecVertex_p2 *persObj, Trk::RecVertex *transObj, MsgStream &log)
Definition: RecVertexCnv_p2.cxx:14
Trk::FitQuality_p1::m_numberDoF
float m_numberDoF
Definition: FitQuality_p1.h:28
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
FitQualityCnv_p1
Definition: FitQualityCnv_p1.h:22
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
FitQuality_p1.h
ITPConverterFor< TRANS_BASE >::fillTransFromPStore
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
Convert persistent object, stored in the the top-level persistent object and referenced by the TP Ref...
Definition: TPConverter.h:145
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
Trk::ErrorMatrix
Definition: ErrorMatrixCnv_p1.h:25
FitQualityCnv_p1::transToPers
virtual void transToPers(const Trk ::FitQuality *transObj, Trk ::FitQuality_p1 *persObj, MsgStream &log) const override
Definition: FitQualityCnv_p1.cxx:20
RecVertexCnv_p2.h
EigenHelpers::vectorToEigenMatrix
static void vectorToEigenMatrix(VECTOR &vec, COVARIANCE &cov, const char *)
Helper fn to fill the covariance from the raw data (vec<float>)
Definition: EigenHelpers.h:22
Trk::FitQuality_p1::m_chiSquared
float m_chiSquared
Definition: FitQuality_p1.h:27
Trk::RecVertex_p2::m_position
float m_position[3]
Definition: RecVertex_p2.h:23
Trk::RecVertex::fitQuality
const Trk::FitQuality & fitQuality() const
Fit quality access method.
Definition: RecVertex.cxx:74
EigenHelpers.h
python.xAODType.dummy
dummy
Definition: xAODType.py:4
RecVertexCnv_p2::transToPers
void transToPers(const Trk::RecVertex *transObj, Trk::RecVertex_p2 *persObj, MsgStream &log)
Definition: RecVertexCnv_p2.cxx:38
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
EigenHelpers::eigenMatrixToVector
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)
Helper fn to get raw data (vec<float>) from the covariance.
Definition: EigenHelpers.h:30
ITPConverterFor< TRANS_BASE >::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
Definition: TPConverter.h:119
RecVertexCnv_p2::m_errorMatrixConverter
ITPConverterFor< Trk::ErrorMatrix > * m_errorMatrixConverter
Definition: RecVertexCnv_p2.h:29
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ErrorMatrix::values
std::vector< float > values
Definition: ErrorMatrixCnv_p1.h:27
FitQualityCnv_p1.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::RecVertex_p2
Definition: RecVertex_p2.h:14