All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RCWNTupleCnv.cpp File Reference
#include "GaudiKernel/xtoa.h"
#include "GaudiKernel/INTupleSvc.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/NTuple.h"
#include <cstdio>
#include <utility>
#include <list>
#include <vector>
#include "RCWNTupleCnv.h"
#include "TTree.h"
#include "TLeafI.h"
#include "TLeafF.h"
#include "TLeafD.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.

40 {
41 
42  std::string full_name = it->name();
43  RootHistCnv::parseName(full_name,block_name,var_name);
44 
45  //long item_size = (sizeof(T) < 4) ? 4 : sizeof(T);
46  long item_size = sizeof(T);
47  long dimension = it->length();
48  long ndim = it->ndim()-1;
49  std::ostringstream text;
50  text << var_name;
51  if ( it->hasIndex() || it->length() > 1 ) {
52  text << '[';
53  }
54  if ( it->hasIndex() )
55  {
56  std::string ind_blk, ind_var;
57  std::string ind = it->index();
58  RootHistCnv::parseName(ind,ind_blk,ind_var);
59  if (ind_blk != block_name) {
60  std::cerr << "ERROR: Index for CWNT variable " << ind_var
61  << " is in a different block: " << ind_blk << std::endl;
62  }
63  text << ind_var;
64  }
65  else if ( it->dim(ndim) > 1 ) {
66  text << it->dim(ndim);
67  }
68 
69  for ( int i = ndim-1; i>=0; i-- ){
70  text << "][" << it->dim(i);
71  }
72  if ( it->hasIndex() || it->length() > 1 ) {
73  text << ']';
74  }
75 
76  if (it->range().lower() != it->range().min() &&
77  it->range().upper() != it->range().max() ) {
78  lowerRange = (long) it->range().lower();
79  upperRange = (long) it->range().upper();
80  } else {
81  lowerRange = 0;
82  upperRange = -1;
83  }
84  text << typ;
85 
86  desc += text.str();
87  size += item_size * dimension;
88 }
virtual const ItemRange & range() const =0
Access the range if specified.
virtual bool hasIndex() const =0
Is the tuple have an index item?
virtual const std::string & name() const =0
Access _Item name.
virtual long dim(long i) const =0
Access individual dimensions.
virtual long ndim() const =0
Dimension.
list i
Definition: ana.py:128
bool parseName(std::string full, std::string &blk, std::string &var)
Definition: RNTupleCnv.cpp:251
virtual const std::string & index() const =0
Access the index _Item.
virtual long length() const =0
Access the buffer length.