| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

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

Generic converter to save/read AIDA_ROOT histograms using ROOT. More...

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

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

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

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

    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.

    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.

    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 | ( |  | ) | `[inline, static]`

Inquire class type.

Definition at line 9 of file RHistogramCnv.cpp.

    00009 { return CLID_ProfileH;    }

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

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