Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
NTuple.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_NTUPLE_H
12 #define GAUDIKERNEL_NTUPLE_H
13 // ============================================================================
14 // Framework include files
15 // ============================================================================
16 #include "GaudiKernel/DataObject.h"
18 #include "GaudiKernel/INTuple.h"
21 // ============================================================================
22 // STL include files
23 // ============================================================================
24 #include <algorithm>
25 #include <cfloat>
26 #include <limits>
27 #include <stdexcept>
28 #include <string>
29 // ============================================================================
30 // Forward declarations
31 // ============================================================================
32 class NTupleFile;
33 class NTupleDirectory;
34 // ============================================================================
43 namespace NTuple {
44  // local forward declarations
45  template <class TYP>
46  class Range;
47  template <class TYP>
48  class _Data;
49  template <class TYP>
50  class _Item;
51  template <class TYP>
52  class _Array;
53  template <class TYP>
54  class _Matrix;
55  template <class TYP>
56  class _Accessor;
57  template <class TYP>
58  class Item;
59  template <class TYP>
60  class Array;
61  template <class TYP>
62  class Matrix;
63  // ==========================================================================
65  template <class TYP>
66  class Range {
68  /*const*/ TYP m_lower;
70  /*const*/ TYP m_upper;
71 
72  public:
74  Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
76  Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
78  Range& operator=( const Range<TYP>& copy ) {
79  m_lower = copy.m_lower;
80  m_upper = copy.m_upper;
81  return *this;
82  }
84  virtual ~Range() = default;
86  TYP lower() const { return m_lower; }
88  TYP upper() const { return m_upper; }
90  TYP distance() const { return m_upper - m_lower; }
92  static TYP min() { return std::numeric_limits<TYP>::min(); }
94  static TYP max() { return std::numeric_limits<TYP>::max(); }
95  };
96  // ==========================================================================
97  template <>
98  class Range<bool> {
99  public:
101  Range( const bool /* low */, const bool /* upper */ ) {}
103  Range( const Range<bool>& /* copy */ ) {}
105  virtual ~Range() = default;
107  bool lower() const { return false; }
109  bool upper() const { return true; }
111  bool distance() const { return true; }
113  static bool min() { return false; }
115  static bool max() { return true; }
116  };
117  // ==========================================================================
118  template <>
120  return (IOpaqueAddress*)0x0;
121  }
122  template <>
124  return (IOpaqueAddress*)0xffffffff;
125  }
126  // ==========================================================================
129  template <class TYP>
130  class GAUDI_API _Data : virtual public INTupleItem {
131  protected:
133  TYP* m_buffer = nullptr;
134 
135  public:
139  virtual void setDefault( const TYP d ) = 0;
141  virtual const ItemRange& range() const = 0;
142  };
143  // ==========================================================================
146  template <class TYP>
147  class GAUDI_API _Item : virtual public _Data<TYP> {
148  public:
150  static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
151  TYP def );
153  template <class T>
154  _Item<TYP>& operator=( const _Item<T>& copy ) {
155  *this->m_buffer = copy.get();
156  return *this;
157  }
159  void set( const TYP& item ) { *this->m_buffer = item; }
161  virtual TYP get() const { return *this->m_buffer; }
162  };
163  // ==========================================================================
166  template <class TYP>
167  class GAUDI_API _Array : virtual public _Data<TYP> {
168  public:
170  static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
171  long len, TYP min, TYP max, TYP def );
173  template <class T>
174  _Array<TYP>& operator=( const _Array<T>& copy ) {
175  long len = this->length();
176  if ( len == copy.length() ) {
177  const T* source = (const T*)copy.buffer();
178  std::copy_n( source, len, this->m_buffer );
179  return *this;
180  }
181  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
182  return *this;
183  }
185  const TYP& data( long i ) const { return this->m_buffer[i]; }
187  TYP& data( long i ) { return this->m_buffer[i]; }
188 
189  TYP* begin() { return this->m_buffer; }
190  TYP* end() { return this->m_buffer + this->length(); }
191  };
192  // ==========================================================================
195  template <class TYP>
196  class GAUDI_API _Matrix : virtual public _Data<TYP> {
197  protected:
199  long m_rows;
200 
201  public:
203  static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
204  long ncol, long nrow, TYP min, TYP max, TYP def );
206  template <class T>
208  long len = this->length();
209  if ( len == copy.length() ) {
210  const T* source = (const T*)copy.buffer();
211  std::copy_n( source, len, this->m_buffer );
212  return *this;
213  }
214  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
215  return *this;
216  }
218  TYP* column( long i ) { return this->m_buffer + i * m_rows; }
220  const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
221  };
222  // ==========================================================================
225  template <class TYP>
226  class _Accessor {
227  friend class Tuple;
228 
229  private:
230  _Accessor<TYP>& operator=( const _Accessor<TYP>& ) { return *this; }
231 
232  protected:
234  mutable TYP* m_ptr = nullptr;
235 
236  public:
238  _Accessor() = default;
240  virtual ~_Accessor() = default;
242  _Accessor( const _Accessor& ) = default;
244  bool operator!() const { return m_ptr != 0; }
246  operator const void*() const { return m_ptr; }
248  TYP* operator->() { return m_ptr; }
250  const TYP* operator->() const { return m_ptr; }
252  const Range<TYP>& range() const { return m_ptr->range(); }
253  };
254  // ==========================================================================
257  template <class TYP>
258  class Item : virtual public _Accessor<_Item<TYP>> {
259  typedef Item<TYP> _My;
260 
261  public:
263  Item() = default;
265  operator const TYP() const { return this->m_ptr->get(); }
267  TYP operator*() { return this->m_ptr->get(); }
269  const TYP operator*() const { return this->m_ptr->get(); }
270  // Arithmetic operators defined on NTuple column entries
271  Item& operator++() { return *this += TYP( 1 ); }
272  Item& operator++( int ) { return *this += TYP( 1 ); }
273  Item& operator--() { return *this -= TYP( 1 ); }
274  Item& operator--( int ) { return *this -= TYP( 1 ); }
276  Item& operator=( const TYP data ) {
277  this->m_ptr->set( data );
278  return *this;
279  }
281  template <class T>
282  Item& operator=( const Item<T>& data ) {
283  this->m_ptr->set( data->get() );
284  return *this;
285  }
286  Item<TYP>& operator+=( const TYP data ) {
287  this->m_ptr->set( this->m_ptr->get() + data );
288  return *this;
289  }
290  Item<TYP>& operator-=( const TYP data ) {
291  this->m_ptr->set( this->m_ptr->get() - data );
292  return *this;
293  }
294  Item<TYP>& operator*=( const TYP data ) {
295  this->m_ptr->set( this->m_ptr->get() * data );
296  return *this;
297  }
298  Item<TYP>& operator/=( const TYP data ) {
299  this->m_ptr->set( this->m_ptr->get() / data );
300  return *this;
301  }
302  };
303  // ==========================================================================
306  template <>
307  class Item<bool> : virtual public _Accessor<_Item<bool>> {
308  typedef Item<bool> _My;
309 
310  public:
312  Item() = default;
314  operator bool() const { return this->m_ptr->get(); }
316  Item& operator=( const bool data ) {
317  this->m_ptr->set( data );
318  return *this;
319  }
321  template <class T>
322  Item& operator=( const Item<T>& data ) {
323  this->m_ptr->set( data->get() );
324  return *this;
325  }
326  };
327  // ==========================================================================
330  template <class TYP>
331  class Array : virtual public _Accessor<_Array<TYP>> {
332  public:
334  Array() = default;
336  template <class T>
337  Array& operator=( const Array<T>& copy ) {
338  *( this->m_ptr ) = *( copy.operator->() );
339  return *this;
340  }
342  template <class T>
343  TYP& operator[]( const T i ) {
344  return this->m_ptr->data( i );
345  }
347  template <class T>
348  const TYP& operator[]( const T i ) const {
349  return this->m_ptr->data( i );
350  }
351 
352  TYP* begin() { return this->m_ptr->begin(); }
353  TYP* end() { return this->m_ptr->end(); }
354  };
355  // =========================================================================
358  template <class TYP>
359  class Matrix : virtual public _Accessor<_Matrix<TYP>> {
360  public:
362  Matrix() = default;
364  template <class T>
365  Matrix& operator=( const Matrix<T>& copy ) {
366  *( this->m_ptr ) = *( copy.operator->() );
367  return *this;
368  }
370  template <class T>
371  TYP* operator[]( const T i ) {
372  return this->m_ptr->column( i );
373  }
375  template <class T>
376  const TYP* operator[]( const T i ) const {
377  return this->m_ptr->column( i );
378  }
379  };
380  // =========================================================================
387  class Tuple : public DataObject, virtual public INTuple {
388 
389  protected:
391  template <class TYPE>
392  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
393  try {
394  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
395  } catch ( ... ) { result = nullptr; }
396  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
397  }
399  template <class TYPE>
400  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
401  try {
402  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
403  result = (_Item<TYPE*>*)p;
404  } catch ( ... ) { result = nullptr; }
405  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
406  }
409  try {
410  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
411  } catch ( ... ) { result = nullptr; }
412  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
413  }
415  template <class TYPE>
416  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
417  try {
418  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
419  } catch ( ... ) { result = nullptr; }
420  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
421  }
423  template <class TYPE>
424  StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
425  try {
426  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
427  } catch ( ... ) { result = nullptr; }
428  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
429  }
431  template <class TYPE>
432  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
433  _Item<TYPE>*& result ) {
434  if ( !i_find( name ) ) {
435  TYPE nil;
436  nil = 0;
437  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
438  }
439  return StatusCode::FAILURE;
440  }
442  template <class TYPE>
443  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
444  _Array<TYPE>*& result ) {
445  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
446  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
447  }
448  return StatusCode::FAILURE;
449  }
451  template <class TYPE>
452  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
453  _Matrix<TYPE>*& result ) {
454  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
455  return add( result =
456  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
457  }
458  return StatusCode::FAILURE;
459  }
460  template <class TYPE>
461  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ ) {
462  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
463  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
464  }
465  return StatusCode::FAILURE;
466  }
467 
468  public:
470  template <class TYPE>
472  return i_item( name, result.m_ptr );
473  }
475  template <class TYPE>
476  StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
477  return i_item( name, result.m_ptr );
478  }
480  template <class TYPE>
482  return i_item( name, result.m_ptr );
483  }
485  template <class TYPE>
486  StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
487  return i_item( name, result.m_ptr );
488  }
490  template <class TYPE>
492  return i_item( name, result.m_ptr );
493  }
494 
496  template <class TYPE>
497  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
498  return i_item( name, result.m_ptr );
499  }
500 
514  template <class TYPE>
516  typedef Range<TYPE> _R;
517  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
518  }
519 
528  template <class TYPE>
530  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
531  }
532 
542  typedef Range<IOpaqueAddress*> _R;
543  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
544  }
545 
563  template <class TYPE, class RANGE>
564  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
565  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
566  }
567 
581  template <class TYPE>
583  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
584  }
585 
605  template <class TYPE, class RANGE>
606  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
607  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
608  }
609 
640  template <class TYPE, class INDEX, class RANGE>
642  const RANGE high ) {
643  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
644  }
645 
671  template <class TYPE, class INDEX, class RANGE>
673  const RANGE high ) {
674  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
675  }
676 
701  template <class TYPE, class INDEX>
703  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
704  array.m_ptr );
705  }
706 
726  template <class TYPE, class INDEX>
728  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
729  array.m_ptr );
730  }
731 
749  template <class TYPE>
750  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
751  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
752  }
753 
776  template <class TYPE, class RANGE>
777  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
778  const RANGE high ) {
779  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
780  }
781 
807  template <class TYPE, class INDEX>
808  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
809  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
810  matrix.m_ptr );
811  }
812 
833  template <class TYPE, class INDEX>
834  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
835  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
836  Range<TYPE>::max(), matrix.m_ptr );
837  }
838 
871  template <class TYPE, class INDEX, class RANGE>
872  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
873  const RANGE high ) {
874  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
875  }
876 
904  template <class TYPE, class INDEX, class RANGE>
906  const RANGE low, const RANGE high ) {
907  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
908  }
909  };
910 
915  static const CLID& classID() { return CLID_NTupleDirectory; }
917  const CLID& clID() const override { return classID(); }
918  };
919 
922  class File : public Directory {
923  protected:
929  long m_type = 0;
931  bool m_isOpen = false;
932 
933  public:
934  File() = default;
937  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
938 
940  static const CLID& classID() { return CLID_NTupleFile; }
942  const CLID& clID() const override { return classID(); }
944  void setType( const long typ ) { m_type = typ; }
946  long type() const { return m_type; }
948  const std::string& name() const { return m_name; }
950  void setName( std::string nam ) { m_name = std::move( nam ); }
952  const std::string& logicalName() const { return m_logName; }
956  void setOpen( bool flag ) { m_isOpen = flag; }
958  bool isOpen() const { return m_isOpen; }
959  };
960  // =========================================================================
961  // inhibit certain types by defining specialized templates which do not
962  // allow for construction.
963  template <>
965  Array() = delete;
966 
967  public:
968  virtual ~Array() = default;
969  virtual void dummy() = 0;
970  };
971  template <>
973  Matrix() = delete;
974 
975  public:
976  virtual ~Matrix() = default;
977  virtual void dummy() = 0;
978  };
979 // =========================================================================
980 #ifndef ALLOW_ALL_TYPES
981 #else
982  typedef Item<bool> BoolItem;
983  typedef Item<char> CharItem;
984  typedef Item<unsigned char> UCharItem;
985  typedef Item<short> ShortItem;
986  typedef Item<unsigned short> UShortItem;
987  typedef Item<long> LongItem;
988  typedef Item<long long> LongLongItem;
989  typedef Item<unsigned long> ULongItem;
990  typedef Item<unsigned long long> ULongLongItem;
991  typedef Item<int> IntItem;
992  typedef Item<unsigned int> UIntItem;
993  typedef Item<float> FloatItem;
994  typedef Item<double> DoubleItem;
995  typedef Array<bool> BoolArray;
996  typedef Array<char> CharArray;
997  typedef Array<unsigned char> UCharArray;
998  typedef Array<short> ShortArray;
999  typedef Array<unsigned short> UShortArray;
1000  typedef Array<long> LongArray;
1001  typedef Array<unsigned long> ULongArray;
1002  typedef Array<int> IntArray;
1003  typedef Array<unsigned int> UIntArray;
1004  typedef Array<float> FloatArray;
1005  typedef Array<double> DoubleArray;
1006  typedef Matrix<bool> BoolMatrix;
1007  typedef Matrix<char> CharMatrix;
1008  typedef Matrix<unsigned char> UCharMatrix;
1009  typedef Matrix<short> ShortMatrix;
1010  typedef Matrix<unsigned short> UShortMatrix;
1011  typedef Matrix<long> LongMatrix;
1012  typedef Matrix<unsigned long> ULongMatrix;
1013  typedef Matrix<int> IntMatrix;
1014  typedef Matrix<unsigned int> UIntMatrix;
1015  typedef Matrix<float> FloatMatrix;
1016  typedef Matrix<double> DoubleMatrix;
1017 #endif
1018 
1019  template <class T>
1020  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1021  return s << T( obj );
1022  }
1023 } // end of namespace NTuple
1024 
1025 // Useful:
1029 
1030 #endif // GAUDIKERNEL_NTUPLE_H
NTuple::_Array::begin
TYP * begin()
Definition: NTuple.h:189
NTuple::_Accessor::operator=
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:230
Properties.IntArray
list IntArray
Definition: Properties.py:37
NTuple::Tuple::addIndexedItem
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:672
NTuple::_Data::range
virtual const ItemRange & range() const =0
Access the range if specified.
NTuple::_Array::operator=
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:174
NTuple::Array< IOpaqueAddress * >::~Array
virtual ~Array()=default
NTuple::Range< bool >::Range
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:101
NTuple::Item< bool >::operator=
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:316
NTuple::_Accessor::range
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:252
Containers::Array
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
Definition: KeyedObjectManager.h:111
DataObject::name
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:72
NTuple::File
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:922
NTuple::Array< IOpaqueAddress * >::dummy
virtual void dummy()=0
NTuple::Item< bool >::Item
Item()=default
Standard Constructor.
NTuple::Array::operator[]
TYP & operator[](const T i)
Array operator.
Definition: NTuple.h:343
std::string
STL class.
NTuple::Tuple::i_item
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:408
NTuple::Item< bool >::_My
Item< bool > _My
Definition: NTuple.h:308
std::move
T move(T... args)
bug_34121.name
name
Definition: bug_34121.py:20
NTuple::_Accessor::m_ptr
TYP * m_ptr
Pointer to instance.
Definition: NTuple.h:234
NTuple::Range< bool >::lower
bool lower() const
Lower boundary of range.
Definition: NTuple.h:107
INTuple::i_find
virtual INTupleItem * i_find(const std::string &name) const =0
Internally used by abstract classes.
NTuple::File::setLogicalName
void setLogicalName(std::string l)
Definition: NTuple.h:954
NTuple::Directory
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:913
NTuple::Tuple::i_addObject
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:461
NTuple::Tuple::i_item
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:416
NTuple::File::File
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:936
NTuple::Range< bool >::~Range
virtual ~Range()=default
Destructor.
NTuple::_Accessor::_Accessor
_Accessor()=default
Standard Constructor.
NTuple::Tuple::i_addItem
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:452
gaudirun.s
string s
Definition: gaudirun.py:346
IOpaqueAddress
Definition: IOpaqueAddress.h:33
std::type_info
NTuple::File::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:942
NTuple::Range< bool >
Definition: NTuple.h:98
NTuple::operator<<
std::ostream & operator<<(std::ostream &s, const Item< T > &obj)
Definition: NTuple.h:1020
NTuple::Tuple::i_addItem
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:443
NTuple::Item::Item
Item()=default
Standard Constructor.
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< IOpaqueAddress * > &itm)
Add an address object item to an N tuple: specialized call.
Definition: NTuple.h:541
NTuple::_Accessor
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:56
NTuple::Matrix::operator[]
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:376
NTuple::Matrix::operator[]
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:371
NTuple::_Item
Abstract class describing a column in a N tuple.
Definition: NTuple.h:50
NTuple::_Array::data
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:185
NTuple::_Array::end
TYP * end()
Definition: NTuple.h:190
NTuple::_Item::get
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:161
max
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:225
NTuple::Array::operator=
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:337
NTuple::_Matrix::column
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:220
NTuple::File::m_name
std::string m_name
Physical file name.
Definition: NTuple.h:925
NTuple::File::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:940
NTupleDirPtr
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1027
NTuple::File::m_isOpen
bool m_isOpen
Flag to indicate wether the file was opened already.
Definition: NTuple.h:931
NTuple::Item::_My
Item< TYP > _My
Definition: NTuple.h:259
NTuple::Matrix< IOpaqueAddress * >::Matrix
Matrix()=delete
NTuple::Tuple::i_item
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:400
NTuple::Range::lower
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:86
NTuple::Matrix::operator=
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:365
NTuple::Array::end
TYP * end()
Definition: NTuple.h:353
NTuple::Tuple::item
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition: NTuple.h:471
NTuple::Tuple::item
StatusCode item(const std::string &name, Matrix< TYPE > &result)
Locate a Matrix of data to the N tuple type safe.
Definition: NTuple.h:491
NTuple::_Array::data
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:187
NTuple::Range< bool >::distance
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:111
NTuple::File::logicalName
const std::string & logicalName() const
Definition: NTuple.h:952
NTuple::Item::operator++
Item & operator++(int)
Definition: NTuple.h:272
NTuple::Item::operator-=
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:290
NTuple::_Accessor::_Accessor
_Accessor(const _Accessor &)=default
Default copy constructor.
NTuple::_Data
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:48
NTuple::_Matrix::operator=
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:207
NTuplePtr
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1026
NTuple::Directory::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:915
NTuple::_Matrix::m_rows
long m_rows
Number of rows per column.
Definition: NTuple.h:199
std::copy_n
T copy_n(T... args)
NTuple::Array::operator[]
const TYP & operator[](const T i) const
Array operator.
Definition: NTuple.h:348
NTuple::File::setType
void setType(const long typ)
Set access type.
Definition: NTuple.h:944
StatusCode
Definition: StatusCode.h:65
NTuple::File::type
long type() const
Return access type.
Definition: NTuple.h:946
NTuple::Matrix< IOpaqueAddress * >::dummy
virtual void dummy()=0
NTuple::Item< bool >::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:322
std::ostream
STL class.
NTuple::Item::operator*=
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:294
NTuple::Item::operator/=
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:298
NTuple::_Data::setDefault
virtual void setDefault(const TYP d)=0
Set default value.
NTuple::_Item::set
void set(const TYP &item)
Access to data by reference.
Definition: NTuple.h:159
NTuple::Range< bool >::max
static bool max()
Maximal number of data.
Definition: NTuple.h:115
IOpaqueAddress.h
NTuple::Range< bool >::Range
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:103
NTuple::_Accessor::operator->
TYP * operator->()
Dereference operator.
Definition: NTuple.h:248
SmartDataPtr.h
NTuple::Tuple::addIndexedItem
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:727
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:529
NTuple::Tuple::i_addItem
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
NTuple::_Accessor::operator->
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:250
INTuple
Definition: INTuple.h:91
NTuple::Tuple::addItem
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:872
NTuple::Tuple::i_item
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:392
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
NTuple::Range::distance
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:90
INTuple::add
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
NTuple::Tuple::addItem
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:750
NTupleFilePtr
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1028
min
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:212
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:515
INTupleItem
Definition: INTuple.h:37
NTuple::Range::Range
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:76
NTuple::Tuple::addItem
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:564
NTuple::Range::upper
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:88
NTuple::Range::operator=
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:78
NTuple::Item::operator--
Item & operator--()
Definition: NTuple.h:273
NTuple::Range::~Range
virtual ~Range()=default
Destructor.
NTuple::Range::max
static TYP max()
Maximal number of data.
Definition: NTuple.h:94
NTuple::_Array
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:52
NTuple::Tuple::item
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:476
std::numeric_limits::min
T min(T... args)
NTuple::Matrix
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:62
Properties.DoubleArray
list DoubleArray
Definition: Properties.py:40
NTuple::Item::operator*
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:269
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
NTuple::_Matrix
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:54
DataObject.h
NTuple::Tuple::addItem
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:702
NTuple::_Accessor::~_Accessor
virtual ~_Accessor()=default
Standard Destructor.
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:37
NTuple::File::setName
void setName(std::string nam)
Set access type.
Definition: NTuple.h:950
gaudirun.l
dictionary l
Definition: gaudirun.py:580
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores.
Definition: SmartDataPtr.h:57
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:387
NTuple::Range< bool >::min
static bool min()
Minimal number of data.
Definition: NTuple.h:113
NTuple::File::name
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:948
NTuple::Tuple::addItem
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:808
std
STL namespace.
NTuple::File::File
File()=default
NTuple::Item::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:282
NTuple::Tuple::addIndexedItem
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:905
NTuple::Matrix< IOpaqueAddress * >::~Matrix
virtual ~Matrix()=default
DataObject
Definition: DataObject.h:40
GaudiPartProp.decorators.Item
Item
Definition: decorators.py:305
NTuple
NTuple name space.
Definition: INTupleSvc.h:19
NTuple::Tuple::item
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:486
GaudiPython::Matrix
std::vector< Row > Matrix
Definition: Vector.h:30
NTuple::File::m_type
long m_type
Access type.
Definition: NTuple.h:929
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:956
std::out_of_range
STL class.
NTuple::File::isOpen
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:958
NTuple::Item::operator+=
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:286
NTuple::_Item::operator=
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:154
NTuple::Matrix::Matrix
Matrix()=default
Standard Constructor.
NTuple::Tuple::addItem
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:777
NTuple::_Accessor::operator!
bool operator!() const
Check if column is present.
Definition: NTuple.h:244
NTuple::Item::operator++
Item & operator++()
Definition: NTuple.h:271
DataTypeInfo.h
NTuple::Item< bool >
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:307
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
NTuple::Tuple::item
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:497
NTuple::Tuple::addItem
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:582
NTuple::Range::Range
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:74
NTuple::Range::m_upper
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:70
NTuple::Range::m_lower
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:68
std::numeric_limits::max
T max(T... args)
NTuple::Array::begin
TYP * begin()
Definition: NTuple.h:352
NTuple::Tuple::addItem
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:606
NTuple::Item::operator=
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:276
NTuple::Directory::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:917
NTuple::Array
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:60
Properties.BoolArray
list BoolArray
Definition: Properties.py:43
NTuple::Tuple::addItem
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:641
NTuple::_Matrix::column
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:218
NTuple::_Data::ItemRange
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:137
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:66
NTuple::Array::Array
Array()=default
Standard Constructor.
INTuple.h
NTuple::Array< IOpaqueAddress * >::Array
Array()=delete
NTuple::Item::operator--
Item & operator--(int)
Definition: NTuple.h:274
NTuple::Range::min
static TYP min()
Minimal number of data.
Definition: NTuple.h:92
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
NTuple::Item::operator*
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:267
NTuple::Range< bool >::upper
bool upper() const
Upper boundary of range.
Definition: NTuple.h:109
Gaudi::ParticleProperties::index
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Definition: IParticlePropertySvc.cpp:39
NTuple::Tuple::item
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:481
NTuple::Item
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:58
NTuple::Tuple::i_item
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:424
NTuple::File::m_logName
std::string m_logName
Logical file name.
Definition: NTuple.h:927
NTuple::Tuple::addIndexedItem
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:834
NTuple::Range
Class defining a range.
Definition: NTuple.h:46