Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 2012
Defines | Functions

RootNTupleCnv.cpp File Reference

#include "RootCnv/RootRefs.h"
#include "RootCnv/RootAddress.h"
#include "RootCnv/RootNTupleCnv.h"
#include "RootCnv/RootDataConnection.h"
#include "GaudiKernel/NTuple.h"
#include "GaudiKernel/SmartIF.h"
#include "GaudiKernel/SmartRef.h"
#include "GaudiKernel/INTupleSvc.h"
#include "GaudiKernel/IRegistry.h"
#include "GaudiKernel/ISelectStatement.h"
#include "GaudiKernel/ContainedObject.h"
#include "GaudiKernel/StreamBuffer.h"
#include "TROOT.h"
#include "TTree.h"
#include "TBranch.h"
#include "Reflex/Reflex.h"
#include <limits>
#include <memory>
Include dependency graph for RootNTupleCnv.cpp:

Go to the source code of this file.

Defines

#define ALLOW_ALL_TYPES
#define S_OK   StatusCode::SUCCESS
#define S_FAIL   StatusCode::FAILURE

Functions

static istreamloadLong (istream &is)
static istreamoperator>> (istream &is, IOpaqueAddress *&)
template<class TYP >
static StatusCode createItem (TTree *tree, INTuple *tuple, istream &is, const string &name, bool add, const TYP &null)
template<class T >
static void putRange (ostream &os, NTuple::_Data< T > *it)
static string _tr (const string &s)

Define Documentation

#define ALLOW_ALL_TYPES

Definition at line 10 of file RootNTupleCnv.cpp.

#define S_FAIL   StatusCode::FAILURE

Definition at line 36 of file RootNTupleCnv.cpp.

#define S_OK   StatusCode::SUCCESS

Definition at line 35 of file RootNTupleCnv.cpp.


Function Documentation

static string _tr ( const string &  s ) [inline, static]

Definition at line 127 of file RootNTupleCnv.cpp.

                                          {
  string local = s;
  char* p = (char*)local.c_str();
  if ( strncmp(p,"<local>",7)==0 ) p += 7;
  for(;*p;++p)
    if ( !isalnum(*p) ) *p = '_';
  return local;
}
template<class TYP >
static StatusCode createItem ( TTree *  tree,
INTuple tuple,
istream is,
const string &  name,
bool  add,
const TYP &  null 
) [static]

Definition at line 59 of file RootNTupleCnv.cpp.

                                                                                                               {
  string idxName;
  long len, ndim, dim[4], hasIdx, idxLow, idxLen;
  long dim1 = 1, dim2 = 1;
  INTupleItem* it = 0;
  char c;
  is >> len    >> c
    >> ndim   >> c
    >> hasIdx >> c;
  if ( hasIdx )  {
    getline(is, idxName, ';') >> idxLow >> c >> idxLen >> c;
  }
  for ( int i = 0; i < ndim; i++ )
    is >> dim[i] >> c;

  TYP low = null, high = null;
  is >> low >> c >> high >> c;
  is >> c;
  switch( ndim ) 
  {
  case 0:
    it = NTuple::_Item<TYP>::create (tuple, name, typeid(TYP), low, high, null);
    break;
  case 1:
    dim1 = (hasIdx) ? idxLen : dim[0];
    it = NTuple::_Array<TYP>::create (tuple,
      name,
      typeid(TYP),
      idxName,
      dim1,
      low,
      high,
      null);
    break;
  case 2:
    dim1 = (hasIdx) ? idxLen : dim[0];
    dim2 = (hasIdx) ? dim[0] : dim[1];
    it = NTuple::_Matrix<TYP>::create ( tuple,
      name,
      typeid(TYP),
      idxName,
      dim1,
      dim2,
      low,
      high,
      null);
    break;
  default:
    return S_FAIL;
  }
  if ( add ) {
    TBranch* b = tree->GetBranch(it->name().c_str());
    if ( b ) {
      b->SetAddress((void*)it->buffer());
    }
    else {
      //return StatusCode::SUCCESS;
      return tuple->add(it);
    }
  }
  return tuple->add(it);
}
static istream& loadLong ( istream is ) [inline, static]

Definition at line 41 of file RootNTupleCnv.cpp.

                                                {
  long i;
  is >> i;
  return is;
}
static istream& operator>> ( istream is,
IOpaqueAddress *&   
) [inline, static]

Definition at line 46 of file RootNTupleCnv.cpp.

{  return loadLong(is);          }
template<class T >
static void putRange ( ostream os,
NTuple::_Data< T > *  it 
) [inline, static]

Definition at line 122 of file RootNTupleCnv.cpp.

                                                                                  {
  const NTuple::Range<T>& x = it->range();
  os << x.lower() << ';' << x.upper() << ';';
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 23:27:33 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004