ATLAS Offline Software
Loading...
Searching...
No Matches
JetCollectionCnv.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// JetCollectionCnv.cxx
8// Implementation file for class JetCollectionCnv
9// Author: S.Binet<binet@cern.ch>
11
12// RecAthenaPool includes
13#include "JetCollectionCnv.h"
14
15// STL includes
16
17// Framework includes
18#include "GaudiKernel/MsgStream.h"
19
20
21
23JetCollectionCnv::JetCollectionCnv(ISvcLocator *svcLocator)
24 : JetCollectionCnvBase (svcLocator),
25 m_msgSvc(msgSvc()),
26 m_log(m_msgSvc, "JetCollectionCnv")
27{
28}
29
37{
38 MsgStream msg( msgSvc(), "JetCollectionCnv" );
39 msg << MSG::ERROR << "createPersistent() is obsolete" << endmsg;
40 return nullptr;
41}
42
49{
50 MsgStream msg( msgSvc(), "JetCollectionCnv" );
51
52 JetCollection *transObj = nullptr;
53
54 msg << MSG::DEBUG << " JetCollectionCnv::createTransient() "<< endmsg;
55
56 static const pool::Guid tr_guid("2FB4D25D-E217-4B8A-B865-180DE73B20E0");
57 static const pool::Guid pj_guid("E97C0C61-0B3E-401C-B853-A3302168283E");
58 static const pool::Guid p1_guid("9B8CE942-1457-4392-A98A-A1A464990B9A");
59 static const pool::Guid p2_guid("0260D9A5-9C75-45FF-AC97-EA220FB11380");
60 static const pool::Guid p3_guid("8CC411B4-8369-4C61-9B15-8A806DBFBBD1");
61 static const pool::Guid tlp2_guid("668B769E-E190-4904-BE2C-1677279A9803");
62 static const pool::Guid tlp5_guid("BEDCAE36-5EFD-4035-A402-2DC4F7A6BF75");
63 static const pool::Guid tlp6_guid("77DFEE77-16A5-45DD-91FB-FDEEF2B65F7D");
64
65 if ( compareClassGuid(tlp6_guid) ) {
66 msg << MSG::DEBUG << " JetCollectionCnv: calling tlp6 converter" <<endmsg;
68 return m_TPConverter.createTransient(m_log);
69
70 } else if ( compareClassGuid(tlp5_guid) ) {
71 msg << MSG::DEBUG << " JetCollectionCnv: calling tlp5 converter" <<endmsg;
73 return transObj = m_tlp5_cnv.createTransient(m_log);
74
75 } else if ( compareClassGuid(tlp2_guid) ) {
76
77 // The T/P seperated object. JetCollection_PERS is not used here
78 // as we want to read out specifically JetColleciton_tlp2, not just
79 // the lastest guy.
80
81 msg << MSG::DEBUG << " JetCollectionCnv: calling tlp2 converter" <<endmsg;
83 return m_tlp2_cnv.createTransient(m_log);
84
85// poolReadObject<JetCollection_tlp2> (m_TPConverter);
86// return transObj = m_TPConverter.createTransient(m_log);
87
88 } else if ( compareClassGuid(tr_guid) ) {
89
90 // regular object from before the T/P separation
92
93 } else if ( compareClassGuid(p1_guid) ) {
94
95 // using unique_ptr ensures deletion of the persistent object
96 std::unique_ptr<JetCollection_p1> persObj( poolReadObject<JetCollection_p1>() );
97 transObj = m_p1_cnv.createTransient( persObj.get(), msg );
98
99 } else if ( compareClassGuid(p2_guid) ) {
100
101 // using unique_ptr ensures deletion of the persistent object
102 std::unique_ptr<JetCollection_p2> persObj( poolReadObject<JetCollection_p2>() );
103 transObj = m_p2_cnv.createTransient( persObj.get(), msg );
104
105 } else if ( compareClassGuid(p3_guid) ) {
106
107 // using unique_ptr ensures deletion of the persistent object
108 std::unique_ptr<JetCollection_p3> persObj( poolReadObject<JetCollection_p3>() );
109 transObj = m_p3_cnv.createTransient( persObj.get(), msg );
110
111 } else if ( compareClassGuid(pj_guid) ) {
112 msg << MSG::DEBUG << " creating pj_guid "<< endmsg;
113 // using unique_ptr ensures deletion of the persistent object
114 std::unique_ptr<ParticleJetContainer_p1> persObj( poolReadObject<ParticleJetContainer_p1>() );
115 transObj = m_pjp1_cnv.createTransient( persObj.get(), msg );
116 } else {
117 throw std::runtime_error("Unsupported persistent version of JetCollection");
118 }
119
120 return transObj;
121}
122
129{
131 if (!result) {
132 return result;
133 }
134
140
141 IConverter *converter = m_athenaPoolCnvSvc->converter(CLID(50623115));
142 if (converter != nullptr) {
143 registerExtendingCnv (converter);
144 } else {
145 m_log << MSG::FATAL << "Could not load the jet tag info converters for readback!" << endmsg;
146 return StatusCode::FAILURE;
147 }
148
149 return StatusCode::SUCCESS;
150}
#define endmsg
uint32_t CLID
The Class ID type.
JetCollection_tlp6 JetCollection_PERS
T_AthenaPoolCustomCnv< JetCollection, JetCollection_PERS > JetCollectionCnvBase
virtual bool registerExtendingCnv(AthenaConverterTLPExtension *cnv)
Register extending converter (that is, another converter that will extent this converter) and all his...
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
JetCollectionCnv_p3 m_p3_cnv
JetCollectionCnv_p1 m_p1_cnv
JetCollectionCnv_tlp5 m_tlp5_cnv
JetCollectionCnv(ISvcLocator *svcloc)
Create the converter from the service locator.
JetCollectionCnv_tlp2 m_tlp2_cnv
IMessageSvc * m_msgSvc
Log file output for the translators.
JetCollectionCnv_p2 m_p2_cnv
virtual JetCollection * createTransient()
Build the transient representation from a persistent one.
ParticleJetContainerCnv_p1 m_pjp1_cnv
JetCollectionCnv_tlp6 m_TPConverter
The master translator.
StatusCode initialize(void)
Connect up the sub-converters that we use to do the actual work.
virtual JetCollection_PERS * createPersistent(JetCollection *transCont)
Build the persistent representation from the transient one.
virtual bool compareClassGuid(const Guid &clid) const