11#define ROOTHISTCNV_RCONVERTER_CPP
23#include <TDirectory.h>
30 std::map<std::string, TFile*> s_fileMap;
42 std::string fil, cur, s;
43 TDirectory* gDir = gDirectory;
46 if (
findTFile( loc, tf ).isSuccess() ) { tf->cd(); }
48 std::vector<std::string> lpath;
51 auto p = full.find(
":", 0 );
52 if ( p != std::string::npos ) {
53 fil = full.substr( 0, p );
56 gDirectory->cd( fil.c_str() );
59 while ( ( p = full.find(
"/", i ) ) != std::string::npos ) {
60 s = full.substr( i, p - i );
64 lpath.push_back( full.substr( i ) );
66 if ( full.compare( 0, 1,
"/" ) == 0 ) gDirectory->cd(
"/" );
68 for (
const auto& litr : lpath ) {
70 if ( !gDirectory->GetKey( litr.c_str() ) ) { gDirectory->mkdir( litr.c_str() ); }
71 gDirectory->cd( litr.c_str() );
84 long lf1 = loc.find(
"/NTUPLES/" );
85 long lf2 = loc.find(
"/stat/" );
88 ll = loc.find(
"/", lf1 + 9 );
90 }
else if ( lf2 != -1 ) {
91 ll = loc.find(
"/", lf2 + 6 );
95 log <<
MSG::ERROR <<
"diskDirectory(" << loc <<
")"
96 <<
" --> no leading /NTUPLES/ or /stat/" <<
endmsg;
104 dir = loc.substr( ll );
127 if (
findTFile( loc, tf ).isSuccess() ) {
134 std::string cur, sdir;
136 gDirectory->cd(
"/" );
137 while ( ( p = full.find(
"/", i ) ) != -1 ) {
138 sdir = full.substr( i, p - i );
139 if ( !gDirectory->GetKey( sdir.c_str() ) ) {
140 log <<
MSG::ERROR <<
"cannot cd to " << full <<
" from " << gDirectory->GetPath() <<
endmsg;
143 gDirectory->cd( sdir.c_str() );
147 gDirectory->cd( full.substr( i ).c_str() );
161 return gDirectory->GetPath();
175 (
unsigned long)( pTObj ), pTObj );
199 auto obj = std::to_string(
id );
202 unsigned long* ipar = (
unsigned long*)refpAddress->
ipar();
219 StatusCode status = dataMgr->objectParent( pReg, pParentReg );
223 TDirectory* pParentDir = (TDirectory*)pParAddr->
ipar()[0];
225 gDirectory->cd( pParentDir->GetPath() );
277 auto imap = s_fileMap.find(
id );
278 if ( imap != s_fileMap.end() ) {
280 log <<
MSG::ERROR <<
"cannot register TTree " <<
id <<
": already exists" <<
endmsg;
283 s_fileMap[id] =
const_cast<TFile*
>( tfile );
299 i1 =
id.find(
"/", 0 );
301 log <<
MSG::ERROR <<
"Directory name does not start with \"/\": " <<
id <<
endmsg;
304 i2 =
id.find(
"/", i1 + 1 );
309 i3 =
id.find(
"/", i2 + 1 );
313 idm =
id.substr( 0, i3 );
316 auto imap = s_fileMap.find( idm );
318 tfile = imap->second;
326 if (
id.size() > 0 && isdigit(
id[0] ) ) {
330 forced = tmp.
value();
const char *PyHelper getProperty(IInterface *p, char *name)
unsigned int CLID
Class ID definition.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
SmartIF< IDataProviderSvc > & dataProvider() const override
Get Data provider service.
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
A DataObject is the base class of any identifiable object on any data store.
IRegistry * registry() const
Get pointer to Registry.
Implementation of property with value of concrete type.
const ValueType & value() const
bool assign(const Details::PropertyBase &source) override
get the value from another property
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual const name_type & name() const =0
Name of the directory (or key)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
Definition of the MsgStream class used to transmit messages.
std::string directory(const std::string &loc)
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
std::string diskDirectory(const std::string &loc)
long repSvcType() const override
StatusCode findTFile(const std::string &, TFile *&)
std::string getDirectory()
void setDirectory(const std::string &loc)
void setDiskDirectory(const std::string &loc)
StatusCode createDirectory(const std::string &loc)
StatusCode regTFile(const std::string &, const TFile *)
virtual StatusCode readObject(IOpaqueAddress *pAddr, DataObject *&refpObj)
Create the transient representation of an object.
TDirectory * changeDirectory(DataObject *pObject)
Switch to object directory (=Parent directory)
virtual TObject * createPersistent(DataObject *pObj)
Create the persistent representation of an object.
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation.
StatusCode error(const std::string &msg)
std::string convertId(const std::string &) const
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE