ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentCollectionCnv.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: SegmentCollectionCnv.cxx
8// author: Andreas Wildauer
9// author: Edward Moyse
10//
11//-----------------------------------------------------------------------------
12
14#include "GaudiKernel/IToolSvc.h"
15
16
17//-----------------------------------------------------------------------------
18// Constructor
19//-----------------------------------------------------------------------------
22 m_msgSvc( msgSvc() ),
23 m_log( m_msgSvc, "SegmentCollectionCnv" )
24{
25}
26
27//-----------------------------------------------------------------------------
28// Initializer
29//-----------------------------------------------------------------------------
31{
32 if( m_oldExtCnvInitialized ) return;
33
34 //-------------------------------------------------------------------------
35 // Set up the message stream
36 //-------------------------------------------------------------------------
37 m_log.setLevel( m_msgSvc->outputLevel() );
38 m_log << MSG::INFO << "SegmentCollectionCnv::initialize()" << endmsg;
39
40 bool doInDet(true);
41 bool doMuon(true);
42
43 IConverter *converter = m_athenaPoolCnvSvc->converter( CLID(17001567) );
44 m_log << MSG::DEBUG << "SegmentCollectionCnv: InDetTrack converter=" << converter << endmsg;
45 if(converter != nullptr) registerExtendingCnv( converter );
46 else doInDet=false;
47
48 converter = m_athenaPoolCnvSvc->converter( CLID(239128586) );
49 m_log << MSG::DEBUG << "SegmentCollectionCnv: MuonMeasurements converter=" << converter << endmsg;
50 if(converter !=nullptr ) registerExtendingCnv( converter );
51 else doMuon=false;
52
53 //-------------------------------------------------------------------------
54 // We cannot proceed if none of the tools is present
55 //-------------------------------------------------------------------------
56 if( !doInDet && !doMuon ) {
57 m_log << MSG::FATAL << "Failed to load Extending T/P converters!" << endmsg;
58 }
60}
61
62
65{
66 std::string logname = "SegmentCollectionCnv";
67 if (const DataObject* dObj = getDataObject()) {
68 logname += dObj->name();
69 }
70
71 MsgStream log (m_msgSvc, logname );
72 return m_TPConverterForPER.createPersistent( transCont, log );
73}
74
75
76//-----------------------------------------------------------------------------
77// Create transient collection
78//-----------------------------------------------------------------------------
80{
81 m_log.setLevel( m_msgSvc->outputLevel() );
82 static const pool::Guid tlp4_guid( "27FB33E0-3284-11E8-9390-0800271C02BC" );
83 static const pool::Guid tlp3_guid( "1AA73E8A-AF6D-11E3-A8C8-6C3BE51AB9F1" );
84 static const pool::Guid tlp2_guid( "61A4056D-4FDF-4798-93D7-1BAC351FE32E" );
85 static const pool::Guid tlp1_guid( "03A83988-8E38-45E9-95A5-9CB17B98074C" );
86 static const pool::Guid p0_guid( "AAE2BF35-4971-4368-B0B1-BE209CC81538" );
87
88 Trk::SegmentCollection *p_collection = nullptr;
89
90 if( compareClassGuid( tlp4_guid ) ) {
92 p_collection = m_TPConverterForPER.createTransient( m_log );
93 } else if( compareClassGuid( tlp3_guid ) ) {
96 p_collection = m_TPConverter_tlp3.createTransient( m_log );
97 } else if( compareClassGuid( tlp2_guid ) ) {
100 p_collection = m_TPConverter_tlp2.createTransient( m_log );
101 } else if( compareClassGuid( tlp1_guid ) ) {
104 p_collection = m_TPConverter_tlp1.createTransient( m_log );
105 }
106 else if( compareClassGuid( p0_guid ) ) {
108 }
109 else
110 throw std::runtime_error( "Unsupported persistent version of Trk::SegmentCollection (unknown GUID)" );
111
112 return p_collection;
113}
#define endmsg
uint32_t CLID
The Class ID type.
Trk::SegmentCollection_tlp4 SegmentCollection_PERS
T_AthenaPoolCustomCnv< Trk::SegmentCollection, SegmentCollection_PERS > SegmentCollectionCnvBase
virtual bool registerExtendingCnv(AthenaConverterTLPExtension *cnv)
Register extending converter (that is, another converter that will extent this converter) and all his...
virtual SegmentCollection_PERS * createPersistent(Trk::SegmentCollection *transCont) override
SegmentCollectionCnv_tlp3 m_TPConverter_tlp3
SegmentCollectionCnv_tlp1 m_TPConverter_tlp1
SegmentCollectionCnv_tlp2 m_TPConverter_tlp2
SegmentCollectionCNV_PERS m_TPConverterForPER
void initializeOldExtConverters()
setup old extended converters when reading old data
SegmentCollectionCnv(ISvcLocator *svcloc)
virtual Trk::SegmentCollection * createTransient() override
DataVector< Trk::Segment > SegmentCollection