RCWNTupleCnv.cpp File Reference
#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 30 of file RCWNTupleCnv.cpp.

39 {
40 
41  RootHistCnv::parseName(it->name(),block_name,var_name);
42 
43  //long item_size = (sizeof(T) < 4) ? 4 : sizeof(T);
44  long item_size = sizeof(T);
45  long dimension = it->length();
46  long ndim = it->ndim()-1;
47  desc += var_name;
48  if ( it->hasIndex() || it->length() > 1 ) {
49  desc += '[';
50  }
51  if ( it->hasIndex() )
52  {
53  std::string ind_blk, ind_var;
54  RootHistCnv::parseName(it->index(),ind_blk,ind_var);
55  if (ind_blk != block_name) {
56  std::cerr << "ERROR: Index for CWNT variable " << ind_var
57  << " is in a different block: " << ind_blk << std::endl;
58  }
59  desc += ind_var;
60  }
61  else if ( it->dim(ndim) > 1 ) {
62  desc += std::to_string(it->dim(ndim));
63  }
64 
65  for ( int i = ndim-1; i>=0; i-- ){
66  desc += "][";
67  desc += std::to_string(it->dim(i));
68  }
69  if ( it->hasIndex() || it->length() > 1 ) {
70  desc += ']';
71  }
72 
73  if (it->range().lower() != it->range().min() &&
74  it->range().upper() != it->range().max() ) {
75  lowerRange = it->range().lower();
76  upperRange = it->range().upper();
77  } else {
78  lowerRange = 0;
79  upperRange = -1;
80  }
81  desc += typ;
82  size += item_size * dimension;
83 }
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:244
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?