ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEventCnv
TrkEventAthenaPool
src
TrackCollectionCnv.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: 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"
18
#include "
StoreGate/StoreGateSvc.h
"
19
#include "
AtlasDetDescr/AtlasDetectorID.h
"
20
21
22
//-----------------------------------------------------------------------------
23
// Constructor
24
//-----------------------------------------------------------------------------
25
TrackCollectionCnv::TrackCollectionCnv
(ISvcLocator* svcloc):
26
TrackCollectionCnvBase
(svcloc),
27
m_msgSvc
( msgSvc() ),
28
m_log
(
m_msgSvc
,
"TrackCollectionCnv"
)
29
{
30
}
31
32
//-----------------------------------------------------------------------------
33
// Initializer
34
//-----------------------------------------------------------------------------
35
StatusCode
TrackCollectionCnv::initialize
()
36
{
37
// leaving empty method for future use
38
return
TrackCollectionCnvBase::initialize
();
39
}
40
41
42
void
TrackCollectionCnv::initializeOldExtConverters
()
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
}
72
m_oldExtCnvInitialized
=
true
;
73
}
74
75
76
77
TrackCollection_PERS
*
TrackCollectionCnv::createPersistentWithKey
(
TrackCollection
*transCont,
78
const
std::string& key)
79
{
80
std::string logname =
"TrackCollectionCnv"
;
81
MsgStream log (
m_msgSvc
, std::move(logname) );
82
83
return
m_TPConverter
.createPersistentWithKey ( transCont, key, log );
84
}
85
86
//-----------------------------------------------------------------------------
87
// Create transient collection
88
//-----------------------------------------------------------------------------
89
TrackCollection
*
TrackCollectionCnv::createTransientWithKey
(
const
Token
* token,
const
std::string& key)
90
{
91
m_log
.setLevel(
m_msgSvc
->outputLevel() );
92
static
const
pool::Guid
p7_guid(
"D8806153-CA92-4A1A-9859-68E40EB4E336"
);
93
static
const
pool::Guid
p6_guid(
"3228B252-2C5D-11E8-B170-0800271C02BC"
);
94
static
const
pool::Guid
p5_guid(
"436E4996-9D6E-11E3-AD2A-6C3BE51AB9F1"
);
95
static
const
pool::Guid
p4_guid(
"3BEB819F-6ED2-48F6-9F95-E65E1759E781"
);
96
static
const
pool::Guid
p3_guid(
"A1E9FDCB-2F4A-4AC8-BF4E-2D70B9C70F8A"
);
97
static
const
pool::Guid
p2_guid(
"2D8B19DC-DB2E-4F56-BB94-D7C4544D501A"
);
98
static
const
pool::Guid
p1_guid(
"ECB12567-B999-4908-B0C6-C43CF9F9A987"
);
99
static
const
pool::Guid
p0_guid(
"70ECEBFC-BE00-46C2-8B35-4CC12D18DE39"
);
100
101
TrackCollection
*p_collection =
nullptr
;
102
if
(
compareClassGuid
(token, p7_guid )){
103
poolReadObject< TrackCollection_PERS >
(
m_TPConverter
, token );
104
p_collection =
m_TPConverter
.createTransientWithKey( key,
m_log
);
105
}
106
else
if
(
compareClassGuid
(token, p6_guid )){
107
poolReadObject< Trk::TrackCollection_tlp6 >
(
m_TPConverter_tlp6
, token );
108
p_collection =
m_TPConverter_tlp6
.createTransientWithKey( key,
m_log
);
109
}
110
else
if
(
compareClassGuid
(token, p5_guid )){
111
initializeOldExtConverters
();
112
poolReadObject< Trk::TrackCollection_tlp5 >
(
m_TPConverter_tlp5
, token);
113
p_collection =
m_TPConverter_tlp5
.createTransientWithKey( key,
m_log
);
114
}
115
else
if
(
compareClassGuid
(token, p4_guid )){
116
initializeOldExtConverters
();
117
poolReadObject< Trk::TrackCollection_tlp4 >
(
m_TPConverter_tlp4
, token);
118
p_collection =
m_TPConverter_tlp4
.createTransientWithKey( key,
m_log
);
119
}
120
else
if
(
compareClassGuid
(token, p3_guid )){
121
initializeOldExtConverters
();
122
poolReadObject< Trk::TrackCollection_tlp3 >
(
m_TPConverter_tlp3
, token);
123
p_collection =
m_TPConverter_tlp3
.createTransientWithKey( key,
m_log
);
124
}
125
else
if
(
compareClassGuid
(token, p2_guid ) ) {
126
initializeOldExtConverters
();
127
poolReadObject< Trk::TrackCollection_tlp2 >
(
m_TPConverter_tlp2
, token );
128
p_collection =
m_TPConverter_tlp2
.createTransientWithKey( key,
m_log
);
129
}
130
else
if
(
compareClassGuid
(token, p1_guid ) ) {
131
initializeOldExtConverters
();
132
poolReadObject< Trk::TrackCollection_tlp1 >
(
m_TPConverter_tlp1
, token );
133
p_collection =
m_TPConverter_tlp1
.createTransientWithKey( key,
m_log
);
134
}
135
else
if
(
compareClassGuid
(token, p0_guid ) ) {
136
p_collection =
poolReadObject< TrackCollection >
(token);
137
}
138
else
139
throw
std::runtime_error(
"Unsupported persistent version of Data Collection"
);
140
return
p_collection;
141
}
142
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreGateSvc.h
TrackCollectionCnv.h
TrackCollectionCnvBase
T_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_PERS > TrackCollectionCnvBase
Definition
TrackCollectionCnv.h:39
TrackCollection_PERS
Trk::TrackCollection_tlp7 TrackCollection_PERS
Definition
TrackCollectionCnv.h:37
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition
TrackCollection.h:19
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_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_PERS >::m_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition
AthenaPoolConverter.h:108
T_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_PERS >::compareClassGuid
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
T_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_PERS >::initialize
virtual StatusCode initialize()
T_AthenaPoolCustomCnvWithKey< TrackCollection, TrackCollection_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
TrackCollectionCnv::m_TPConverter_tlp3
TrackCollectionCnv_tlp3 m_TPConverter_tlp3
Definition
TrackCollectionCnv.h:73
TrackCollectionCnv::initializeOldExtConverters
void initializeOldExtConverters()
setup old extended converters when reading old data
Definition
TrackCollectionCnv.cxx:42
TrackCollectionCnv::m_TPConverter_tlp2
TrackCollectionCnv_tlp2 m_TPConverter_tlp2
Definition
TrackCollectionCnv.h:72
TrackCollectionCnv::createTransientWithKey
virtual TrackCollection * createTransientWithKey(const Token *token, const std::string &key) override
method to be implemented by the developer.
Definition
TrackCollectionCnv.cxx:89
TrackCollectionCnv::m_TPConverter
TrackCollectionCnv_tlp7 m_TPConverter
Definition
TrackCollectionCnv.h:77
TrackCollectionCnv::TrackCollectionCnv
TrackCollectionCnv(ISvcLocator *svcloc)
Definition
TrackCollectionCnv.cxx:25
TrackCollectionCnv::m_TPConverter_tlp4
TrackCollectionCnv_tlp4 m_TPConverter_tlp4
Definition
TrackCollectionCnv.h:74
TrackCollectionCnv::createPersistentWithKey
virtual TrackCollection_PERS * createPersistentWithKey(TrackCollection *transCont, const std::string &key) override
method to be implemented by the developer.
Definition
TrackCollectionCnv.cxx:77
TrackCollectionCnv::m_TPConverter_tlp1
TrackCollectionCnv_tlp1 m_TPConverter_tlp1
Definition
TrackCollectionCnv.h:71
TrackCollectionCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition
TrackCollectionCnv.cxx:35
TrackCollectionCnv::m_TPConverter_tlp6
TrackCollectionCnv_tlp6 m_TPConverter_tlp6
Definition
TrackCollectionCnv.h:76
TrackCollectionCnv::m_log
MsgStream m_log
Definition
TrackCollectionCnv.h:68
TrackCollectionCnv::m_oldExtCnvInitialized
bool m_oldExtCnvInitialized
Definition
TrackCollectionCnv.h:69
TrackCollectionCnv::m_TPConverter_tlp5
TrackCollectionCnv_tlp5 m_TPConverter_tlp5
Definition
TrackCollectionCnv.h:75
TrackCollectionCnv::m_msgSvc
IMessageSvc * m_msgSvc
Definition
TrackCollectionCnv.h:67
pool::Guid
::Guid Guid
Definition
T_AthenaPoolCustCnv.h:19
Generated on
for ATLAS Offline Software by
1.17.0