ATLAS Offline Software
Loading...
Searching...
No Matches
PseudoMeasurementOnTrackCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
12
13
14void PseudoMeasurementOnTrackCnv_p1::persToTrans( const Trk :: PseudoMeasurementOnTrack_p1 *persObj,
15 Trk :: PseudoMeasurementOnTrack *transObj, MsgStream &log )
16{
17 Trk::LocalParameters localParams;
18 fillTransFromPStore( &m_localParamsCnv, persObj->m_localParams, &localParams, log );
19 // fillTransFromPStore( &m_localErrMatCnv, persObj->m_localErrMat, &transObj->m_localErrMat, log );
20
21 Trk::ErrorMatrix dummy;
22 Amg::MatrixX localCovariance;
23 fillTransFromPStore( &m_localErrMatCnv, persObj->m_localErrMat, &dummy, log );
24 EigenHelpers::vectorToEigenMatrix(dummy.values, localCovariance, "PseudoMeasurementOnTrackCnv_p1");
25
26 ITPConverterFor<Trk::Surface>* surfaceCnv=nullptr;
28 (this->createTransFromPStore( &surfaceCnv, persObj->m_associatedSurface, log ));
29
30 DetElementSurfaceCnv_p1* detElCnv = dynamic_cast<DetElementSurfaceCnv_p1*>(surfaceCnv);
31 if (detElCnv) {
32 // have a DetElementSurface
33 surf = Trk::ConstSurfaceUniquePtr (detElCnv->createSurface(log));
34 }
35
36 *transObj = Trk::PseudoMeasurementOnTrack (std::move(localParams),
37 std::move(localCovariance),
38 std::move(surf));
39}
40
41void PseudoMeasurementOnTrackCnv_p1::transToPers( const Trk :: PseudoMeasurementOnTrack * transObj,
42 Trk :: PseudoMeasurementOnTrack_p1 * persObj, MsgStream & log)
43{
44 persObj->m_localParams = toPersistent( &m_localParamsCnv, &transObj->localParameters(), log );
45
47 EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "PseudoMeasurementOnTrackCnv_p1");
48 persObj->m_localErrMat = toPersistent( &m_localErrMatCnv, &pMat, log );
49
50 ITPConverterFor<Trk::Surface>* surfaceCnv=nullptr;
51 if (transObj->hasSurface())
52 {
53 // FIXME - this is to handle curvilinear parameters, by forcing them to build a surface. In fact they need a different
54 //persistent type and should store their GP and not surface.
55 if (transObj->associatedSurface().isFree() ) { // if this is a free surface, write it out 'as is'
56 persObj->m_associatedSurface = toPersistent(&surfaceCnv, transObj->associatedSurface().baseSurface(), log);
57 } else {
58 // else, make it into a DetElementSurface, to allow the correct convertor to be called
59 Trk::DetElementSurface dummySurf( transObj->associatedSurface());
60 persObj->m_associatedSurface = this->toPersistent(&surfaceCnv, &dummySurf, log );
61 // Need to do this->toPersistent() to get around 'error: there are no arguments of 'toPersistent' that depend on a template parameter'
62 }
63 }
64 else {
65 log<<MSG::WARNING<<"TrackParameter doesn't have a surface! Dumping: "<<*transObj<<endmsg;
66 }
67}
#define endmsg
const Trk::Surface * createSurface(MsgStream &log)
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
virtual void transToPers(const Trk ::PseudoMeasurementOnTrack *transObj, Trk ::PseudoMeasurementOnTrack_p1 *persObj, MsgStream &log)
virtual void persToTrans(const Trk ::PseudoMeasurementOnTrack_p1 *persObj, Trk ::PseudoMeasurementOnTrack *transObj, MsgStream &log)
std::vector< float > values
Class to handle pseudo-measurements in fitters and on track objects.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)
SurfaceUniquePtrT< const Trk::Surface > ConstSurfaceUniquePtr