ATLAS Offline Software
BoundSurfaceCnv_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 //-----------------------------------------------------------------------------
6 //
7 // file: BoundSurfaceCnv_p2.cxx
8 //
9 // ----------------------------------------------------------------------------
10 
16 #include "TrkSurfaces/NoBounds.h"
18 #include <typeinfo>
19 
20 template< class SURFACE, class BOUNDS_CNV >
21 void
23 persToTrans( const Trk::BoundSurface_p2* , SURFACE* , MsgStream & )
24 {
25  throw std::runtime_error("BoundSurfaceCnv_p2::persToTrans shouldn't be called any more!");
26 }
27 
28 template< class SURFACE, class BOUNDS_CNV >
29 SURFACE*
31 {
32  SURFACE* transObj = m_surfaceCnv.createTransient( persObj, log );
33  typename BOUNDS_CNV::Trans_t* bounds = this->createTransFromPStore( &m_boundsCnv, persObj->m_bounds, log );
34  transObj->m_bounds = Trk::SharedObject<typename BOUNDS_CNV::Trans_t>(bounds);
35  return transObj;
36 }
37 
38 
39 template< class SURFACE, class BOUNDS_CNV >
40 void
42 transToPers( const SURFACE *transObj, Trk::BoundSurface_p2 *persObj, MsgStream &log )
43 {
44  m_surfaceCnv.transToPers( transObj, persObj, log );
45  if ((transObj->m_bounds).get() && !dynamic_cast<const Trk::NoBounds*>((transObj->m_bounds).get()))
46  persObj->m_bounds = this->toPersistent( &m_boundsCnv, (transObj->m_bounds).get(), log );
47 }
48 
49 // specialized for polymorphic surfaces
51 
52 template< class SURFACE >
53 void
55 persToTrans( const Trk::BoundSurface_p2 * , SURFACE * , MsgStream & )
56 {
57  throw std::runtime_error("BoundSurfaceCnv_p2::persToTrans shouldn't be called any more!");
58  // This is because in the SurfaceCnv we might need to return an already existing surface (belong to a DetElement)
59 }
60 
61 template < class SURFACE >
62 SURFACE*
64 {
65  SURFACE* transObj = m_surfaceCnv.createTransient( persObj, log );
66 
67  Trk::SurfaceBounds* bounds = this->createTransFromPStore( (TPCnvForSurfBnds**)nullptr, persObj->m_bounds, log );
68  transObj->m_bounds = Trk::SharedObject<const Trk::SurfaceBounds>(bounds);
69  return transObj;
70 }
71 
72 
73 template< class SURFACE >
74 void
76 transToPers( const SURFACE *transObj, Trk::BoundSurface_p2 *persObj, MsgStream &log )
77 {
78  m_surfaceCnv.transToPers( transObj, persObj, log );
79  if ((transObj->m_bounds).get() && !dynamic_cast<const Trk::NoBounds*>((transObj->m_bounds).get()))
80  persObj->m_bounds = this->toPersistent( (TPCnvForSurfBnds**)nullptr, (transObj->m_bounds).get(), log );
81 }
82 
83 
ITPConverterFor< Trk::SurfaceBounds >
StraightLineSurface.h
BoundSurfaceCnv_p2::persToTrans
void persToTrans(const Trk::BoundSurface_p2 *, SURFACE *, MsgStream &)
Definition: BoundSurfaceCnv_p2.cxx:23
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
BoundSurfaceCnv_p2< Trk::DiscSurface, DiscBoundsCnv_p1 >
BoundSurfaceCnv_p2::transToPers
void transToPers(const SURFACE *, Trk::BoundSurface_p2 *, MsgStream &)
Definition: BoundSurfaceCnv_p2.cxx:42
Trk::BoundSurface_p2
Definition: BoundSurface_p2.h:19
Trk::BoundSurface_p2::m_bounds
TPObjRef m_bounds
Definition: BoundSurface_p2.h:23
CylinderSurface.h
BoundSurfaceCnv_p2::createTransient
SURFACE * createTransient(const Trk::BoundSurface_p2 *persObj, MsgStream &log)
Definition: BoundSurfaceCnv_p2.cxx:30
SharedObject.h
BoundSurfaceCnv_p2.h
Trk::NoBounds
Definition: NoBounds.h:30
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
PlaneSurface.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DiscSurface.h
NoBounds.h