ATLAS Offline Software
MuonSegmentCnv_p2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
8 #include "TrkSurfaces/Surface.h"
12 
13 
14 void MuonSegmentCnv_p2::persToTrans( const Muon::MuonSegment_p1 *persObj, Muon::MuonSegment *transObj, MsgStream &log )
15 {
16  Amg::Vector2D locSegPos;
17  locSegPos.setZero();
18 
19  Trk::LocalDirection localDirection;
20  m_localDirCnv.persToTrans(&persObj->m_localDirection,&localDirection,log);
21 
22  Trk::PlaneSurface* associatedSurface =
23  static_cast<Trk::PlaneSurface*>(this->createTransFromPStore( &m_surfCnv, persObj->m_associatedSurface, log ));
24 
25  *transObj = Muon::MuonSegment (locSegPos,
26  localDirection,
27  Amg::MatrixX(), // locErr,
28  associatedSurface,
30  nullptr, // qual
32  );
33  fillTransFromPStore( &m_segmentCnv, persObj->m_segment, transObj, log );
34  transObj->setT0Error (persObj->m_t0, persObj->m_t0Error);
35  transObj->recalculateCache();
36 }
37 
38 
39 void MuonSegmentCnv_p2::transToPers( const Muon::MuonSegment *transObj, Muon::MuonSegment_p1 *persObj, MsgStream &log )
40 {
41  persObj->m_segment = baseToPersistent( &m_segmentCnv, transObj, log );
43 
44  m_surfCnv=nullptr;
45  if (transObj->associatedSurface().isFree() ) // if this is a free surface, write it out 'as is'
47  else { // else, make it into a DetElementSurface, to allow the correct convertor to be called
48  Trk::DetElementSurface surf( transObj->associatedSurface());
49  persObj->m_associatedSurface = toPersistent(&m_surfCnv, &surf, log);
50  }
51 
52  persObj->m_t0 = transObj->time();
53  persObj->m_t0Error = transObj->errorTime();
54 
55 }
Trk::SpaceTimePointBase::errorTime
float errorTime() const
access to the error on the measured time
Definition: SpaceTimePointBase.h:50
Muon::MuonSegment_p1::m_t0Error
float m_t0Error
Definition: MuonSegment_p1.h:29
MuonSegmentCnv_p2.h
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Surface.h
Muon::MuonSegment_p1::m_associatedSurface
TPObjRef m_associatedSurface
Definition: MuonSegment_p1.h:27
Muon::MuonSegment_p1::m_localDirection
Trk::LocalDirection_p1 m_localDirection
Definition: MuonSegment_p1.h:26
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonSegmentCnv_p2::transToPers
void transToPers(const Muon ::MuonSegment *transObj, Muon::MuonSegment_p1 *persObj, MsgStream &log)
Definition: MuonSegmentCnv_p2.cxx:39
MuonSegmentCnv_p2::m_segmentCnv
SegmentCnv_p1 * m_segmentCnv
Definition: MuonSegmentCnv_p2.h:39
Muon::MuonSegment_p1::m_segment
TPObjRef m_segment
Definition: MuonSegment_p1.h:24
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
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
MuonSegmentCnv_p2::m_localDirCnv
LocalDirectionCnv_p1 m_localDirCnv
Definition: MuonSegmentCnv_p2.h:40
MuonSegmentCnv_p2::persToTrans
void persToTrans(const Muon ::MuonSegment_p1 *persObj, Muon::MuonSegment *transObj, MsgStream &log)
Definition: MuonSegmentCnv_p2.cxx:14
Muon::MuonSegment::localDirection
const Trk::LocalDirection & localDirection() const
local direction
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:169
Trk::DetElementSurface
Definition: DetElementSurface.h:32
Muon::MuonSegment::setT0Error
void setT0Error(float t0, float t0Error)
set the fitted time and error on the time
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:205
Trk::Segment::AuthorUnknown
@ AuthorUnknown
Definition: TrkEvent/TrkSegment/TrkSegment/Segment.h:64
DataVector< const Trk::MeasurementBase >
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
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
ITPConverterFor< TRANS_BASE >::baseToPersistent
TPObjRef baseToPersistent(CNV **cnv, const typename CNV::Trans_t *transObj, MsgStream &log) const
Persistify bass class of a given object and store the persistent represenation in the storage vector ...
Definition: TPConverter.h:97
Muon::MuonSegment::recalculateCache
void recalculateCache()
recalculate the cache
Definition: MuonSegment.cxx:109
LocalDirectionCnv_p1::transToPers
virtual void transToPers(const Trk ::LocalDirection *transObj, Trk ::LocalDirection_p1 *persObj, MsgStream &log)
Definition: LocalDirectionCnv_p1.cxx:22
Trk::Surface::isFree
bool isFree() const
Returns 'true' if this surface is 'free', i.e.
Trk::PlaneSurface
Definition: PlaneSurface.h:64
MuonSegmentCnv_p2::m_surfCnv
ITPConverterFor< Trk::Surface > * m_surfCnv
Definition: MuonSegmentCnv_p2.h:41
PlaneSurface.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonSegment.h
Muon::MuonSegment_p1
Definition: MuonSegment_p1.h:20
LocalDirection.h
Trk::SpaceTimePointBase::time
float time() const
access to the measured time
Definition: SpaceTimePointBase.h:47
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
Muon::MuonSegment_p1::m_t0
float m_t0
Definition: MuonSegment_p1.h:28
DetElementSurface.h
LocalDirectionCnv_p1::persToTrans
virtual void persToTrans(const Trk ::LocalDirection_p1 *persObj, Trk ::LocalDirection *transObj, MsgStream &log)
Definition: LocalDirectionCnv_p1.cxx:14
Muon::MuonSegment::associatedSurface
virtual const Trk::PlaneSurface & associatedSurface() const override final
returns the surface for the local to global transformation
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:175
ITPConverterFor< TRANS_BASE >::createTransFromPStore
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Create transient representation of a persistent object, stored in the the top-level persistent object...
Definition: TPConverter.h:172