ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEventCnv
TrkEventAthenaPool
src
SegmentCollectionCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 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
13
#include "
SegmentCollectionCnv.h
"
14
#include "GaudiKernel/IToolSvc.h"
15
16
17
//-----------------------------------------------------------------------------
18
// Constructor
19
//-----------------------------------------------------------------------------
20
SegmentCollectionCnv::SegmentCollectionCnv
(ISvcLocator* svcloc):
21
SegmentCollectionCnvBase
(svcloc),
22
m_msgSvc
( msgSvc() ),
23
m_log
(
m_msgSvc
,
"SegmentCollectionCnv"
)
24
{
25
}
26
27
//-----------------------------------------------------------------------------
28
// Initializer
29
//-----------------------------------------------------------------------------
30
void
SegmentCollectionCnv::initializeOldExtConverters
()
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
}
59
m_oldExtCnvInitialized
=
true
;
60
}
61
62
63
SegmentCollection_PERS
*
64
SegmentCollectionCnv::createPersistent
(
Trk::SegmentCollection
*transCont)
65
{
66
std::string logname =
"SegmentCollectionCnv"
;
67
MsgStream log (
m_msgSvc
, std::move(logname) );
68
return
m_TPConverterForPER
.createPersistent( transCont, log );
69
}
70
71
72
//-----------------------------------------------------------------------------
73
// Create transient collection
74
//-----------------------------------------------------------------------------
75
Trk::SegmentCollection
*
SegmentCollectionCnv::createTransient
(
const
Token
* token)
76
{
77
m_log
.setLevel(
m_msgSvc
->outputLevel() );
78
static
const
Guid
tlp4_guid(
"27FB33E0-3284-11E8-9390-0800271C02BC"
);
79
static
const
Guid
tlp3_guid(
"1AA73E8A-AF6D-11E3-A8C8-6C3BE51AB9F1"
);
80
static
const
Guid
tlp2_guid(
"61A4056D-4FDF-4798-93D7-1BAC351FE32E"
);
81
static
const
Guid
tlp1_guid(
"03A83988-8E38-45E9-95A5-9CB17B98074C"
);
82
static
const
Guid
p0_guid(
"AAE2BF35-4971-4368-B0B1-BE209CC81538"
);
83
84
Trk::SegmentCollection
*p_collection =
nullptr
;
85
86
if
(
compareClassGuid
(token, tlp4_guid ) ) {
87
poolReadObject< SegmentCollection_PERS >
(
m_TPConverterForPER
, token );
88
p_collection =
m_TPConverterForPER
.createTransient(
m_log
);
89
}
else
if
(
compareClassGuid
(token, tlp3_guid ) ) {
90
initializeOldExtConverters
();
91
poolReadObject< Trk::SegmentCollection_tlp3 >
(
m_TPConverter_tlp3
, token );
92
p_collection =
m_TPConverter_tlp3
.createTransient(
m_log
);
93
}
else
if
(
compareClassGuid
(token, tlp2_guid ) ) {
94
initializeOldExtConverters
();
95
poolReadObject< Trk::SegmentCollection_tlp2 >
(
m_TPConverter_tlp2
, token );
96
p_collection =
m_TPConverter_tlp2
.createTransient(
m_log
);
97
}
else
if
(
compareClassGuid
(token, tlp1_guid ) ) {
98
initializeOldExtConverters
();
99
poolReadObject< Trk::SegmentCollection_tlp1 >
(
m_TPConverter_tlp1
, token );
100
p_collection =
m_TPConverter_tlp1
.createTransient(
m_log
);
101
}
102
else
if
(
compareClassGuid
(token, p0_guid ) ) {
103
p_collection =
poolReadObject< Trk::SegmentCollection >
(token);
104
}
105
else
106
throw
std::runtime_error(
"Unsupported persistent version of Trk::SegmentCollection (unknown GUID)"
);
107
108
return
p_collection;
109
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
SegmentCollectionCnv.h
SegmentCollection_PERS
Trk::SegmentCollection_tlp4 SegmentCollection_PERS
Definition
SegmentCollectionCnv.h:30
SegmentCollectionCnvBase
T_AthenaPoolCustomCnv< Trk::SegmentCollection, SegmentCollection_PERS > SegmentCollectionCnvBase
Definition
SegmentCollectionCnv.h:33
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
T_AthenaPoolCustomCnv< Trk::SegmentCollection, SegmentCollection_PERS >::m_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition
AthenaPoolConverter.h:108
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition
Guid.h:25
SegmentCollectionCnv::createPersistent
virtual SegmentCollection_PERS * createPersistent(Trk::SegmentCollection *transCont) override
Definition
SegmentCollectionCnv.cxx:64
SegmentCollectionCnv::m_TPConverter_tlp3
SegmentCollectionCnv_tlp3 m_TPConverter_tlp3
Definition
SegmentCollectionCnv.h:62
SegmentCollectionCnv::m_msgSvc
IMessageSvc * m_msgSvc
Definition
SegmentCollectionCnv.h:56
SegmentCollectionCnv::m_TPConverter_tlp1
SegmentCollectionCnv_tlp1 m_TPConverter_tlp1
Definition
SegmentCollectionCnv.h:60
SegmentCollectionCnv::m_TPConverter_tlp2
SegmentCollectionCnv_tlp2 m_TPConverter_tlp2
Definition
SegmentCollectionCnv.h:61
SegmentCollectionCnv::m_TPConverterForPER
SegmentCollectionCNV_PERS m_TPConverterForPER
Definition
SegmentCollectionCnv.h:63
SegmentCollectionCnv::createTransient
virtual Trk::SegmentCollection * createTransient(const Token *token) override
Definition
SegmentCollectionCnv.cxx:75
SegmentCollectionCnv::m_oldExtCnvInitialized
bool m_oldExtCnvInitialized
Definition
SegmentCollectionCnv.h:58
SegmentCollectionCnv::initializeOldExtConverters
void initializeOldExtConverters()
setup old extended converters when reading old data
Definition
SegmentCollectionCnv.cxx:30
SegmentCollectionCnv::SegmentCollectionCnv
SegmentCollectionCnv(ISvcLocator *svcloc)
Definition
SegmentCollectionCnv.cxx:20
SegmentCollectionCnv::m_log
MsgStream m_log
Definition
SegmentCollectionCnv.h:57
T_AthenaPoolCustomCnv< Trk::SegmentCollection, SegmentCollection_PERS >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
T_AthenaPoolCustomCnv< Trk::SegmentCollection, SegmentCollection_PERS >::poolReadObject
P * poolReadObject(const Token *token)
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition
Token.h:22
Trk::SegmentCollection
DataVector< Trk::Segment > SegmentCollection
Definition
SegmentCollection.h:13
Generated on
for ATLAS Offline Software by
1.17.0