ATLAS Offline Software
VxContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------------
6 //
7 // file: VxContainerCnv.cxx
8 // author: Kirill Prokofiev <Kirill.Prokofiev@cern.ch>
9 //
10 //-----------------------------------------------------------------------------
11 
12 
13 #include "VxContainerCnv.h"
14 
17 
18 //-----------------------------------------------------------------------------
19 // Constructor
20 //-----------------------------------------------------------------------------
21 
22 VxContainerCnv::VxContainerCnv( ISvcLocator *svcloc ):
23  VxContainerCnvBase(svcloc),
24  m_msgSvc( msgSvc() ),
25  m_log( m_msgSvc, "VxContainerCnv" )
26  {}
27 
28 //-----------------------------------------------------------------------------
29 // Initializer
30 //-----------------------------------------------------------------------------
32 {
34  if( sc.isFailure() )
35  {
36  m_log << MSG::FATAL << "Could not initialize VxContainerCnvBase" << endmsg;
37  return sc;
38  }
39 
40  m_log.setLevel( m_msgSvc->outputLevel() );
41  m_log << MSG::INFO << "VxContainerCnv::initialize()" << endmsg;
42 
43  IConverter *converter = m_athenaPoolCnvSvc->converter( CLID(1943140) );
44  m_log << MSG::INFO << "VxContainerCnv: MVFVxCandidate converter=" << converter << endmsg;
45  registerExtendingCnv( converter );
46 
47  return StatusCode::SUCCESS;
48 
49 }//end of initialize method
50 
51 
54 {
55  MsgStream msg( msgSvc(), "VxContainerCnv" );
56  msg << MSG::ERROR << "createPersistent() is obsolete" << endmsg;
57  return nullptr;
58 }//end of create persistent method
59 
60 
62 {
63  static const pool::Guid p2_guid( "B5254571-6B6D-47F7-A52C-CBE857CF1812" );
64  static const pool::Guid p1_guid( "AFA5FE76-EEC6-4BD1-B704-B5747F729291" );
65  static const pool::Guid p0_guid( "639B478A-7355-4430-B6FC-F0A6148A2E87" );
66 
67  VxContainer *p_collection = nullptr;
68  if( compareClassGuid( p2_guid ) ) {
69  // std::cout << "VxContainerCnv::createTransient: do new TP 2" << std::endl;
71  std::unique_ptr< VxContainer_PERS > p_coll( poolReadObject< VxContainer_PERS >() );
72 
73  /*
74  std::cout<<"READING: Dumping the contents of the VxContainer "<<std::endl;
75  std::cout<<"------------------------------VxVertex related "<<std::endl;
76  std::cout<<" m_vxContainers size: "<< p_coll->m_vxContainers.size()<<std::endl;
77  std::cout<<" m_vxCandidates size: "<< p_coll->m_vxCandidates.size() <<std::endl;
78  std::cout<<" m_vxTrackAtVertices size: "<< p_coll->m_vxTrackAtVertices.size()<<std::endl;
79  std::cout<<" m_recVertices size: "<< p_coll->m_recVertices.size()<<std::endl;
80  std::cout<<" m_vertices size: "<< p_coll->m_vertices.size()<<std::endl;
81 
82  std::cout<<"------------------------------TrkTrack related "<<std::endl;
83  std::cout<<" m_tracks size: "<< p_coll->m_tracks.size()<<std::endl;
84  std::cout<<"------------------------------TrkTrackParameters related "<<std::endl;
85  std::cout<<" m_trackParameters size: "<< p_coll->m_trackParameters.size()<<std::endl;
86  std::cout<<" m_perigees size: "<< p_coll->m_perigees.size()<<std::endl;
87  std::cout<<" m_measPerigees size: "<< p_coll->m_measPerigees.size()<<std::endl;
88  std::cout<<" m_surfaces size: "<< p_coll->m_surfaces.size()<<std::endl;
89  std::cout<<" m_fitQualities size: "<< p_coll->m_fitQualities.size()<<std::endl;
90  std::cout<<" m_hepSymMatrices size: "<< p_coll->m_hepSymMatrices.size()<<std::endl;
91  std::cout<<"*************************************** "<<std::endl;
92  */
93  p_collection = m_TPConverter.createTransient( p_coll.get(), m_log );
94 
95  }
96  else if( compareClassGuid( p1_guid ) ) {
97  // std::cout << "VxContainerCnv::createTransient: do TP 1" << std::endl;
98 
99  // usingTPCnvForReading( m_TPConverter );
100  // std::unique_ptr< VxContainer_PERS > p_coll( poolReadObject< VxContainer_PERS >() );
101  // p_collection = m_TPConverter.createTransient( p_coll.get(), m_log );
102 
103  VxContainerCnv_tlp1 tmpTPCnv;
104  usingTPCnvForReading( tmpTPCnv );
105  std::unique_ptr< Trk::VxContainer_tlp1 > p_coll( poolReadObject< Trk::VxContainer_tlp1 >() );
106  p_collection = tmpTPCnv.createTransient( p_coll.get(), m_log );
107 
108  // std::cout << "VxContainerCnv::createTransient: done! " << std::endl;
109 /*
110  std::cout<<"READING: Dumping the contents of the VxContainer "<<std::endl;
111  std::cout<<"------------------------------VxVertex related "<<std::endl;
112  std::cout<<" m_vxContainers size: "<< p_coll->m_vxContainers.size()<<std::endl;
113  std::cout<<" m_vxCandidates size: "<< p_coll->m_vxCandidates.size() <<std::endl;
114  std::cout<<" m_vxTrackAtVertices size: "<< p_coll->m_vxTrackAtVertices.size()<<std::endl;
115  std::cout<<" m_recVertices size: "<< p_coll->m_recVertices.size()<<std::endl;
116  std::cout<<" m_vertices size: "<< p_coll->m_vertices.size()<<std::endl;
117 
118  std::cout<<"------------------------------TrkTrack related "<<std::endl;
119  std::cout<<" m_tracks size: "<< p_coll->m_tracks.size()<<std::endl;
120  std::cout<<"------------------------------TrkTrackParameters related "<<std::endl;
121  std::cout<<" m_trackParameters size: "<< p_coll->m_trackParameters.size()<<std::endl;
122  std::cout<<" m_perigees size: "<< p_coll->m_perigees.size()<<std::endl;
123  std::cout<<" m_measPerigees size: "<< p_coll->m_measPerigees.size()<<std::endl;
124  std::cout<<" m_surfaces size: "<< p_coll->m_surfaces.size()<<std::endl;
125  std::cout<<" m_fitQualities size: "<< p_coll->m_fitQualities.size()<<std::endl;
126  std::cout<<" m_hepSymMatrices size: "<< p_coll->m_hepSymMatrices.size()<<std::endl;
127  std::cout<<"*************************************** "<<std::endl;
128 */
129 
130  }else if( compareClassGuid( p0_guid ) ){
131 // std::cout << "VxContainerCnv::createTransient: use old converter" << std::endl;
132  p_collection = poolReadObject< VxContainer >();
133 
134  }else throw std::runtime_error( "Unsupported persistent version of VxContainer" );
135 
136  return p_collection;
137 
138 }//end of create transient method
139 
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
AthenaPoolConverter::m_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition: AthenaPoolConverter.h:111
AthenaPoolCnvTPExtension::usingTPCnvForReading
void usingTPCnvForReading(TopLevelTPCnvBase &baseTLPcnv)
Definition: AthenaPoolCnvTPExtension.h:31
VxContainerCnv_tlp2.h
VxContainerCnv::m_log
MsgStream m_log
Definition: VxContainerCnv.h:53
VxContainerCnv_tlp1
Definition: VxContainerCnv_tlp1.h:61
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
VxContainerCnv_tlp1.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::VxContainer_tlp2
Definition: VxContainer_tlp2.h:55
VxContainer
Definition: VxContainer.h:28
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
VxContainerCnv::createPersistent
virtual VxContainer_PERS * createPersistent(VxContainer *transCont) override
Definition: VxContainerCnv.cxx:53
AthenaPoolCnvTPExtension::registerExtendingCnv
virtual bool registerExtendingCnv(AthenaConverterTLPExtension *cnv)
Register extending converter (that is, another converter that will extent this converter) and all his...
Definition: AthenaPoolCnvTPExtension.h:19
VxContainerCnv::VxContainerCnv
VxContainerCnv(ISvcLocator *svcloc)
Definition: VxContainerCnv.cxx:22
VxContainerCnv::m_msgSvc
IMessageSvc * m_msgSvc
Definition: VxContainerCnv.h:52
VxContainerCnv::createTransient
virtual VxContainer * createTransient() override
Definition: VxContainerCnv.cxx:61
VxContainerCnv.h
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
VxContainerCnv::m_TPConverter
VxContainerCnv_tlp2 m_TPConverter
Definition: VxContainerCnv.h:56
VxContainerCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: VxContainerCnv.cxx:31