| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

Public Member Functions | Static Public Member Functions

# 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.

    : RConverter(CLID_NTupleDirectory, svc) {}

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

Standard constructor.

Definition at line 32 of file RDirectoryCnv.h.

    : RConverter(clid, svc){}

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

Standard destructor.

Definition at line 34 of file RDirectoryCnv.h.

    {}

## Member Function Documentation

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

Inquire class type.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 28 of file RDirectoryCnv.h.

    {      return CLID_NTupleDirectory;    }

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.

    {
      refpObject = new NTuple::Directory();
      return StatusCode::SUCCESS;
    }

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.

    {
      const std::string& loc = pObject->registry()->identifier();
      if ( createDirectory(loc).isSuccess() )   {
        setDirectory(loc);
        setDiskDirectory(loc);
    //  return createAddress(pObject, pObject->registry()->name(), refpAddress);
        return createAddress(pObject, gDirectory, 0, refpAddress);
      }
      refpAddress = 0;
      return StatusCode::FAILURE;
    }

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.

                                                                                 {
      MsgStream log(msgSvc(), "RDirectoryCnv");
      IRegistry* pReg = pObj->registry();
      std::string full  = pReg->identifier();
      const std::string& fname = pAddr->par()[0];

      TFile *tf;
      findTFile(full,tf).ignore();

      // cd to TFile:
      setDirectory(full);
      TIter nextkey(gDirectory->GetListOfKeys());
      while (TKey *key = (TKey*)nextkey()) {
        IOpaqueAddress* pA = 0;
        TObject *obj = key->ReadObj();
        std::string title = obj->GetTitle();
        std::string sid = obj->GetName();
        std::string f2 = full + "/" + sid;
        int idh = ::strtol(sid.c_str(),NULL,10);
        // introduced by Grigori Rybkine
        std::string clname = key->GetClassName();
        std::string clnm = clname.substr(0,3);
        TClass* isa = obj->IsA();
        if (isa->InheritsFrom("TTree")) {
          createAddress(full, CLID_ColumnWiseTuple, idh, obj, pA).ignore();
          TTree* tree = (TTree*) obj;
          tree->Print();
          log << MSG::DEBUG << "Reg CWNT \"" << obj->GetTitle()
              << "\" as " << f2 << endmsg;
          title = "/" + sid;
        } else if (isa->InheritsFrom("TDirectory")) {
          createAddress(full,CLID_NTupleDirectory, title, obj, pA).ignore();
        } else if ( isa == TProfile::Class() ) {
          createAddress(full,CLID_ProfileH,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TProfile2D::Class() ) {
          createAddress(full,CLID_ProfileH2,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH1C::Class() ) {
          createAddress(full,CLID_H1D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH1S::Class() ) {
          createAddress(full,CLID_H1D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH1I::Class() ) {
          createAddress(full,CLID_H1D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH1F::Class() ) {
          createAddress(full,CLID_H1D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH1D::Class() ) {
          createAddress(full,CLID_H1D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH2C::Class() ) {
          createAddress(full,CLID_H2D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH2S::Class() ) {
          createAddress(full,CLID_H2D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH2I::Class() ) {
          createAddress(full,CLID_H2D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH2F::Class() ) {
          createAddress(full,CLID_H2D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH2D::Class() ) {
          createAddress(full,CLID_H2D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH3C::Class() ) {
          createAddress(full,CLID_H3D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH3S::Class() ) {
          createAddress(full,CLID_H3D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH3I::Class() ) {
          createAddress(full,CLID_H3D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH3F::Class() ) {
          createAddress(full,CLID_H3D,idh,obj,pA).ignore();
          title = sid;
        } else if ( isa == TH3D::Class() ) {
          createAddress(full,CLID_H3D,idh,obj,pA).ignore();
          title = sid;
        } else {
          log << MSG::ERROR << "Encountered an unknown object with key: "
              << obj->GetName() << " in ROOT file " << fname << endmsg;
          return StatusCode::FAILURE;
        }
        if ( 0 != pA )    {
          StatusCode sc = dataManager()->registerAddress(pReg, title, pA);
          if ( !sc.isSuccess() )  {
            log << MSG::ERROR << "Failed to register address for " << full  << endmsg;
            return sc;
          }
          log << MSG::VERBOSE << "Created address for " << clnm
              << "'" << title << "' in " << full << endmsg;
        }
      }
      return StatusCode::SUCCESS;
    }

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.

    {
      const std::string& loc = pObject->registry()->identifier();
      if ( createDirectory(loc).isSuccess() )   {
        setDirectory(loc);
        return StatusCode::SUCCESS;
      }
      return StatusCode::FAILURE;
    }

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines