| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# RootHistCnv::RDirectoryCnv Class Reference

Create persistent and transient representations of data store directories. More...

`#include <RDirectoryCnv.h>`

Inheritance diagram for RootHistCnv::RDirectoryCnv:

[legend]
Collaboration diagram for RootHistCnv::RDirectoryCnv:

[legend]

List of all members.

## Public Member Functions
virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Create the transient representation of an object.
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *refpObj)
| Update the transient object from the other representation.
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
| Convert the transient object to the requested representation.
virtual StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObject)
| Convert the transient object to the requested representation.
| RDirectoryCnv (ISvcLocator *svc)
| Standard constructor.
| RDirectoryCnv (ISvcLocator *svc, const CLID &clid)
| Standard constructor.
virtual | ~RDirectoryCnv ()
| Standard destructor.
## Static Public Member Functions
static const CLID & | classID ()
| Inquire class type.

## Detailed Description

Create persistent and transient representations of data store directories.

Author:
  Charles Leggett

Definition at line 17 of file RDirectoryCnv.h.

## Constructor & Destructor Documentation

RootHistCnv::RDirectoryCnv::RDirectoryCnv | ( | ISvcLocator * | svc | ) | `[inline]`

Standard constructor.

Definition at line 30 of file RDirectoryCnv.h.

    00030 : RConverter(CLID_NTupleDirectory, svc) {}

RootHistCnv::RDirectoryCnv::RDirectoryCnv | ( | ISvcLocator * | svc,
|  | const CLID & | clid |
| ) |  |  | `[inline]`

Standard constructor.

Definition at line 32 of file RDirectoryCnv.h.

    00032 : RConverter(clid, svc){}

virtual RootHistCnv::RDirectoryCnv::~RDirectoryCnv | ( |  | ) | `[inline, virtual]`

Standard destructor.

Definition at line 34 of file RDirectoryCnv.h.

    00034 {}

## Member Function Documentation

StatusCode RootHistCnv::RDirectoryCnv::createObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject *& | refpObj |
| ) |  |  | `[virtual]`

Create the transient representation of an object.

Reimplemented from Converter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 32 of file RDirectoryCnv.cpp.

    00035 {
    00036   refpObject = new NTuple::Directory();
    00037   return StatusCode::SUCCESS;
    00038 }

StatusCode RootHistCnv::RDirectoryCnv::fillObjRefs | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | refpObj |
| ) |  |  | `[virtual]`

Update the transient object from the other representation.

Reimplemented from Converter.

Definition at line 74 of file RDirectoryCnv.cpp.

    00074                                                                              {
    00075   MsgStream log(msgSvc(), "RDirectoryCnv");
    00076   IRegistry* pReg = pObj->registry();
    00077   std::string full  = pReg->identifier();
    00078   const std::string& fname = pAddr->par()[0];
    00079
    00080   TFile *tf;
    00081   findTFile(full,tf).ignore();
    00082
    00083   // cd to TFile:
    00084   setDirectory(full);
    00085   TIter nextkey(gDirectory->GetListOfKeys());
    00086   while (TKey *key = (TKey*)nextkey()) {
    00087     IOpaqueAddress* pA = 0;
    00088     TObject *obj = key->ReadObj();
    00089     std::string title = obj->GetTitle();
    00090     std::string sid = obj->GetName();
    00091     std::string f2 = full + "/" + sid;
    00092     int idh = ::strtol(sid.c_str(),NULL,10);
    00093     // introduced by Grigori Rybkine
    00094     std::string clname = key->GetClassName();
    00095     std::string clnm = clname.substr(0,3);
    00096     TClass* isa = obj->IsA();
    00097     if (isa->InheritsFrom("TTree")) {
    00098       createAddress(full, CLID_ColumnWiseTuple, idh, obj, pA).ignore();
    00099       TTree* tree = (TTree*) obj;
    00100       tree->Print();
    00101       log << MSG::DEBUG << "Reg CWNT \"" << obj->GetTitle()
    00102           << "\" as " << f2 << endmsg;
    00103       title = "/" + sid;
    00104     } else if (isa->InheritsFrom("TDirectory")) {
    00105       createAddress(full,CLID_NTupleDirectory, title, obj, pA).ignore();
    00106     } else if ( isa == TProfile::Class() ) {
    00107       createAddress(full,CLID_ProfileH,idh,obj,pA).ignore();
    00108       title = sid;
    00109     } else if ( isa == TProfile2D::Class() ) {
    00110       createAddress(full,CLID_ProfileH2,idh,obj,pA).ignore();
    00111       title = sid;
    00112     } else if ( isa == TH1C::Class() ) {
    00113       createAddress(full,CLID_H1D,idh,obj,pA).ignore();
    00114       title = sid;
    00115     } else if ( isa == TH1S::Class() ) {
    00116       createAddress(full,CLID_H1D,idh,obj,pA).ignore();
    00117       title = sid;
    00118     } else if ( isa == TH1I::Class() ) {
    00119       createAddress(full,CLID_H1D,idh,obj,pA).ignore();
    00120       title = sid;
    00121     } else if ( isa == TH1F::Class() ) {
    00122       createAddress(full,CLID_H1D,idh,obj,pA).ignore();
    00123       title = sid;
    00124     } else if ( isa == TH1D::Class() ) {
    00125       createAddress(full,CLID_H1D,idh,obj,pA).ignore();
    00126       title = sid;
    00127     } else if ( isa == TH2C::Class() ) {
    00128       createAddress(full,CLID_H2D,idh,obj,pA).ignore();
    00129       title = sid;
    00130     } else if ( isa == TH2S::Class() ) {
    00131       createAddress(full,CLID_H2D,idh,obj,pA).ignore();
    00132       title = sid;
    00133     } else if ( isa == TH2I::Class() ) {
    00134       createAddress(full,CLID_H2D,idh,obj,pA).ignore();
    00135       title = sid;
    00136     } else if ( isa == TH2F::Class() ) {
    00137       createAddress(full,CLID_H2D,idh,obj,pA).ignore();
    00138       title = sid;
    00139     } else if ( isa == TH2D::Class() ) {
    00140       createAddress(full,CLID_H2D,idh,obj,pA).ignore();
    00141       title = sid;
    00142     } else if ( isa == TH3C::Class() ) {
    00143       createAddress(full,CLID_H3D,idh,obj,pA).ignore();
    00144       title = sid;
    00145     } else if ( isa == TH3S::Class() ) {
    00146       createAddress(full,CLID_H3D,idh,obj,pA).ignore();
    00147       title = sid;
    00148     } else if ( isa == TH3I::Class() ) {
    00149       createAddress(full,CLID_H3D,idh,obj,pA).ignore();
    00150       title = sid;
    00151     } else if ( isa == TH3F::Class() ) {
    00152       createAddress(full,CLID_H3D,idh,obj,pA).ignore();
    00153       title = sid;
    00154     } else if ( isa == TH3D::Class() ) {
    00155       createAddress(full,CLID_H3D,idh,obj,pA).ignore();
    00156       title = sid;
    00157     } else {
    00158       log << MSG::ERROR << "Encountered an unknown object with key: "
    00159           << obj->GetName() << " in ROOT file " << fname << endmsg;
    00160       return StatusCode::FAILURE;
    00161     }
    00162     if ( 0 != pA )    {
    00163       StatusCode sc = dataManager()->registerAddress(pReg, title, pA);
    00164       if ( !sc.isSuccess() )  {
    00165         log << MSG::ERROR << "Failed to register address for " << full  << endmsg;
    00166         return sc;
    00167       }
    00168       log << MSG::VERBOSE << "Created address for " << clnm
    00169           << "'" << title << "' in " << full << endmsg;
    00170     }
    00171   }
    00172   return StatusCode::SUCCESS;
    00173 }

StatusCode RootHistCnv::RDirectoryCnv::createRep | ( | DataObject * | pObj,
|  | IOpaqueAddress *& | refpAddr |
| ) |  |  | `[virtual]`

Convert the transient object to the requested representation.

Reimplemented from RootHistCnv::RConverter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 42 of file RDirectoryCnv.cpp.

    00045 {
    00046   const std::string& loc = pObject->registry()->identifier();
    00047   if ( createDirectory(loc).isSuccess() )   {
    00048     setDirectory(loc);
    00049     setDiskDirectory(loc);
    00050 //  return createAddress(pObject, pObject->registry()->name(), refpAddress);
    00051     return createAddress(pObject, gDirectory, 0, refpAddress);
    00052   }
    00053   refpAddress = 0;
    00054   return StatusCode::FAILURE;
    00055 }

StatusCode RootHistCnv::RDirectoryCnv::updateRep | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Convert the transient object to the requested representation.

Reimplemented from Converter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 59 of file RDirectoryCnv.cpp.

    00062 {
    00063   const std::string& loc = pObject->registry()->identifier();
    00064   if ( createDirectory(loc).isSuccess() )   {
    00065     setDirectory(loc);
    00066     return StatusCode::SUCCESS;
    00067   }
    00068   return StatusCode::FAILURE;
    00069 }

static const CLID& RootHistCnv::RDirectoryCnv::classID | ( |  | ) | `[inline, static]`

Inquire class type.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 28 of file RDirectoryCnv.h.

    00028 {      return CLID_NTupleDirectory;    }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/RootHistCnv/src/RDirectoryCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/RootHistCnv/src/RDirectoryCnv.cpp