ATLAS Offline Software
AtaSurfaceCnv_p1.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------------
6 //
7 // file: AtaSurfaceCnv_p1.icc
8 //
9 //-----------------------------------------------------------------------------
10 
11 #include "TrkEventCnvTools/DetElementSurface.h"
12 #include "TrkEventTPCnv/TrkDetElementSurface/DetElementSurfaceCnv_p1.h"
13 #include "TrkSurfaces/StraightLineSurface.h"
14 #include "TrkSurfaces/Surface.h"
15 #include <typeinfo>
16 //#define debug true
17 #include "TrkEventTPCnv/TrkParameters/mungeZeroQOverP.h"
18 
19 template< class SURFACE_CNV, class ATA_SURFACE >
20 void
21 AtaSurfaceCnv_p1< SURFACE_CNV, ATA_SURFACE >::
22 persToTrans( const Trk::AtaSurface_p1 *persObj, ATA_SURFACE *transObj, MsgStream &log )
23 {
24  this->fillTransFromPStore( &m_paramCnv, persObj->m_parameters, transObj, log );
25 
26  // Preserve previous behavior of tp converters.
27  bool waszero = false;
28  auto parms = transObj->parameters();
29  if (parms[Trk::qOverP] == 0) {
30  parms[Trk::qOverP] = 1;
31  waszero = true;
32  }
33 
34  ITPConverterFor<Trk::Surface>* surfaceCnv=0;
35  const Trk::Surface* temp = this->createTransFromPStore( &surfaceCnv, persObj->m_assocSurface, log );
36  DetElementSurfaceCnv_p1* detElCnv = dynamic_cast<DetElementSurfaceCnv_p1*>(surfaceCnv);
37  if (detElCnv) {
38  // have a DetElementSurface
39  temp = detElCnv->createSurface(log);
40  }
41 
42  Trk::SurfaceUniquePtrT<const typename SURFACE_CNV::Trans_t> surf
43  (static_cast<const typename SURFACE_CNV::Trans_t*>(temp));
44  if (surf)
45  *transObj = ATA_SURFACE (parms, *surf.get());
46  else
47  *transObj = ATA_SURFACE (parms, nullptr);
48  if (waszero)
49  TrkEventTPCnv::mungeZeroQOverP (*transObj);
50 }
51 
52 template< >
53 void
54 AtaSurfaceCnv_p1< PlaneSurfaceCnv_p1, Trk::CurvilinearParameters >::
55 persToTrans( const Trk::AtaSurface_p1 * /**persObj*/, Trk::CurvilinearParameters * /**transObj*/, MsgStream & /**log*/ )
56 {
57  throw std::runtime_error("CurvilinearParametersCnv_p1::transToPers is deprecated!");
58 }
59 
60 template< class SURFACE_CNV, class ATA_SURFACE >
61 void
62 AtaSurfaceCnv_p1< SURFACE_CNV, ATA_SURFACE >::
63 transToPers( const ATA_SURFACE * /**transObj*/, Trk::AtaSurface_p1 * /**persObj*/, MsgStream & /**log*/ )
64 {
65  throw std::runtime_error("AtaSurfaceCnv_p1::transToPers is deprecated!");
66 }
67