All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NTuple.h
Go to the documentation of this file.
1 // $Id: NTuple.h,v 1.23 2008/10/27 19:22:20 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIKERNEL_NTUPLE_H
4 #define GAUDIKERNEL_NTUPLE_H
5 // ============================================================================
6 // STL include files
7 // ============================================================================
8 #include <string>
9 #include <limits>
10 #include <cfloat>
11 #include <stdexcept>
12 // ============================================================================
13 // Framework include files
14 // ============================================================================
16 #include "GaudiKernel/DataObject.h"
17 #include "GaudiKernel/INTuple.h"
20 // ============================================================================
21 // Forward declarations
22 // ============================================================================
23 class NTupleFile;
24 class NTupleDirectory;
25 // ============================================================================
34 namespace NTuple
35 {
36  // local forward declarations
37  template <class TYP> class Range;
38  template <class TYP> class _Data;
39  template <class TYP> class _Item;
40  template <class TYP> class _Array;
41  template <class TYP> class _Matrix;
42  template <class TYP> class _Accessor;
43  template <class TYP> class Item;
44  template <class TYP> class Array;
45  template <class TYP> class Matrix;
46  // ==========================================================================
48  template <class TYP>
49  class Range {
51  /*const*/ TYP m_lower;
53  /*const*/ TYP m_upper;
54  public:
56  Range(const TYP low, const TYP upper) : m_lower(low), m_upper(upper) {
57  }
59  Range(const Range<TYP>& copy) : m_lower(copy.m_lower),
60  m_upper(copy.m_upper) {
61  }
63  Range& operator=(const Range<TYP>& copy) {
64  m_lower = copy.m_lower;
65  m_upper = copy.m_upper;
66  return *this;
67  }
69  virtual ~Range() { }
71  TYP lower() const { return m_lower; }
73  TYP upper() const { return m_upper; }
75  TYP distance() const { return m_upper-m_lower; }
77  static TYP min() { return std::numeric_limits<TYP>::min() ; }
79  static TYP max() { return std::numeric_limits<TYP>::max() ; }
80  };
81  // ==========================================================================
82  template <> class Range<bool>
83  {
84  public:
86  Range(const bool /* low */ , const bool /* upper */ ) {}
88  Range(const Range<bool>& /* copy */ ) {}
90  virtual ~Range() { }
92  bool lower() const { return false; }
94  bool upper() const { return true; }
96  bool distance() const { return true; }
98  static bool min() { return false; }
100  static bool max() { return true; }
101  };
102  // ==========================================================================
103  template <>
104  inline IOpaqueAddress*
106  template <>
107  inline IOpaqueAddress*
108  Range<IOpaqueAddress* >::max() { return (IOpaqueAddress*)0xffffffff ; }
109  // ==========================================================================
112  template <class TYP> class GAUDI_API _Data : virtual public INTupleItem {
113  protected:
115  TYP* m_buffer;
116  public:
120  virtual void setDefault(const TYP d) = 0;
122  virtual const ItemRange& range() const = 0;
123  };
124  // ==========================================================================
127  template <class TYP> class GAUDI_API _Item : virtual public _Data<TYP> {
128  public:
130  virtual ~_Item() {}
132  static _Item* create(INTuple* tup,
133  const std::string& name,
134  const std::type_info& info,
135  TYP min,
136  TYP max,
137  TYP def);
139  template <class T>
140  _Item<TYP>& operator=(const _Item<T>& copy) {
141  *this->m_buffer = copy.get();
142  return *this;
143  }
145  void set(const TYP& item) { *this->m_buffer = item; }
147  virtual TYP get() const { return *this->m_buffer; }
148  };
149  // ==========================================================================
152  template <class TYP> class GAUDI_API _Array : virtual public _Data<TYP> {
153  public:
155  static _Array* create(INTuple* tup,
156  const std::string& name,
157  const std::type_info& info,
158  const std::string& index,
159  long len,
160  TYP min,
161  TYP max,
162  TYP def);
164  template <class T>
166  long len = this->length();
167  if ( len == copy.length() ) {
168  const T* source = (const T*)copy.buffer();
169  for ( int i = 0; i < len; i++ ) {
170  *(this->m_buffer + i) = *(source + i);
171  }
172  return *this;
173  }
174  throw std::out_of_range
175  ("N-tuple matrix cannot be copied! The index range does not match!");
176  return *this;
177  }
179  const TYP& data(long i) const { return *(this->m_buffer + i); }
181  TYP& data(long i) { return *(this->m_buffer + i); }
182  };
183  // ==========================================================================
186  template <class TYP> class GAUDI_API _Matrix : virtual public _Data<TYP> {
187  protected:
189  long m_rows;
190  public:
192  static _Matrix* create(INTuple* tup,
193  const std::string& name,
194  const std::type_info& info,
195  const std::string& index,
196  long ncol,
197  long nrow,
198  TYP min,
199  TYP max,
200  TYP def);
202  template <class T>
204  long len = this->length();
205  if ( len == copy.length() ) {
206  const T* source = (const T*)copy.buffer();
207  for ( int i = 0; i < len; i++ ) {
208  *(this->m_buffer + i) = *(source + i);
209  }
210  return *this;
211  }
212  throw std::out_of_range
213  ("N-tuple matrix cannot be copied! The index range does not match!");
214  return *this;
215  }
217  TYP* column(long i) { return (this->m_buffer + i*m_rows); }
219  const TYP* column(long i) const { return (this->m_buffer + i*m_rows); }
220  };
221  // ==========================================================================
224  template <class TYP> class _Accessor {
225  friend class Tuple;
226  private:
228  return *this;
229  }
230  protected:
232  mutable TYP* m_ptr;
233  public:
235  _Accessor() : m_ptr(0) { }
237  virtual ~_Accessor() { }
239  bool operator !() const { return m_ptr != 0; }
241  operator const void*() const { return m_ptr; }
243  TYP* operator->() { return m_ptr; }
245  const TYP* operator->() const { return m_ptr; }
247  const Range<TYP>& range() const { return m_ptr->range(); }
248  };
249  // ==========================================================================
252  template <class TYP> class Item : virtual public _Accessor< _Item<TYP> > {
253  typedef Item<TYP> _My;
254  public:
256  Item() { }
258  operator const TYP () const { return this->m_ptr->get(); }
260  TYP operator*() { return this->m_ptr->get(); }
262  const TYP operator*() const { return this->m_ptr->get(); }
263  // Arithmetic operators defined on NTuple column entries
264  Item& operator ++ () { return *this += TYP(1); }
265  Item& operator ++ (int) { return *this += TYP(1); }
266  Item& operator -- () { return *this -= TYP(1); }
267  Item& operator -- (int) { return *this -= TYP(1); }
269  Item& operator=(const TYP data) {
270  this->m_ptr->set( data );
271  return *this;
272  }
274  template<class T>
275  Item& operator=(const Item<T>& data) {
276  this->m_ptr->set( data->get() );
277  return *this;
278  }
279  Item<TYP>& operator += (const TYP data) {
280  this->m_ptr->set ( this->m_ptr->get() + data );
281  return *this;
282  }
283  Item<TYP>& operator -= (const TYP data) {
284  this->m_ptr->set ( this->m_ptr->get() - data );
285  return *this;
286  }
287  Item<TYP>& operator *= (const TYP data) {
288  this->m_ptr->set ( this->m_ptr->get() * data );
289  return *this;
290  }
291  Item<TYP>& operator /= (const TYP data) {
292  this->m_ptr->set ( this->m_ptr->get() / data );
293  return *this;
294  }
295  };
296  // ==========================================================================
299  template <> class Item<bool> : virtual public _Accessor< _Item<bool> > {
300  typedef Item<bool> _My;
301  public:
303  Item() { }
305  operator bool () const { return this->m_ptr->get(); }
307  Item& operator=(const bool data) {
308  this->m_ptr->set( data );
309  return *this;
310  }
312  template<class T>
313  Item& operator=(const Item<T>& data) {
314  this->m_ptr->set( data->get() );
315  return *this;
316  }
317  };
318  // ==========================================================================
321  template <class TYP> class Array : virtual public _Accessor < _Array<TYP> > {
322  public:
324  Array() { }
326  template <class T>
327  Array& operator=(const Array<T>& copy) {
328  *(this->m_ptr) = *(copy.operator->());
329  return *this;
330  }
332  template <class T>
333  TYP& operator[] (const T i) { return this->m_ptr->data(i); }
335  template <class T>
336  const TYP& operator[] (const T i) const { return this->m_ptr->data(i); }
337  virtual ~Array() {}
338  };
339  // =========================================================================
342  template <class TYP> class Matrix : virtual public _Accessor< _Matrix<TYP> > {
343  public:
345  Matrix() { }
347  template <class T>
348  Matrix& operator=(const Matrix<T>& copy) {
349  *(this->m_ptr) = *(copy.operator->());
350  return *this;
351  }
353  template <class T>
354  TYP* operator[] (const T i) { return this->m_ptr->column(i); }
356  template <class T>
357  const TYP* operator[] (const T i) const { return this->m_ptr->column(i); }
358  virtual ~Matrix() {}
359  };
360  // =========================================================================
367  class Tuple : public DataObject, virtual public INTuple {
368 
369  protected:
371  template <class TYPE> StatusCode i_item(const std::string& name,
372  _Item<TYPE>*& result) const {
373  try {
374  result = dynamic_cast< _Item<TYPE>* > (i_find(name));
375  }
376  catch (...) {
377  result = 0;
378  }
379  return (0==result) ? StatusCode::FAILURE : StatusCode::SUCCESS;
380  }
382  template <class TYPE> StatusCode i_item(const std::string& name,
383  _Item<TYPE*>*& result) const {
384  try {
385  _Item<void*>* p = dynamic_cast< _Item<void*>* > (i_find(name));
386  result = (_Item<TYPE*>*)p;
387  }
388  catch (...) {
389  result = 0;
390  }
391  return (0==result) ? StatusCode::FAILURE : StatusCode::SUCCESS;
392  }
394  StatusCode i_item(const std::string& name,
395  _Item<IOpaqueAddress*>*& result) const {
396  try {
397  result = dynamic_cast< _Item<IOpaqueAddress*>* > (i_find(name));
398  }
399  catch (...) {
400  result = 0;
401  }
402  return (0==result) ? StatusCode::FAILURE : StatusCode::SUCCESS;
403  }
405  template <class TYPE> StatusCode i_item(const std::string& name,
406  _Array<TYPE>*& result) const {
407  try {
408  if ( clID() == CLID_ColumnWiseTuple ) {
409  result = dynamic_cast< _Array<TYPE>* > (i_find(name));
410  }
411  }
412  catch (...) {
413  result = 0;
414  }
415  return (0==result) ? StatusCode::FAILURE : StatusCode::SUCCESS;
416  }
418  template <class TYPE> StatusCode i_item(const std::string& name,
419  _Matrix<TYPE>*& result) const {
420  try {
421  if ( clID() == CLID_ColumnWiseTuple ) {
422  result = dynamic_cast< _Matrix<TYPE>* > (i_find(name));
423  }
424  }
425  catch (...) {
426  result = 0;
427  }
428  return (0==result) ? StatusCode::FAILURE : StatusCode::SUCCESS;
429  }
431  template <class TYPE>
432  StatusCode i_addItem(const std::string& name,
433  long,
434  const std::string&,
435  TYPE low,
436  TYPE high,
437  _Item<TYPE>*& result) {
438  if ( !i_find(name) ) {
439  TYPE nil;
440  nil = 0;
441  return add( result = _Item<TYPE>::create(this, name, typeid(TYPE), low, high, nil) );
442  }
443  return StatusCode::FAILURE;
444  }
446  template <class TYPE>
447  StatusCode i_addItem(const std::string& name,
448  long dim,
449  const std::string& index,
450  TYPE low,
451  TYPE high,
452  _Array<TYPE>*& result) {
453  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
454  return add( result = _Array<TYPE>::create(this,
455  name,
456  typeid(TYPE),
457  index,
458  dim,
459  low,
460  high,
461  TYPE(0)) );
462  }
463  return StatusCode::FAILURE;
464  }
466  template <class TYPE>
467  StatusCode i_addItem(const std::string& name,
468  long dim1,
469  long dim2,
470  const std::string& index,
471  TYPE low,
472  TYPE high,
473  _Matrix<TYPE>*& result) {
474  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
475  return add( result = _Matrix<TYPE>::create(this,
476  name,
477  typeid(TYPE),
478  index,
479  dim1,
480  dim2,
481  low,
482  high,
483  TYPE(0)) );
484  }
485  return StatusCode::FAILURE;
486  }
487  template <class TYPE> StatusCode
488  i_addObject(const std::string& name,_Item<TYPE*>*& result,const std::type_info& /* typ */) {
489  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
490  return add( result = (_Item<TYPE*>*)_Item<void*>::create(this, name, typeid(TYPE),0,0,0) );
491  }
492  return StatusCode::FAILURE;
493  }
494 
495  public:
497  virtual ~Tuple() {
498  }
500  template <class TYPE> StatusCode item(const std::string& name,
501  Item<TYPE>& result)
502  {
503  return i_item(name, result.m_ptr);
504  }
506  template <class TYPE> StatusCode item(const std::string& name,
507  const Item<TYPE>& result) const
508  {
509  return i_item(name, result.m_ptr);
510  }
512  template <class TYPE> StatusCode
513  item(const std::string& name, Array<TYPE>& result)
514  {
515  return i_item(name, result.m_ptr);
516  }
518  template <class TYPE> StatusCode item(const std::string& name,
519  const Array<TYPE>& result) const
520  {
521  return i_item(name, result.m_ptr);
522  }
524  template <class TYPE> StatusCode item(const std::string& name,
525  Matrix<TYPE>& result)
526  {
527  return i_item(name, result.m_ptr);
528  }
529 
531  template <class TYPE> StatusCode item( const std::string& name,
532  const Matrix<TYPE>& result) const
533  {
534  return i_item(name, result.m_ptr);
535  }
536 
550  template <class TYPE> StatusCode
551  addItem(const std::string& name, Item<TYPE>& itm) {
552  typedef Range<TYPE> _R;
553  return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
554  }
555 
564  template <class TYPE> StatusCode
565  addItem(const std::string& name, Item<TYPE*>& itm) {
566  return i_addObject(name,itm.m_ptr,typeid(TYPE));
567  }
568 
577  StatusCode
578  addItem(const std::string& name, Item<IOpaqueAddress*>& itm) {
579  typedef Range<IOpaqueAddress*> _R;
580  return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
581  }
582 
600  template <class TYPE, class RANGE> StatusCode
601  addItem(const std::string& name,
602  Item<TYPE>& itm,
603  const RANGE low,
604  const RANGE high)
605  {
606  return i_addItem( name, 1, "", TYPE(low), TYPE(high), itm.m_ptr);
607  }
608 
622  template <class TYPE> StatusCode
623  addItem(const std::string& name,
624  long dim,
626  {
627  return i_addItem(name,
628  dim,
629  "",
632  array.m_ptr);
633  }
634 
654  template <class TYPE, class RANGE> StatusCode
655  addItem(const std::string& name,
656  long dim,
658  const RANGE low,
659  const RANGE high)
660  {
661  return i_addItem(name,
662  dim,
663  "",
664  TYPE(low),
665  TYPE(high),
666  array.m_ptr);
667  }
668 
699  template <class TYPE, class INDEX, class RANGE> StatusCode
700  addItem(const std::string& name,
701  Item<INDEX>& index,
703  const RANGE low,
704  const RANGE high)
705  {
706  return i_addItem( name,
707  index->range().distance(),
708  index->name(),
709  TYPE(low),
710  TYPE(high),
711  array.m_ptr);
712  }
713 
739  template <class TYPE, class INDEX, class RANGE> StatusCode
740  addIndexedItem( const std::string& name,
741  Item<INDEX>& index,
743  const RANGE low,
744  const RANGE high)
745  {
746  return i_addItem( name,
747  index->range().distance(),
748  index->name(),
749  TYPE(low),
750  TYPE(high),
751  array.m_ptr);
752  }
753 
778  template <class TYPE, class INDEX> StatusCode
779  addItem(const std::string& name,
780  Item<INDEX>& index,
782  {
783  return i_addItem( name,
784  index->range().distance(),
785  index->name(),
788  array.m_ptr);
789  }
790 
810  template <class TYPE, class INDEX> StatusCode
811  addIndexedItem( const std::string& name,
812  Item<INDEX>& index,
814  {
815  return i_addItem( name,
816  index->range().distance(),
817  index->name(),
820  array.m_ptr);
821  }
822 
840  template <class TYPE> StatusCode
841  addItem(const std::string& name,
842  long cols,
843  long rows,
844  Matrix<TYPE>& matrix)
845  {
846  return i_addItem(name,
847  cols,
848  rows,
849  "",
852  matrix.m_ptr);
853  }
854 
877  template <class TYPE, class RANGE> StatusCode
878  addItem(const std::string& name,
879  long cols,
880  long rows,
881  Matrix<TYPE>& result,
882  const RANGE low,
883  const RANGE high)
884  {
885  return i_addItem(name,
886  cols,
887  rows,
888  "",
889  TYPE(low),
890  TYPE(high),
891  result.m_ptr);
892  }
893 
919  template <class TYPE, class INDEX> StatusCode
920  addItem(const std::string& name,
921  Item<INDEX>& index,
922  Matrix<TYPE>& matrix,
923  long rows)
924  {
925  return i_addItem( name,
926  index->range().distance(),
927  rows,
928  index->name(),
931  matrix.m_ptr);
932  }
933 
954  template <class TYPE, class INDEX> StatusCode
955  addIndexedItem( const std::string& name,
956  Item<INDEX>& col_index,
957  long rows,
958  Matrix<TYPE>& matrix)
959  {
960  return i_addItem( name,
961  col_index->range().distance(),
962  rows,
963  col_index->name(),
966  matrix.m_ptr);
967  }
968 
1001  template <class TYPE, class INDEX, class RANGE> StatusCode
1002  addItem(const std::string& name,
1003  Item<INDEX>& index,
1004  Matrix<TYPE>& matrix,
1005  long rows,
1006  const RANGE low,
1007  const RANGE high)
1008  {
1009  return i_addItem( name,
1010  index->range().distance(),
1011  rows,
1012  index->name(),
1013  TYPE(low),
1014  TYPE(high),
1015  matrix.m_ptr);
1016  }
1017 
1045  template <class TYPE, class INDEX, class RANGE> StatusCode
1046  addIndexedItem( const std::string& name,
1047  Item<INDEX>& index,
1048  long rows,
1049  Matrix<TYPE>& matrix,
1050  const RANGE low,
1051  const RANGE high)
1052  {
1053  return i_addItem( name,
1054  index->range().distance(),
1055  rows,
1056  index->name(),
1057  TYPE(low),
1058  TYPE(high),
1059  matrix.m_ptr);
1060  }
1061  };
1062 
1065  class Directory : public DataObject {
1066  public:
1069  }
1071  virtual ~Directory() {
1072  }
1074  static const CLID& classID() {
1075  return CLID_NTupleDirectory;
1076  }
1078  virtual const CLID& clID() const {
1079  return classID();
1080  }
1081  };
1082 
1085  class File : public Directory {
1086  protected:
1088  std::string m_name;
1090  std::string m_logName;
1092  long m_type;
1094  bool m_isOpen;
1095  public:
1096  File() : m_type(0), m_isOpen(false) {
1097  }
1099  File(long type, const std::string name, const std::string& logName)
1100  : m_name(name), m_logName(logName), m_type(type), m_isOpen(false) {
1101  }
1103  virtual ~File() {
1104  }
1106  static const CLID& classID() {
1107  return CLID_NTupleFile;
1108  }
1110  virtual const CLID& clID() const {
1111  return classID();
1112  }
1114  void setType(const long typ) {
1115  m_type = typ;
1116  }
1118  long type() const {
1119  return m_type;
1120  }
1122  const std::string& name() const {
1123  return m_name;
1124  }
1126  void setName(const std::string& nam) {
1127  m_name = nam;
1128  }
1130  const std::string& logicalName() const {
1131  return m_logName;
1132  }
1134  void setLogicalName( const std::string& l) {
1135  m_logName = l;
1136  }
1138  void setOpen(bool flag) {
1139  m_isOpen = flag;
1140  }
1142  bool isOpen() const {
1143  return m_isOpen;
1144  }
1145  };
1146  // =========================================================================
1147  // inhibit certain types by defining specialized templates which do not
1148  // allow for construction.
1149  template <>
1151  {
1152  private:
1153  Array(){}
1154  public:
1155  virtual ~Array() {}
1156  virtual void dummy() = 0;
1157  };
1158  template <>
1160  {
1161  private:
1163  public:
1164  virtual ~Matrix() {}
1165  virtual void dummy() = 0;
1166  };
1167  // =========================================================================
1168 #ifndef ALLOW_ALL_TYPES
1169 #else
1170  typedef Item<bool> BoolItem;
1171  typedef Item<char> CharItem;
1172  typedef Item<unsigned char> UCharItem;
1173  typedef Item<short> ShortItem;
1174  typedef Item<unsigned short> UShortItem;
1175  typedef Item<long> LongItem;
1176  typedef Item<long long> LongLongItem;
1177  typedef Item<unsigned long> ULongItem;
1178  typedef Item<unsigned long long> ULongLongItem;
1179  typedef Item<int> IntItem;
1180  typedef Item<unsigned int> UIntItem;
1181  typedef Item<float> FloatItem;
1182  typedef Item<double> DoubleItem;
1183  typedef Array<bool> BoolArray;
1184  typedef Array<char> CharArray;
1185  typedef Array<unsigned char> UCharArray;
1186  typedef Array<short> ShortArray;
1187  typedef Array<unsigned short> UShortArray;
1188  typedef Array<long> LongArray;
1189  typedef Array<unsigned long> ULongArray;
1190  typedef Array<int> IntArray;
1191  typedef Array<unsigned int> UIntArray;
1192  typedef Array<float> FloatArray;
1193  typedef Array<double> DoubleArray;
1194  typedef Matrix<bool> BoolMatrix;
1195  typedef Matrix<char> CharMatrix;
1196  typedef Matrix<unsigned char> UCharMatrix;
1197  typedef Matrix<short> ShortMatrix;
1198  typedef Matrix<unsigned short> UShortMatrix;
1199  typedef Matrix<long> LongMatrix;
1200  typedef Matrix<unsigned long> ULongMatrix;
1201  typedef Matrix<int> IntMatrix;
1202  typedef Matrix<unsigned int> UIntMatrix;
1203  typedef Matrix<float> FloatMatrix;
1204  typedef Matrix<double> DoubleMatrix;
1205 #endif
1206 
1207  template <class T>
1208  inline std::ostream& operator<<(std::ostream& s, const Item<T>& obj)
1209  {
1210  return s << T(obj);
1211  }
1212 } // end of namespace NTuple
1213 
1214 // Useful:
1218 
1219 #endif // GAUDIKERNEL_NTUPLE_H
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:1002
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1122
bool lower() const
Lower boundary of range.
Definition: NTuple.h:92
void setLogicalName(const std::string &l)
Definition: NTuple.h:1134
Item< bool > _My
Definition: NTuple.h:300
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:291
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:279
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1138
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
void setName(const std::string &nam)
Set access type.
Definition: NTuple.h:1126
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:51
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
Definition: NTuple.h:779
tuple itm
Definition: ana.py:57
std::string m_logName
Logical file name.
Definition: NTuple.h:1090
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:700
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, long rows, Matrix< TYPE > &matrix, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:1046
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:41
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:45
StatusCode i_item(const std::string &name, _Item< TYPE > *&result) const
Locate a _Column of data to the N tuple type safe.
Definition: NTuple.h:371
StatusCode i_addItem(const std::string &name, long dim1, long dim2, const std::string &index, TYPE low, TYPE high, _Matrix< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:467
long m_type
Access type.
Definition: NTuple.h:1092
Abstract class describing a column in a N tuple.
Definition: NTuple.h:39
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:118
TYP & operator[](const T i)
Array operator.
Definition: NTuple.h:333
virtual ~Array()
Definition: NTuple.h:337
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1217
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:165
StatusCode item(const std::string &name, const Item< TYPE > &result) const
Locate a scalar Item of data to the N tuple type safe (CONST)
Definition: NTuple.h:506
static TYP min()
Minimal number of data.
Definition: NTuple.h:77
TYP * operator->()
Dereference operator.
Definition: NTuple.h:243
StatusCode item(const std::string &name, const Matrix< TYPE > &result) const
Locate a Matrix of data to the N tuple type safe (CONST)
Definition: NTuple.h:531
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:262
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &matrix)
Add an fixed size Matrix of data to a column wise N tuple.
Definition: NTuple.h:841
StatusCode item(const std::string &name, const Array< TYPE > &result) const
Locate a Array of data to the N tuple type safe (CONST)
Definition: NTuple.h:518
Item & operator--()
Definition: NTuple.h:266
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:217
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:203
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1215
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:740
virtual ~Matrix()
Definition: NTuple.h:358
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:247
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:147
long type() const
Return access type.
Definition: NTuple.h:1118
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:920
Item()
Standard Constructor.
Definition: NTuple.h:256
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1106
void set(const TYP &item)
Access to data by reference.
Definition: NTuple.h:145
NTuple interface class definition.
Definition: INTuple.h:80
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:348
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &col_index, long rows, Matrix< TYPE > &matrix)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:955
virtual ~Range()
Destructor.
Definition: NTuple.h:69
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
Definition: NTuple.h:811
StatusCode i_item(const std::string &name, _Matrix< TYPE > *&result) const
Locate a _Matrix of data to the N tuple type safe.
Definition: NTuple.h:418
Item()
Standard Constructor.
Definition: NTuple.h:303
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:283
NTuple interface class definition.
Definition: INTuple.h:27
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:42
static bool max()
Maximal number of data.
Definition: NTuple.h:100
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Matrix()
Standard Constructor.
Definition: NTuple.h:345
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:140
StatusCode addItem(const std::string &name, Item< TYPE > &itm, const RANGE low, const RANGE high)
Add a scalar data item a N tuple with a range.
Definition: NTuple.h:601
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &result, const RANGE low, const RANGE high)
Add an fixed size Matrix of data to a column wise N tuple.
Definition: NTuple.h:878
static TYP max()
Maximal number of data.
Definition: NTuple.h:79
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:313
bool upper() const
Upper boundary of range.
Definition: NTuple.h:94
Array()
Standard Constructor.
Definition: NTuple.h:324
virtual const CLID & clID() const
class ID of the object
Definition: NTuple.h:1110
std::string m_name
Physical file name.
Definition: NTuple.h:1088
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:488
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:299
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array)
Add an fixed-size Array of data to a column wise N tuple.
Definition: NTuple.h:623
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:73
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:38
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:1142
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
StatusCode addItem(const std::string &name, Item< IOpaqueAddress * > &itm)
Add an address object item to an N tuple: specialized call.
Definition: NTuple.h:578
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:59
virtual ~_Item()
Destructor.
Definition: NTuple.h:130
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:367
virtual ~File()
Standard destructor.
Definition: NTuple.h:1103
bool operator!() const
Check if column is present.
Definition: NTuple.h:239
void setType(const long typ)
Set access type.
Definition: NTuple.h:1114
dictionary l
Definition: gaudirun.py:365
bool m_isOpen
Flag to indicate wether the file was opened already.
Definition: NTuple.h:1094
#define min(a, b)
std::vector< Row > Matrix
Definition: Vector.h:23
virtual const CLID & clID() const
class ID of the object
Definition: NTuple.h:1078
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:75
TYP * m_ptr
Pointer to instance.
Definition: NTuple.h:232
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:565
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:219
StatusCode i_addItem(const std::string &name, long dim, const std::string &index, TYPE low, TYPE high, _Array< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:447
Item< TYP > _My
Definition: NTuple.h:253
virtual ~_Accessor()
Standard Destructor.
Definition: NTuple.h:237
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:307
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:513
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:275
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:179
File(long type, const std::string name, const std::string &logName)
Standard constructor.
Definition: NTuple.h:1099
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:354
virtual INTupleItem * i_find(const std::string &name) const =0
Internally used by abstract classes.
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:269
string s
Definition: gaudirun.py:210
tuple item
print s1,s2
Definition: ana.py:146
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:68
long m_rows
Number of rows per column.
Definition: NTuple.h:189
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:53
Class defining a range.
Definition: NTuple.h:37
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:88
TYP * m_buffer
Pointer to data buffer.
Definition: NTuple.h:115
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1216
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:287
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:327
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:245
virtual ~Range()
Destructor.
Definition: NTuple.h:90
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:86
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition: NTuple.h:500
Directory()
Standard constructor.
Definition: NTuple.h:1068
Opaque address interface definition.
StatusCode i_item(const std::string &name, _Item< TYPE * > *&result) const
Locate a _Column of data to the N tuple type unsafe for objects.
Definition: NTuple.h:382
NamedRange_< CONTAINER > range(const CONTAINER &cnt, const std::string &name)
simple function to create the named range form arbitrary container
Definition: NamedRange.h:133
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an fixed-size Array of data to a column wise N tuple with a range.
Definition: NTuple.h:655
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:43
StatusCode i_item(const std::string &name, _Item< IOpaqueAddress * > *&result) const
Locate a _Column of data to the N tuple type safe.
Definition: NTuple.h:394
_Accessor()
Standard Constructor.
Definition: NTuple.h:235
Range(const TYP low, const TYP upper)
Standard constructor.
Definition: NTuple.h:56
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:44
static bool min()
Minimal number of data.
Definition: NTuple.h:98
#define GAUDI_API
Definition: Kernel.h:108
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1065
list i
Definition: ana.py:128
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:227
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:96
Item & operator++()
Definition: NTuple.h:264
StatusCode item(const std::string &name, Matrix< TYPE > &result)
Locate a Matrix of data to the N tuple type safe.
Definition: NTuple.h:524
virtual ~Directory()
Standard destructor.
Definition: NTuple.h:1071
const std::string & logicalName() const
Definition: NTuple.h:1130
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:260
virtual ~Tuple()
Standard destructor.
Definition: NTuple.h:497
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:71
StatusCode i_item(const std::string &name, _Array< TYPE > *&result) const
Locate a _Array of data to the N tuple type safe.
Definition: NTuple.h:405
StatusCode i_addItem(const std::string &name, long, const std::string &, TYPE low, TYPE high, _Item< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:432
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:181
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:63
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1085
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1074
virtual long length() const =0
Access the buffer length.
virtual const void * buffer() const =0
Access data buffer (CONST)
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:40