ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCollectionCnv.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: TrackCollectionCnv.cxx
8// author: Lukasz Janyst <ljanyst@cern.ch>
9//
10// Ed's converter rewritten and T/P split stuff added
11//
12// TODO: MultiComponentTSoS, integrity checking
13//
14//-----------------------------------------------------------------------------
15#include "TrackCollectionCnv.h"
16
17#include "GaudiKernel/IToolSvc.h"
20
21
22//-----------------------------------------------------------------------------
23// Constructor
24//-----------------------------------------------------------------------------
27 m_msgSvc( msgSvc() ),
28 m_log( m_msgSvc, "TrackCollectionCnv" )
29{
30}
31
32//-----------------------------------------------------------------------------
33// Initializer
34//-----------------------------------------------------------------------------
36{
37 // leaving empty method for future use
39}
40
41
43{
44 if( m_oldExtCnvInitialized ) return;
45
46 // m_log.setLevel( m_msgSvc->outputLevel() );
47 m_log << MSG::INFO << "TrackCollectionCnv::initializeOldExtConverters()" << endmsg;
48
49 bool doInDet(true);
50 bool doMuon(true);
51 bool doCalo(true);
52
53 IConverter *converter = m_athenaPoolCnvSvc->converter( CLID(17001567) );
54 if(converter != nullptr) registerExtendingCnv( converter );
55 else doInDet=false;
56
57 converter = m_athenaPoolCnvSvc->converter( CLID(239128586) );
58 if(converter !=nullptr ) registerExtendingCnv( converter );
59 else doMuon=false;
60
61 converter = m_athenaPoolCnvSvc->converter( CLID(1213853277) );
62 if(converter !=nullptr ) registerExtendingCnv( converter );
63 else doCalo=false;
64
65 //-------------------------------------------------------------------------
66 // We cannot proceed if none of the tools is present
67 //-------------------------------------------------------------------------
68 if( !doInDet && !doMuon && !doCalo) {
69 m_log << MSG::WARNING << "Could not get any of the extending convertors, and so might have problems later on.";
70 m_log << endmsg;
71 }
73}
74
75
76
78 const std::string& key)
79{
80 std::string logname = "TrackCollectionCnv";
81 if (const DataObject* dObj = getDataObject()) {
82 logname += dObj->name();
83 }
84
85 MsgStream log (m_msgSvc, logname );
86
87 return m_TPConverter.createPersistentWithKey ( transCont, key, log );
88}
89
90//-----------------------------------------------------------------------------
91// Create transient collection
92//-----------------------------------------------------------------------------
94{
95 m_log.setLevel( m_msgSvc->outputLevel() );
96 static const pool::Guid p7_guid( "D8806153-CA92-4A1A-9859-68E40EB4E336" );
97 static const pool::Guid p6_guid( "3228B252-2C5D-11E8-B170-0800271C02BC" );
98 static const pool::Guid p5_guid( "436E4996-9D6E-11E3-AD2A-6C3BE51AB9F1" );
99 static const pool::Guid p4_guid( "3BEB819F-6ED2-48F6-9F95-E65E1759E781" );
100 static const pool::Guid p3_guid( "A1E9FDCB-2F4A-4AC8-BF4E-2D70B9C70F8A" );
101 static const pool::Guid p2_guid( "2D8B19DC-DB2E-4F56-BB94-D7C4544D501A" );
102 static const pool::Guid p1_guid( "ECB12567-B999-4908-B0C6-C43CF9F9A987" );
103 static const pool::Guid p0_guid( "70ECEBFC-BE00-46C2-8B35-4CC12D18DE39" );
104
105 TrackCollection *p_collection = nullptr;
106 if( compareClassGuid( p7_guid )){
108 p_collection = m_TPConverter.createTransientWithKey( key, m_log );
109 }
110 else if( compareClassGuid( p6_guid )){
112 p_collection = m_TPConverter_tlp6.createTransientWithKey( key, m_log );
113 }
114 else if( compareClassGuid( p5_guid )){
117 p_collection = m_TPConverter_tlp5.createTransientWithKey( key, m_log );
118 }
119 else if( compareClassGuid( p4_guid )){
122 p_collection = m_TPConverter_tlp4.createTransientWithKey( key, m_log );
123 }
124 else if( compareClassGuid( p3_guid )){
127 p_collection = m_TPConverter_tlp3.createTransientWithKey( key, m_log );
128 }
129 else if( compareClassGuid( p2_guid ) ) {
132 p_collection = m_TPConverter_tlp2.createTransientWithKey( key, m_log );
133 }
134 else if( compareClassGuid( p1_guid ) ) {
137 p_collection = m_TPConverter_tlp1.createTransientWithKey( key, m_log );
138 }
139 else if( compareClassGuid( p0_guid ) ) {
140 p_collection = poolReadObject< TrackCollection >();
141 }
142 else
143 throw std::runtime_error( "Unsupported persistent version of Data Collection" );
144 return p_collection;
145}
146
#define endmsg
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
uint32_t CLID
The Class ID type.
T_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_PERS > TrackCollectionCnvBase
Trk::TrackCollection_tlp7 TrackCollection_PERS
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
virtual bool registerExtendingCnv(AthenaConverterTLPExtension *cnv)
Register extending converter (that is, another converter that will extent this converter) and all his...
TrackCollectionCnv_tlp3 m_TPConverter_tlp3
void initializeOldExtConverters()
setup old extended converters when reading old data
TrackCollectionCnv_tlp2 m_TPConverter_tlp2
virtual TrackCollection * createTransientWithKey(const std::string &key) override
method to be implemented by the developer.
TrackCollectionCnv_tlp7 m_TPConverter
TrackCollectionCnv(ISvcLocator *svcloc)
TrackCollectionCnv_tlp4 m_TPConverter_tlp4
virtual TrackCollection_PERS * createPersistentWithKey(TrackCollection *transCont, const std::string &key) override
method to be implemented by the developer.
TrackCollectionCnv_tlp1 m_TPConverter_tlp1
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
TrackCollectionCnv_tlp6 m_TPConverter_tlp6
TrackCollectionCnv_tlp5 m_TPConverter_tlp5