ATLAS Offline Software
MVFVxContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------------
6 //
7 // file: MVFVxContainerCnv.cxx
8 // author: Kirill Prokofiev <Kirill.Prokofiev@cern.ch>
9 //
10 //-----------------------------------------------------------------------------
11 
12 
13 #include "MVFVxContainerCnv.h"
14 
15 
16 //-----------------------------------------------------------------------------
17 // Constructor
18 //-----------------------------------------------------------------------------
19 
20 MVFVxContainerCnv::MVFVxContainerCnv( ISvcLocator *svcloc ):
21  MVFVxContainerCnvBase(svcloc)
22  {
23 
24  }
25 
26 //-----------------------------------------------------------------------------
27 // Initializer
28 //-----------------------------------------------------------------------------
30 {
31  MsgStream log(msgSvc());
32 
34  if( sc.isFailure() )
35  {
36  log << MSG::FATAL << "Could not initialize MVFVxContainerCnvBase" << endmsg;
37  return sc;
38  }
39 
40 //-------------------------------------------------------------------------
41 // Set up the message stream
42 //-------------------------------------------------------------------------
43  // log.setLevel( m_msgSvc->outputLevel() );
44  log << MSG::INFO << "MVFVxContainerCnv::initialize()" << endmsg;
45  return StatusCode::SUCCESS;
46 }
47 
48 
50 {
51  MsgStream log(msgSvc(), "MVFVxContainerCnv" );
52  log << MSG::ERROR << "createPersistent() is obsolete" << endmsg;
53  return nullptr;
54 }
55 
56 
58 {
59  MsgStream log(msgSvc());
60  static const pool::Guid p1_guid( "D7BAA7AD-1A46-4DA3-9CA7-350A1A3F0656" );
61  static const pool::Guid p0_guid( "6C6999B7-F961-4B72-B6D9-DF71CB2364CC" );
62 
63  MVFVxContainer *p_collection = nullptr;
64 
65  if( compareClassGuid( p1_guid ) ) {
66  // std::cout << "MVFVxContainerCnv::createTransient()" << std::endl;
67  /*
68  usingTPCnvForReading( m_TPConverter );
69  std::unique_ptr< MVFVxContainer_PERS > p_coll( poolReadObject< MVFVxContainer_PERS >() );
70  */
71  poolReadObject< MVFVxContainer_PERS >( m_TPConverter );
72  p_collection = m_TPConverter.createTransient( log );
73 
74  } else if( compareClassGuid( p0_guid ) ) {
75  // std::cout << "MVFVxContainerCnv::createTransient: use old converter" << std::endl;
76  p_collection = poolReadObject< MVFVxContainer >();
77  } else
78  throw std::runtime_error( "Unsupported persistent version of MVFVxContainer (unknown GUID)" );
79 
80  return p_collection;
81 }
82 
83 
84 void MVFVxContainerCnv::readObjectFromPool( const std::string& token )
85 {
86  static const pool::Guid p1_guid( "D7BAA7AD-1A46-4DA3-9CA7-350A1A3F0656" );
87 
88  // set the POOL token which will be used for reading from POOL
89  setToken( token );
90 
91  // select the object type based on its GUID
92  if( compareClassGuid( p1_guid ) ) {
93  // read the object using the main TP converter
94  poolReadObject< MVFVxContainer_PERS >( m_TPConverter );
95  }
96  else
97  throw std::runtime_error( "Unsupported version of MVFVxContainer (unknown GUID)" );
98 }
99 
100 // void MVFVxContainerCnv::updateLog(){
101 // DataObject* dObj = getDataObject();
102 // if (dObj==0) return; // Can't do much if this fails.
103 // const std::string key = (dObj->name());
104 //
105 // log.m_source="MVFVxContainerCnv: "+key; // A hack - relies on getting access to private data of MsgStream via #define trick. EJWM.
106 // }
107 
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
Trk::MVFVxContainer_tlp1
Definition: MVFVxContainer_tlp1.h:18
MVFVxContainerCnv::m_TPConverter
MVFVxContainerCnv_tlp1 m_TPConverter
Definition: MVFVxContainerCnv.h:58
MVFVxContainer
Definition: MVFVxContainer.h:31
MVFVxContainerCnv::initialize
virtual StatusCode initialize() override
Definition: MVFVxContainerCnv.cxx:29
MVFVxContainerCnv.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
MVFVxContainerCnv::createTransient
virtual MVFVxContainer * createTransient() override
Definition: MVFVxContainerCnv.cxx:57
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
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
T_AthenaPoolExtendingCnv::setToken
virtual void setToken(const std::string &token)
Set the token (in std::string representation) and classID for the object that will be read next.
MVFVxContainerCnv::readObjectFromPool
virtual void readObjectFromPool(const std::string &token) override
Read the persistent object from POOL.
Definition: MVFVxContainerCnv.cxx:84
MVFVxContainerCnv::MVFVxContainerCnv
MVFVxContainerCnv(ISvcLocator *svcloc)
Definition: MVFVxContainerCnv.cxx:20
MVFVxContainerCnv::createPersistent
virtual MVFVxContainer_PERS * createPersistent(MVFVxContainer *transCont) override
Definition: MVFVxContainerCnv.cxx:49
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
T_AthenaPoolExtendingCnv
This templated class extends T_AthenaPoolCustomCnv to provide additional/chaged functionality for Ath...
Definition: T_AthenaPoolCustomCnv.h:24