19#include "GaudiKernel/DataObject.h"
20#include "GaudiKernel/GenericAddress.h"
32 base_class(name, pSvcLocator, ROOT_StorageType),
35 m_rootSvc(
"Athena::RootSvc/AthenaRootSvc", name),
43 return StatusCode::FAILURE;
51 return StatusCode::SUCCESS;
55 return ::AthCnvSvc::finalize();
60 std::string fileName =
file;
61 std::string::size_type inx1 =
file.find(
'(');
62 if (inx1 != std::string::npos) {
63 std::string::size_type inx2 =
file.find(
')');
64 if (inx2 == std::string::npos || inx2 !=
file.size() - 1) {
65 return StatusCode::FAILURE;
67 m_treeName = fileName.substr(inx1 + 1, inx2 - inx1 - 1);
68 fileName.resize(inx1);
70 if (!
m_rootSvc->open(fileName, mode).isSuccess()) {
72 return StatusCode::FAILURE;
89 const std::string* par,
90 const unsigned long* ip,
91 IOpaqueAddress*& refpAddress) {
93 <<
"svc_type=" << svc_type <<
", "
94 <<
"clid=" << clid <<
", "
95 <<
"par=" << par[0] <<
", " << par[1] <<
" "
96 <<
"ip=" << ip[0] <<
", " << ip[1] <<
" "
97 <<
"refpaddr=" << refpAddress <<
")");
98 refpAddress =
new GenericAddress(ROOT_StorageType, clid, par[0], par[1], ip[0], ip[1]);
99 return StatusCode::SUCCESS;
103 ATH_MSG_VERBOSE(
"::convertAddress(pAddr = " << pAddress <<
", refPaddr = " << refAddress <<
")");
104 return StatusCode::FAILURE;
109 const std::string& refAddress,
110 IOpaqueAddress*& refpAddress) {
112 <<
"svc_type=" << svc_type <<
", "
113 <<
"clid=" << clid <<
", "
114 <<
"refaddr=" << refAddress <<
", "
115 <<
"refpaddr=" << refpAddress <<
")");
117 return StatusCode::FAILURE;
121 ATH_MSG_VERBOSE(
"RootCnvSvc::updateServiceState(paddr = " << pAddress <<
")");
122 return StatusCode::FAILURE;
140 const Token* token = 0;
144 if (tpConverter == 0) {
145 token =
m_rootSvc->writeObject(placement, typeDesc, pObj);
147 void* pers =
m_rootSvc->createObject(typeDesc);
149 token =
m_rootSvc->writeObject(placement, typeDesc, pers);
150 m_rootSvc->destructObject(typeDesc, pers); pers = 0;
162 ATH_MSG_VERBOSE(
"createConverter typ = " << typ <<
", clid = " << clid);
163 if (typ == ROOT_StorageType) {
166 return ::AthCnvSvc::createConverter(typ, clid, fac);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
uint32_t CLID
The Class ID type.
This file contains the class definition for the IRootSvc interface class.
This file contains the class definition for the Placement class (migrated from POOL).
This file contains the class definition for the Athena::RootCnv class.
This file contains the class definition for the RootSvc class.
virtual StatusCode initialize() override
Gaudi Service Implementation.
ServiceHandle< ::ITPCnvSvc > m_tpCnvSvc
ServiceHandle to the T/P conversion service.
ITPCnvBase * getTPConverter(const CLID &clid) const
Get T/P converter for a transient class.
IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new converter using factory.
RootCnvSvc()
Default constructor:
StatusCode commitOutput(const std::string &output, bool do_commit)
Commit pending output.
StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Create a Generic address using explicit arguments to identify a single object.
ServiceHandle< ::IDictLoaderSvc > m_dictSvc
ServiceHandle to the dictionary service.
StatusCode connectOutput(const std::string &file)
Connect the output file to the service.
ServiceHandle< ::IRootSvc > m_rootSvc
ServiceHandle to the root service.
std::string m_treeName
ROOT TTree name.
RootType getType(const CLID &clid) const
const Token * writeObject(const std::string &key, const RootType &typeDesc, const void *pObj, ITPCnvBase *tpConverter=0)
Write object of a given class to Root, using optional T/P converter.
StatusCode initialize()
Gaudi Service Interface method implementations:
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)
Convert an address to string form.
This class provides the abstract converter to translate an object to/from its persistent ROOT represe...
virtual void transToPersUntyped(const void *trans, void *pers, MsgStream &msg)=0
Convert transient object representation to persistent.
This class holds all the necessary information to guide the writing of an object in a physical place.
Placement & setContainerName(const std::string &containerName)
Set container name.
Placement & setTechnology(int technology)
Set technology type.
This class provides a token that identifies in a unique way objects on the persistent storage.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....