ATLAS Offline Software
NeutralAtaSurfaceCnv_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 #include "TrkEventTPCnv/TrkParameters/mungeZeroQOverP.h"
6 
7 
8 //-----------------------------------------------------------------------------
9 //
10 // file: NeutralAtaSurfaceCnv_p1.icc
11 //
12 //-----------------------------------------------------------------------------
13 
14 template< class SURFACE_CNV, class ATA_SURFACE >
15 void
16 NeutralAtaSurfaceCnv_p1< SURFACE_CNV, ATA_SURFACE >::
17 persToTrans( const Trk::AtaSurface_p1 *persObj, ATA_SURFACE *transObj, MsgStream &log )
18 {
19  this->fillTransFromPStore( &m_paramCnv, persObj->m_parameters, transObj, log );
20 
21  // Preserve previous behavior of tp converters.
22  bool waszero = false;
23  auto parms = transObj->parameters();
24  if (parms[Trk::qOverP] == 0) {
25  parms[Trk::qOverP] = 1;
26  waszero = true;
27  }
28 
29  ITPConverterFor<Trk::Surface>* surfaceCnv=0;
30  const Trk::Surface* temp = this->createTransFromPStore( &surfaceCnv, persObj->m_assocSurface, log );
31  DetElementSurfaceCnv_p1* detElCnv = dynamic_cast<DetElementSurfaceCnv_p1*>(surfaceCnv);
32  if (detElCnv) {
33  // have a DetElementSurface
34  temp = detElCnv->createSurface(log);
35  }
36 
37  Trk::SurfaceUniquePtrT<const typename SURFACE_CNV::Trans_t> surf
38  (static_cast<const typename SURFACE_CNV::Trans_t*>(temp));
39  assert(surf);
40  *transObj = ATA_SURFACE (parms, *surf.get());
41  if (waszero)
42  TrkEventTPCnv::mungeZeroQOverP (*transObj);
43 }
44 
45 template< class SURFACE_CNV, class ATA_SURFACE >
46 void
47 NeutralAtaSurfaceCnv_p1< SURFACE_CNV, ATA_SURFACE >::
48 transToPers( const ATA_SURFACE * /**transObj*/, Trk::AtaSurface_p1 * /**persObj*/, MsgStream & /**log*/ )
49 {
50  throw std::runtime_error("NeutralAtaSurfaceCnv_p1::transToPers is deprecated!");
51 }
52