| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# RootHistCnv::RHistogramCnv< T, S, Q > Class Template Reference

`#include <RHistogramCnv.h>`

Inheritance diagram for RootHistCnv::RHistogramCnv< T, S, Q >:

[legend]
Collaboration diagram for RootHistCnv::RHistogramCnv< T, S, Q >:

[legend]
List of all members.

## Detailed Description

### template<typename T, typename S, typename Q>
class RootHistCnv::RHistogramCnv< T, S, Q >

Generic converter to save/read AIDA_ROOT histograms using ROOT.

This converter shortcuts the AIDA binding and takes advantage of the underlying implementation of transient histograms using ROOT.

Note: THxY::Copy cannot be used - only THxY::Add !

Author:
  Markus Frank

Definition at line 30 of file RHistogramCnv.h.

## Public Member Functions
virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Create the transient representation of an object.
virtual StatusCode | updateObj (IOpaqueAddress *, DataObject *)
| Update the transient object from the other representation.
virtual TObject * | createPersistent (DataObject *pObj)
| Create the persistent representation of the histogram object.
| RHistogramCnv (ISvcLocator *svc)
| Standard constructor.
virtual | ~RHistogramCnv ()
## Static Public Member Functions
static const CLID & | classID ()
| Inquire class type.
## Classes
struct | TTH

## Constructor & Destructor Documentation

template<typename T, typename S, typename Q>

RootHistCnv::RHistogramCnv< T, S, Q >::RHistogramCnv | ( | ISvcLocator * | svc | ) | `[inline]`

Standard constructor.

Definition at line 88 of file RHistogramCnv.h.

    00088 : RConverter(classID(), svc) {}

template<typename T, typename S, typename Q>

virtual RootHistCnv::RHistogramCnv< T, S, Q >::~RHistogramCnv | ( |  | ) | `[inline, virtual]`

Definition at line 89 of file RHistogramCnv.h.

    00089 {}

## Member Function Documentation

template<typename T, typename S, typename Q>

virtual StatusCode RootHistCnv::RHistogramCnv< T, S, Q >::createObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject *& | refpObj |
| ) |  |  | `[inline, virtual]`

Create the transient representation of an object.

Reimplemented from Converter.

Definition at line 36 of file RHistogramCnv.h.

References RootHistCnv::RConverter::error(), std::auto_ptr< _Tp >::get(), Converter::objType(), std::auto_ptr< _Tp >::release(), Gaudi::Units::s, and StatusCode::SUCCESS.

    00036                                                                               {
    00037       refpObj = ROOT::Reflex::PluginService::CreateWithId<DataObject*>(objType());
    00038       RootObjAddress *r = dynamic_cast<RootObjAddress*>(pAddr);
    00039       Q* h = dynamic_cast<Q*>(refpObj);
    00040       if ( r && h )   {
    00041         // Need to flip representation .... clumsy for the time being, because
    00042         // THXY constructor has no "generic" copy constructor
    00043         std::auto_ptr<T> p(new T());
    00044         S *s = dynamic_cast<S*>(r->tObj());
    00045         if ( s && p.get() )  {
    00046           TTH<S>* casted = (TTH<S>*)s;
    00047           TArray* a = dynamic_cast<TArray*>(s);
    00048           casted->CopyH(*p);
    00049           if ( 0 != a )  {
    00050             p->Set(a->GetSize());
    00051             p->Reset();
    00052             p->Add(s);
    00053             h->adoptRepresentation(p.release());
    00054             return StatusCode::SUCCESS;
    00055           }
    00056         }
    00057       }
    00058       return error("Cannot create histogram - invalid address.");
    00059     }

template<typename T, typename S, typename Q>

virtual StatusCode RootHistCnv::RHistogramCnv< T, S, Q >::updateObj | ( | IOpaqueAddress * | ,
|  | DataObject * |  |
| ) |  |  | `[inline, virtual]`

Update the transient object from the other representation.

Reimplemented from Converter.

Definition at line 61 of file RHistogramCnv.h.

References StatusCode::SUCCESS.

    00061                                                                                        {
    00062       return StatusCode::SUCCESS;
    00063     }

template<typename T, typename S, typename Q>

virtual TObject* RootHistCnv::RHistogramCnv< T, S, Q >::createPersistent | ( | DataObject * | pObj | ) | `[inline, virtual]`

Create the persistent representation of the histogram object.

Reimplemented from RootHistCnv::RConverter.

Definition at line 65 of file RHistogramCnv.h.

References c, RootHistCnv::RConverter::error(), IRegistry::name(), and DataObject::registry().

    00065                                                           {
    00066       Q* h = dynamic_cast<Q*>(pObj);
    00067       if ( 0 != h ) {
    00068         T *r = dynamic_cast<T*>(h->representation());
    00069         if ( r )   {
    00070           T* c = new T();
    00071           TArray* a = dynamic_cast<TArray*>(r);
    00072           ((TTH<S>*)r)->CopyH(*c);
    00073           if ( 0 != a )  {
    00074             c->Set(a->GetSize());
    00075             c->Reset();
    00076             c->Add(r);
    00077             c->SetName(pObj->registry()->name().c_str()+1);
    00078             return c;
    00079           }
    00080         }
    00081       }
    00082       error("Histogram object is invalid!");
    00083       return 0;
    00084     }

const CLID & RootHistCnv::RootHistCnvH3DCnv::classID | ( |  | ) | `[static]`

Inquire class type.

Definition at line 9 of file RHistogramCnv.cpp.

References CLID_ProfileH.

    00009 { return CLID_ProfileH;    }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/RootHistCnv/v9r16/src/RHistogramCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/RootHistCnv/v9r16/src/RHistogramCnv.cpp