The Gaudi Framework  v29r0 (ff2e7097)
RCWNTupleCnv.cpp File Reference
#include "GaudiKernel/INTupleSvc.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/NTuple.h"
#include <cstdio>
#include <list>
#include <utility>
#include <vector>
#include "RCWNTupleCnv.h"
#include "TLeafD.h"
#include "TLeafF.h"
#include "TLeafI.h"
#include "TTree.h"
Include dependency graph for RCWNTupleCnv.cpp:

Go to the source code of this file.

Macros

#define ROOTHISTCNV_RCWNTUPLECNV_CPP
 
#define ALLOW_ALL_TYPES
 

Functions

template<class T >
void analyzeItem (std::string typ, const NTuple::_Data< T > *it, std::string &desc, std::string &block_name, std::string &var_name, long &lowerRange, long &upperRange, long &size)
 

Macro Definition Documentation

#define ALLOW_ALL_TYPES

Definition at line 3 of file RCWNTupleCnv.cpp.

#define ROOTHISTCNV_RCWNTUPLECNV_CPP

Definition at line 1 of file RCWNTupleCnv.cpp.

Function Documentation

template<class T >
void analyzeItem ( std::string  typ,
const NTuple::_Data< T > *  it,
std::string desc,
std::string block_name,
std::string var_name,
long &  lowerRange,
long &  upperRange,
long &  size 
)

Definition at line 31 of file RCWNTupleCnv.cpp.

34 {
35 
36  RootHistCnv::parseName( it->name(), block_name, var_name );
37 
38  // long item_size = (sizeof(T) < 4) ? 4 : sizeof(T);
39  long item_size = sizeof( T );
40  long dimension = it->length();
41  long ndim = it->ndim() - 1;
42  desc += var_name;
43  if ( it->hasIndex() || it->length() > 1 ) {
44  desc += '[';
45  }
46  if ( it->hasIndex() ) {
47  std::string ind_blk, ind_var;
48  RootHistCnv::parseName( it->index(), ind_blk, ind_var );
49  if ( ind_blk != block_name ) {
50  std::cerr << "ERROR: Index for CWNT variable " << ind_var << " is in a different block: " << ind_blk << std::endl;
51  }
52  desc += ind_var;
53  } else if ( it->dim( ndim ) > 1 ) {
54  desc += std::to_string( it->dim( ndim ) );
55  }
56 
57  for ( int i = ndim - 1; i >= 0; i-- ) {
58  desc += "][";
59  desc += std::to_string( it->dim( i ) );
60  }
61  if ( it->hasIndex() || it->length() > 1 ) {
62  desc += ']';
63  }
64 
65  if ( it->range().lower() != it->range().min() && it->range().upper() != it->range().max() ) {
66  lowerRange = it->range().lower();
67  upperRange = it->range().upper();
68  } else {
69  lowerRange = 0;
70  upperRange = -1;
71  }
72  desc += typ;
73  size += item_size * dimension;
74 }
virtual const std::string & name() const =0
Access _Item name.
virtual const ItemRange & range() const =0
Access the range if specified.
bool parseName(const std::string &full, std::string &blk, std::string &var)
Definition: RNTupleCnv.cpp:246
T to_string(T...args)
T endl(T...args)
STL class.
virtual long ndim() const =0
Dimension.
virtual long length() const =0
Access the buffer length.
virtual const std::string & index() const =0
Access the index _Item.
virtual long dim(long i) const =0
Access individual dimensions.
virtual bool hasIndex() const =0
Is the tuple have an index item?