ATLAS Offline Software
JetCollectionCnv.cxx
Go to the documentation of this file.
1 
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 
23 JetCollectionCnv::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;
67  poolReadObject<JetCollection_tlp6> (m_TPConverter);
69 
70  } else if ( compareClassGuid(tlp5_guid) ) {
71  msg << MSG::DEBUG << " JetCollectionCnv: calling tlp5 converter" <<endmsg;
72  poolReadObject<JetCollection_tlp5> (m_tlp5_cnv);
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;
82  poolReadObject<JetCollection_tlp2> (m_tlp2_cnv);
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
91  return poolReadObject<JetCollection>();
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 }
JetCollectionCnv::m_p1_cnv
JetCollectionCnv_p1 m_p1_cnv
Definition: JetCollectionCnv.h:111
get_generator_info.result
result
Definition: get_generator_info.py:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
JetCollectionCnv::m_pjp1_cnv
ParticleJetContainerCnv_p1 m_pjp1_cnv
Definition: JetCollectionCnv.h:114
AthenaPoolConverter::m_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition: AthenaPoolConverter.h:117
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
JetCollectionCnv.h
JetCollectionCnv::m_tlp5_cnv
JetCollectionCnv_tlp5 m_tlp5_cnv
Definition: JetCollectionCnv.h:109
JetCollectionCnv::m_p3_cnv
JetCollectionCnv_p3 m_p3_cnv
Definition: JetCollectionCnv.h:113
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
JetCollectionCnv::createTransient
virtual JetCollection * createTransient()
Build the transient representation from a persistent one.
Definition: JetCollectionCnv.cxx:48
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
JetCollectionCnv::m_TPConverter
JetCollectionCnv_tlp6 m_TPConverter
The master translator.
Definition: JetCollectionCnv.h:101
JetCollectionCnv::JetCollectionCnv
JetCollectionCnv(ISvcLocator *svcloc)
Create the converter from the service locator.
Definition: JetCollectionCnv.cxx:23
JetCollectionCnv::m_tlp2_cnv
JetCollectionCnv_tlp2 m_tlp2_cnv
Definition: JetCollectionCnv.h:110
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
JetCollection_tlp6
Top level container that will store all the various jet objects that are getting stored.
Definition: JetCollection_tlp6.h:20
JetCollection
Container for Jets
Definition: JetCollection.h:30
DEBUG
#define DEBUG
Definition: page_access.h:11
JetCollectionCnv::initialize
StatusCode initialize(void)
Connect up the sub-converters that we use to do the actual work.
Definition: JetCollectionCnv.cxx:128
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
JetCollectionCnv::m_log
MsgStream m_log
Definition: JetCollectionCnv.h:106
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
JetCollectionCnv::createPersistent
virtual JetCollection_PERS * createPersistent(JetCollection *transCont)
Build the persistent representation from the transient one.
Definition: JetCollectionCnv.cxx:36
JetCollectionCnv::m_p2_cnv
JetCollectionCnv_p2 m_p2_cnv
Definition: JetCollectionCnv.h:112