RootHistCnv::RConverter Class Reference

Root Converter. More...

#include <src/RConverter.h>

Inheritance diagram for RootHistCnv::RConverter:
Collaboration diagram for RootHistCnv::RConverter:

Public Member Functions

StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
 Convert the transient object to the requested representation. More...
 
long repSvcType () const override
 
StatusCode error (const std::string &msg)
 
StatusCode regTFile (const std::string, const TFile *)
 
StatusCode findTFile (const std::string, TFile *&)
 
std::string diskDirectory (const std::string &loc)
 
std::string directory (const std::string &loc)
 
void setDirectory (const std::string &loc)
 
void setDiskDirectory (const std::string &loc)
 
StatusCode createDirectory (const std::string &loc)
 
StatusCode createDiskDirectory (const std::string &loc)
 
std::string getDirectory ()
 
std::string convertId (const std::string &) const
 
- Public Member Functions inherited from Converter
StatusCode initialize () override
 Initialize the converter. More...
 
StatusCode finalize () override
 Initialize the converter. More...
 
StatusCode setDataProvider (IDataProviderSvc *svc) override
 Set Data provider service. More...
 
SmartIF< IDataProviderSvc > & dataProvider () const override
 Get Data provider service. More...
 
StatusCode setConversionSvc (IConversionSvc *svc) override
 Set conversion service the converter is connected to. More...
 
SmartIF< IConversionSvc > & conversionSvc () const override
 Get conversion service the converter is connected to. More...
 
StatusCode setAddressCreator (IAddressCreator *creator) override
 Set address creator facility. More...
 
SmartIF< IAddressCreator > & addressCreator () const override
 Retrieve address creator facility. More...
 
const CLIDobjType () const override
 Retrieve the class type of objects the converter produces. More...
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
 Create the transient representation of an object. More...
 
StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the created transient object. More...
 
StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
 Update the transient object from the other representation. More...
 
StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an updated transient object. More...
 
StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
 Convert the transient object to the requested representation. More...
 
StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the converted object. More...
 
StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the converted representation of a transient object. More...
 
StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an already converted object. More...
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name") More...
 
StatusCode initialize () override
 Initialize the converter. More...
 
StatusCode finalize () override
 Initialize the converter. More...
 
StatusCode setDataProvider (IDataProviderSvc *svc) override
 Set Data provider service. More...
 
SmartIF< IDataProviderSvc > & dataProvider () const override
 Get Data provider service. More...
 
StatusCode setConversionSvc (IConversionSvc *svc) override
 Set conversion service the converter is connected to. More...
 
SmartIF< IConversionSvc > & conversionSvc () const override
 Get conversion service the converter is connected to. More...
 
StatusCode setAddressCreator (IAddressCreator *creator) override
 Set address creator facility. More...
 
SmartIF< IAddressCreator > & addressCreator () const override
 Retrieve address creator facility. More...
 
const CLIDobjType () const override
 Retrieve the class type of objects the converter produces. More...
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
 Create the transient representation of an object. More...
 
StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the created transient object. More...
 
StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
 Update the transient object from the other representation. More...
 
StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an updated transient object. More...
 
StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
 Convert the transient object to the requested representation. More...
 
StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the converted object. More...
 
StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the converted representation of a transient object. More...
 
StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an already converted object. More...
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name") More...
 
- Public Member Functions inherited from implements< Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Static Public Member Functions

static long storageType ()
 Inquire storage type. More...
 

Protected Member Functions

 RConverter (const CLID &clid, ISvcLocator *svc)
 Standard constructor. More...
 
 ~RConverter () override=default
 Standard destructor. More...
 
virtual StatusCode readObject (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create the transient representation of an object. More...
 
virtual TObject * createPersistent (DataObject *pObj)
 Create the persistent representation of an object. More...
 
StatusCode createAddress (DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
 Create address of the transient object according to the requested representation. More...
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, long id, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, const std::string &title, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
TDirectory * changeDirectory (DataObject *pObject)
 Switch to object directory (=Parent directory) More...
 
- Protected Member Functions inherited from Converter
 ~Converter () override=default
 Standard Destructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service. More...
 
 ~Converter () override=default
 Standard Destructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service. More...
 

Additional Inherited Members

- Public Types inherited from Converter
typedef Gaudi::PluginService::Factory< IConverter *, ISvcLocator * > Factory
 
typedef Gaudi::PluginService::Factory< IConverter *, ISvcLocator * > Factory
 
- Public Types inherited from implements< Interfaces >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Attributes inherited from implements< Interfaces >
std::atomic_ulong m_refCount = {0}
 Reference counter. More...
 

Detailed Description

Root Converter.

Author
Charles Leggett

Definition at line 34 of file RConverter.h.

Constructor & Destructor Documentation

RootHistCnv::RConverter::RConverter ( const CLID clid,
ISvcLocator svc 
)
inlineprotected

Standard constructor.

Definition at line 59 of file RConverter.h.

60  : Converter(storageType(), clid, svc) { }
Converter(long storage_type, const CLID &class_type, ISvcLocator *svc=0)
Standard Constructor.
Definition: Converter.cpp:145
static long storageType()
Inquire storage type.
Definition: RConverter.h:40
RootHistCnv::RConverter::~RConverter ( )
overrideprotecteddefault

Standard destructor.

Member Function Documentation

TDirectory * RootHistCnv::RConverter::changeDirectory ( DataObject pObject)
protected

Switch to object directory (=Parent directory)

Definition at line 226 of file RConverter.cpp.

228 {
229  if ( pObject ) {
230  IRegistry* pReg = pObject->registry();
231  if ( pReg ) {
232  auto dataMgr = dataProvider().as<IDataManagerSvc>();
233  if ( dataMgr ) {
234  IRegistry* pParentReg = nullptr;
235  StatusCode status = dataMgr->objectParent(pReg, pParentReg);
236  if ( status.isSuccess() ) {
237  IOpaqueAddress* pParAddr = pParentReg->address();
238  if ( pParAddr ) {
239  TDirectory* pParentDir = (TDirectory*)pParAddr->ipar()[0];
240  if ( pParentDir ) {
241  gDirectory->cd(pParentDir->GetPath());
242  return pParentDir;
243  }
244  }
245  }
246  }
247  }
248  }
249  return nullptr;
250 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:110
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
SmartIF< IDataProviderSvc > & dataProvider() const override
Get Data provider service.
Definition: Converter.cpp:92
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
std::string RootHistCnv::RConverter::convertId ( const std::string &  id) const

Definition at line 351 of file RConverter.cpp.

353 {
354  bool forced = false;
355  if ( id.size() > 0 && isdigit(id[0]) ) {
356  try {
357  BooleanProperty tmp;
358  tmp.assign(conversionSvc().as<IProperty>()->getProperty( "ForceAlphaIds"));
359  forced = tmp.value();
360  }
361  catch ( ... ) { }
362  }
363  if (forced ) return "h" + id;
364  else return id;
365 }
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: Converter.cpp:108
const char *PyHelper() getProperty(IInterface *p, char *name)
Definition: Bootstrap.cpp:258
const TYPE & value() const
explicit conversion
Definition: Property.h:341
bool assign(const Property &source) override
get the value from another property
Definition: Property.h:269
StatusCode RootHistCnv::RConverter::createAddress ( DataObject pObject,
TDirectory *  pDir,
TObject *  pTObject,
IOpaqueAddress *&  refpAddr 
)
protected

Create address of the transient object according to the requested representation.

Definition at line 161 of file RConverter.cpp.

166 {
167  // Get address again....it does not change
168  IRegistry* pReg = pObj->registry();
169  if ( pReg ) {
170  refpAddr = pReg->address();
171  if ( !refpAddr ) {
172  refpAddr = new RootObjAddress(repSvcType(),
173  objType(),
174  pReg->name(),
175  "",
176  (unsigned long)(pDir),
177  (unsigned long)(pTObj),
178  pTObj);
179 
180  return StatusCode::SUCCESS;
181  }
182  }
183  return StatusCode::FAILURE;
184 }
virtual const name_type & name() const =0
Name of the directory (or key)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
long repSvcType() const override
Definition: RConverter.h:41
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:14
StatusCode RootHistCnv::RConverter::createAddress ( const std::string &  rzdir,
const CLID clid,
long  id,
TObject *  pTobj,
IOpaqueAddress *&  refpAddress 
)
protected

Definition at line 208 of file RConverter.cpp.

214 {
215  auto obj = std::to_string(id);
216  StatusCode status = createAddress(rzdir, clid, obj, pTobj, refpAddress);
217  if ( status.isSuccess() ) {
218  unsigned long* ipar = (unsigned long*)refpAddress->ipar();
219  ipar[0] = id;
220  }
221  return status;
222 }
string to_string(const T &value)
Definition: mergesort.cpp:40
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation. ...
Definition: RConverter.cpp:161
StatusCode RootHistCnv::RConverter::createAddress ( const std::string &  rzdir,
const CLID clid,
const std::string &  title,
TObject *  pTobj,
IOpaqueAddress *&  refpAddress 
)
protected

Definition at line 187 of file RConverter.cpp.

193 {
194  auto pA = new RootObjAddress(repSvcType(),
195  clid,
196  rzdir,
197  title,
198  0,
199  0,
200  pTObj );
201 
202  refpAddress = pA;
203  return StatusCode::SUCCESS;
204 }
long repSvcType() const override
Definition: RConverter.h:41
StatusCode RootHistCnv::RConverter::createDirectory ( const std::string &  loc)

Definition at line 24 of file RConverter.cpp.

26 {
27  MsgStream log(msgSvc(), "RConverter::createDir");
28 
29  // Get rid of leading /NTUPLES
30  std::string full = diskDirectory( loc );
31 
32  std::string fil,cur,s;
33  TDirectory *gDir = gDirectory;
34 
35  TFile *tf = nullptr;
36  if ( findTFile(loc,tf).isSuccess() ) {
37  tf->cd();
38  }
39 
40  std::vector<std::string> lpath;
41  int i = 1;
42 
43  auto p=full.find(":",0);
44  if ( p != std::string::npos ) {
45  fil = full.substr(0,p);
46  i = p+1;
47  fil += ":/";
48  gDirectory->cd(fil.c_str());
49  }
50 
51  while ( (p = full.find("/",i)) != std::string::npos ) {
52  s = full.substr(i,p-i);
53  lpath.push_back(s);
54  i = p+1;
55  }
56  lpath.push_back( full.substr(i) );
57 
58  if ( full.compare(0,1,"/") == 0 ) gDirectory->cd("/");
59 
60  for(const auto& litr : lpath ) {
61  cur = litr;
62  if (! gDirectory->GetKey(litr.c_str()) ) {
63  gDirectory->mkdir(litr.c_str());
64  }
65  gDirectory->cd(litr.c_str());
66  }
67 
68  gDirectory = gDir;
69 
70  return StatusCode::SUCCESS;
71 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string diskDirectory(const std::string &loc)
Definition: RConverter.cpp:73
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
StatusCode findTFile(const std::string, TFile *&)
Definition: RConverter.cpp:316
string s
Definition: gaudirun.py:245
list i
Definition: ana.py:128
StatusCode RootHistCnv::RConverter::createDiskDirectory ( const std::string &  loc)
TObject * RootHistCnv::RConverter::createPersistent ( DataObject pObj)
protectedvirtual

Create the persistent representation of an object.

Reimplemented in RootHistCnv::RHistogramCnv< T, S, Q >.

Definition at line 292 of file RConverter.cpp.

293 {
294  return nullptr;
295 }
StatusCode RootHistCnv::RConverter::createRep ( DataObject pObj,
IOpaqueAddress *&  refpAddr 
)
override

Convert the transient object to the requested representation.

Definition at line 254 of file RConverter.cpp.

257 {
258  GlobalDirectoryRestore restore;
259  pAddr = nullptr;
260  try {
261  TDirectory* pParentDir = changeDirectory(pObject);
262  if ( pParentDir ) {
263  TObject* pTObj = createPersistent(pObject);
264  if ( pTObj ) {
265  pTObj->Write();
266  delete pTObj;
267  return createAddress(pObject, pParentDir, nullptr, pAddr);
268  }
269  }
270  }
271  catch (...) {
272  }
273  MsgStream log (msgSvc(), "RConverter");
274  log << MSG::ERROR << "Failed to create persistent Object!" << endmsg;
275  return StatusCode::FAILURE;
276 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
TDirectory * changeDirectory(DataObject *pObject)
Switch to object directory (=Parent directory)
Definition: RConverter.cpp:226
virtual TObject * createPersistent(DataObject *pObj)
Create the persistent representation of an object.
Definition: RConverter.cpp:292
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation. ...
Definition: RConverter.cpp:161
std::string RootHistCnv::RConverter::directory ( const std::string &  loc)

Definition at line 105 of file RConverter.cpp.

107 {
108  return diskDirectory(loc);
109 }
std::string diskDirectory(const std::string &loc)
Definition: RConverter.cpp:73
std::string RootHistCnv::RConverter::diskDirectory ( const std::string &  loc)

Definition at line 73 of file RConverter.cpp.

75 {
76  // Get rid of leading /NTUPLES/{INPUT_STREAM} or /stat/{INPUT_STREAM}
77  std::string dir;
78  long lf1 = loc.find("/NTUPLES/");
79  long lf2 = loc.find("/stat/");
80  long ll;
81  if (lf1 != -1) {
82  ll = loc.find("/",lf1+9);
83 
84  } else if (lf2 != -1) {
85  ll = loc.find("/",lf2+6);
86 
87  } else {
88  MsgStream log(msgSvc(), "RConverter");
89  log << MSG::ERROR << "diskDirectory(" << loc << ")"
90  << " --> no leading /NTUPLES/ or /stat/" << endmsg;
91  return loc;
92  }
93  // dir = loc.substr(ll+8);
94 
95  if (ll == -1) {
96  dir = "/";
97  } else {
98  dir = loc.substr(ll);
99  }
100 
101  return dir;
102 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
StatusCode RootHistCnv::RConverter::error ( const std::string &  msg)

Definition at line 367 of file RConverter.cpp.

369 {
370  MsgStream log(msgSvc(), "RootHistCnv");
371  log << MSG::ERROR << msg << endmsg;
372  return StatusCode::FAILURE;
373 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
StatusCode RootHistCnv::RConverter::findTFile ( const std::string  id,
TFile *&  tfile 
)

Definition at line 316 of file RConverter.cpp.

319 {
320  MsgStream log(msgSvc(), "RConverter");
321  tfile = nullptr;
322 
323  std::string idm;
324 
325  // make sure we only get first two parts of id
326  int i1,i2,i3;
327  i1 = id.find("/",0);
328  if (i1 != 0) {
329  log << MSG::ERROR << "Directory name does not start with \"/\": "
330  << id << endmsg;
331  return StatusCode::FAILURE;
332  }
333  i2 = id.find("/",i1+1);
334  if (i2 == -1) {
335  log << MSG::ERROR << "Directory name has only one part: " << id << endmsg;
336  return StatusCode::FAILURE;
337  }
338  i3 = id.find("/",i2+1);
339  if (i3 == -1) {
340  idm = id;
341  } else {
342  idm = id.substr(0,i3);
343  }
344 
345  auto imap = s_fileMap.find(idm);
346  if ( imap == s_fileMap.end() ) return StatusCode::FAILURE;
347  tfile = imap->second;
348  return StatusCode::SUCCESS;
349 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
std::string RootHistCnv::RConverter::getDirectory ( )

Definition at line 153 of file RConverter.cpp.

155 {
156  return gDirectory->GetPath();
157 }
StatusCode RootHistCnv::RConverter::readObject ( IOpaqueAddress pAddr,
DataObject *&  refpObj 
)
protectedvirtual

Create the transient representation of an object.

Definition at line 279 of file RConverter.cpp.

281 {
282 // MsgStream log(msgSvc(), "RConverter::readObject");
283 // log << MSG::WARNING << pAddr->par()[0] << " <> " << pAddr->par()[1]
284 // << " <> "
285 // << pAddr->ipar()[0] << " <> " << pAddr->ipar()[1] << " <> "
286 // << pAddr->registry()->identifier() << endmsg;
287 
288  return StatusCode::SUCCESS;
289 }
StatusCode RootHistCnv::RConverter::regTFile ( const std::string  id,
const TFile *  tfile 
)

Definition at line 299 of file RConverter.cpp.

302 {
303  auto imap = s_fileMap.find(id);
304  if ( imap != s_fileMap.end() ) {
305  MsgStream log(msgSvc(), "RConverter");
306  log << MSG::ERROR << "cannot register TTree " << id
307  << ": already exists" << endmsg;
308  return StatusCode::FAILURE;
309  }
310  s_fileMap[id] = const_cast<TFile*>(tfile);
311 
312  return StatusCode::SUCCESS;
313 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
long RootHistCnv::RConverter::repSvcType ( ) const
inlineoverride

Definition at line 41 of file RConverter.h.

41 { return i_repSvcType(); }
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: Converter.cpp:19
void RootHistCnv::RConverter::setDirectory ( const std::string &  loc)

Definition at line 112 of file RConverter.cpp.

114 {
115  MsgStream log(msgSvc(), "RConverter");
116  TFile *tf = nullptr;
117 
118  std::string full = diskDirectory( loc );
119 
120  // get associated TFile
121  if ( findTFile(loc,tf).isSuccess() ) {
122  tf->cd();
123  } else {
124  log << MSG::ERROR << "error getting TFile name " << loc << endmsg;
125  }
126 
127  int p,i=1;
128  std::string cur,sdir;
129 
130  gDirectory->cd("/");
131  while ( (p = full.find("/",i)) != -1) {
132  sdir = full.substr(i,p-i);
133  if (! gDirectory->GetKey(sdir.c_str()) ) {
134  log << MSG::ERROR << "cannot cd to " << full << " from "
135  << gDirectory->GetPath() << endmsg;
136  return;
137  }
138  gDirectory->cd(sdir.c_str());
139 
140  i = p+1;
141  }
142  gDirectory->cd( full.substr(i).c_str() );
143 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string diskDirectory(const std::string &loc)
Definition: RConverter.cpp:73
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
StatusCode findTFile(const std::string, TFile *&)
Definition: RConverter.cpp:316
list i
Definition: ana.py:128
void RootHistCnv::RConverter::setDiskDirectory ( const std::string &  loc)

Definition at line 146 of file RConverter.cpp.

148 {
149  setDirectory(loc);
150 }
void setDirectory(const std::string &loc)
Definition: RConverter.cpp:112
static long RootHistCnv::RConverter::storageType ( )
inlinestatic

Inquire storage type.

Definition at line 40 of file RConverter.h.

40 { return ROOT_StorageType; }
const long ROOT_StorageType
Definition: ClassID.h:52

The documentation for this class was generated from the following files: