The Gaudi Framework  master (37c0b60a)
NTuple.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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; } // cppcheck-suppress CastIntegerToAddressAtReturn
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; // cppcheck-suppress passedByValue; small type
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:
232 
233  protected:
235  mutable TYP* m_ptr = nullptr;
236 
237  public:
239  _Accessor() = default;
241  virtual ~_Accessor() = default;
243  _Accessor( const _Accessor& ) = default;
245  bool operator!() const { return m_ptr != 0; }
247  operator const void*() const { return m_ptr; }
249  TYP* operator->() { return m_ptr; }
251  const TYP* operator->() const { return m_ptr; }
253  const Range<TYP>& range() const { return m_ptr->range(); }
254  };
255  // ==========================================================================
258  template <class TYP>
259  class Item : virtual public _Accessor<_Item<TYP>> {
260  typedef Item<TYP> _My;
261 
262  public:
264  Item() = default;
266  operator const TYP() const { return this->m_ptr->get(); }
268  TYP operator*() { return this->m_ptr->get(); }
270  const TYP operator*() const { return this->m_ptr->get(); }
271  // Arithmetic operators defined on NTuple column entries
272  Item& operator++() { return *this += TYP( 1 ); }
273  Item& operator++( int ) { return *this += TYP( 1 ); }
274  Item& operator--() { return *this -= TYP( 1 ); }
275  Item& operator--( int ) { return *this -= TYP( 1 ); }
277  Item& operator=( const TYP data ) {
278  this->m_ptr->set( data );
279  return *this;
280  }
282  template <class T>
283  Item& operator=( const Item<T>& data ) {
284  this->m_ptr->set( data->get() );
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  Item<TYP>& operator*=( const TYP data ) {
296  this->m_ptr->set( this->m_ptr->get() * data );
297  return *this;
298  }
299  Item<TYP>& operator/=( const TYP data ) {
300  this->m_ptr->set( this->m_ptr->get() / data );
301  return *this;
302  }
303  };
304  // ==========================================================================
307  template <>
308  class Item<bool> : virtual public _Accessor<_Item<bool>> {
309  typedef Item<bool> _My;
310 
311  public:
313  Item() = default;
315  operator bool() const { return this->m_ptr->get(); }
317  Item& operator=( const bool data ) {
318  this->m_ptr->set( data );
319  return *this;
320  }
322  template <class T>
323  Item& operator=( const Item<T>& data ) {
324  this->m_ptr->set( data->get() );
325  return *this;
326  }
327  };
328  // ==========================================================================
331  template <class TYP>
332  class Array : virtual public _Accessor<_Array<TYP>> {
333  public:
335  Array() = default;
337  template <class T>
338  Array& operator=( const Array<T>& copy ) {
339  *( this->m_ptr ) = *( copy.operator->() );
340  return *this;
341  }
343  template <class T>
344  TYP& operator[]( const T i ) {
345  return this->m_ptr->data( i );
346  }
348  template <class T>
349  const TYP& operator[]( const T i ) const {
350  return this->m_ptr->data( i );
351  }
352 
353  TYP* begin() { return this->m_ptr->begin(); }
354  TYP* end() { return this->m_ptr->end(); }
355  };
356  // =========================================================================
359  template <class TYP>
360  class Matrix : virtual public _Accessor<_Matrix<TYP>> {
361  public:
363  Matrix() = default;
365  template <class T>
366  Matrix& operator=( const Matrix<T>& copy ) {
367  *( this->m_ptr ) = *( copy.operator->() );
368  return *this;
369  }
371  template <class T>
372  TYP* operator[]( const T i ) {
373  return this->m_ptr->column( i );
374  }
376  template <class T>
377  const TYP* operator[]( const T i ) const {
378  return this->m_ptr->column( i );
379  }
380  };
381  // =========================================================================
388  class Tuple : public DataObject, virtual public INTuple {
389 
390  protected:
392  template <class TYPE>
393  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
394  try {
395  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
396  } catch ( ... ) { result = nullptr; }
397  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
398  }
400  template <class TYPE>
401  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
402  try {
403  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
404  result = (_Item<TYPE*>*)p;
405  } catch ( ... ) { result = nullptr; }
406  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
407  }
410  try {
411  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
412  } catch ( ... ) { result = nullptr; }
413  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
414  }
416  template <class TYPE>
417  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
418  try {
419  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
420  } catch ( ... ) { result = nullptr; }
421  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
422  }
424  template <class TYPE>
425  StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
426  try {
427  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
428  } catch ( ... ) { result = nullptr; }
429  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
430  }
432  template <class TYPE>
433  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
434  _Item<TYPE>*& result ) {
435  if ( !i_find( name ) ) {
436  TYPE nil;
437  nil = 0;
438  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
439  }
440  return StatusCode::FAILURE;
441  }
443  template <class TYPE>
444  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
445  _Array<TYPE>*& result ) {
446  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
447  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
448  }
449  return StatusCode::FAILURE;
450  }
452  template <class TYPE>
453  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
454  _Matrix<TYPE>*& result ) {
455  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
456  return add( result =
457  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
458  }
459  return StatusCode::FAILURE;
460  }
461  template <class TYPE>
462  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ ) {
463  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
464  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
465  }
466  return StatusCode::FAILURE;
467  }
468 
469  public:
471  template <class TYPE>
473  return i_item( name, result.m_ptr );
474  }
476  template <class TYPE>
477  StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
478  return i_item( name, result.m_ptr );
479  }
481  template <class TYPE>
483  return i_item( name, result.m_ptr );
484  }
486  template <class TYPE>
487  StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
488  return i_item( name, result.m_ptr );
489  }
491  template <class TYPE>
493  return i_item( name, result.m_ptr );
494  }
495 
497  template <class TYPE>
498  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
499  return i_item( name, result.m_ptr );
500  }
501 
515  template <class TYPE>
517  typedef Range<TYPE> _R;
518  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
519  }
520 
529  template <class TYPE>
531  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
532  }
533 
543  typedef Range<IOpaqueAddress*> _R;
544  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
545  }
546 
564  template <class TYPE, class RANGE>
565  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
566  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
567  }
568 
582  template <class TYPE>
584  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
585  }
586 
606  template <class TYPE, class RANGE>
607  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
608  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
609  }
610 
641  template <class TYPE, class INDEX, class RANGE>
643  const RANGE high ) {
644  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
645  }
646 
672  template <class TYPE, class INDEX, class RANGE>
674  const RANGE high ) {
675  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
676  }
677 
702  template <class TYPE, class INDEX>
704  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
705  array.m_ptr );
706  }
707 
727  template <class TYPE, class INDEX>
729  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
730  array.m_ptr );
731  }
732 
750  template <class TYPE>
751  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
752  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
753  }
754 
777  template <class TYPE, class RANGE>
778  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
779  const RANGE high ) {
780  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
781  }
782 
808  template <class TYPE, class INDEX>
809  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
810  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
811  matrix.m_ptr );
812  }
813 
834  template <class TYPE, class INDEX>
835  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
836  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
837  Range<TYPE>::max(), matrix.m_ptr );
838  }
839 
872  template <class TYPE, class INDEX, class RANGE>
873  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
874  const RANGE high ) {
875  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
876  }
877 
905  template <class TYPE, class INDEX, class RANGE>
907  const RANGE low, const RANGE high ) {
908  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
909  }
910  };
911 
916  static const CLID& classID() { return CLID_NTupleDirectory; }
918  const CLID& clID() const override { return classID(); }
919  };
920 
923  class File : public Directory {
924  protected:
930  long m_type = 0;
932  bool m_isOpen = false;
933 
934  public:
935  File() = default;
938  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
939 
941  static const CLID& classID() { return CLID_NTupleFile; }
943  const CLID& clID() const override { return classID(); }
945  void setType( const long typ ) { m_type = typ; }
947  long type() const { return m_type; }
949  const std::string& name() const { return m_name; }
951  void setName( std::string nam ) { m_name = std::move( nam ); }
953  const std::string& logicalName() const { return m_logName; }
957  void setOpen( bool flag ) { m_isOpen = flag; }
959  bool isOpen() const { return m_isOpen; }
960  };
961  // =========================================================================
962  // inhibit certain types by defining specialized templates which do not
963  // allow for construction.
964  template <>
966  Array() = delete;
967 
968  public:
969  virtual ~Array() = default;
970  virtual void dummy() = 0;
971  };
972  template <>
974  Matrix() = delete;
975 
976  public:
977  virtual ~Matrix() = default;
978  virtual void dummy() = 0;
979  };
980 // =========================================================================
981 #ifndef ALLOW_ALL_TYPES
982 #else
983  typedef Item<bool> BoolItem;
984  typedef Item<char> CharItem;
985  typedef Item<unsigned char> UCharItem;
986  typedef Item<short> ShortItem;
987  typedef Item<unsigned short> UShortItem;
988  typedef Item<long> LongItem;
989  typedef Item<long long> LongLongItem;
990  typedef Item<unsigned long> ULongItem;
991  typedef Item<unsigned long long> ULongLongItem;
992  typedef Item<int> IntItem;
993  typedef Item<unsigned int> UIntItem;
994  typedef Item<float> FloatItem;
995  typedef Item<double> DoubleItem;
996  typedef Array<bool> BoolArray;
997  typedef Array<char> CharArray;
998  typedef Array<unsigned char> UCharArray;
999  typedef Array<short> ShortArray;
1000  typedef Array<unsigned short> UShortArray;
1001  typedef Array<long> LongArray;
1002  typedef Array<unsigned long> ULongArray;
1003  typedef Array<int> IntArray;
1004  typedef Array<unsigned int> UIntArray;
1005  typedef Array<float> FloatArray;
1006  typedef Array<double> DoubleArray;
1007  typedef Matrix<bool> BoolMatrix;
1008  typedef Matrix<char> CharMatrix;
1009  typedef Matrix<unsigned char> UCharMatrix;
1010  typedef Matrix<short> ShortMatrix;
1011  typedef Matrix<unsigned short> UShortMatrix;
1012  typedef Matrix<long> LongMatrix;
1013  typedef Matrix<unsigned long> ULongMatrix;
1014  typedef Matrix<int> IntMatrix;
1015  typedef Matrix<unsigned int> UIntMatrix;
1016  typedef Matrix<float> FloatMatrix;
1017  typedef Matrix<double> DoubleMatrix;
1018 #endif
1019 
1020  template <class T>
1021  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1022  return s << T( obj );
1023  }
1024 } // end of namespace NTuple
1025 
1026 // Useful:
1030 
1031 #endif // GAUDIKERNEL_NTUPLE_H
NTuple::_Array::begin
TYP * begin()
Definition: NTuple.h:189
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:673
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:317
NTuple::_Accessor::range
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:253
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
Properties.IntArray
IntArray
Definition: Properties.py:37
NTuple::File
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:923
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:344
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:409
NTuple::Item< bool >::_My
Item< bool > _My
Definition: NTuple.h:309
std::move
T move(T... args)
NTuple::_Accessor::m_ptr
TYP * m_ptr
Pointer to instance.
Definition: NTuple.h:235
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:955
NTuple::Directory
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:914
NTuple::Tuple::i_addObject
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:462
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:417
NTuple::File::File
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:937
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:453
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:943
NTuple::Range< bool >
Definition: NTuple.h:98
NTuple::operator<<
std::ostream & operator<<(std::ostream &s, const Item< T > &obj)
Definition: NTuple.h:1021
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:444
Properties.BoolArray
BoolArray
Definition: Properties.py:43
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:542
NTuple::_Accessor
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:56
Properties.DoubleArray
DoubleArray
Definition: Properties.py:40
NTuple::Matrix::operator[]
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:377
NTuple::Matrix::operator[]
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:372
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
NTuple::Array::operator=
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:338
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:926
NTuple::File::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:941
NTupleDirPtr
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1028
NTuple::File::m_isOpen
bool m_isOpen
Flag to indicate wether the file was opened already.
Definition: NTuple.h:932
NTuple::Item::_My
Item< TYP > _My
Definition: NTuple.h:260
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:401
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:366
NTuple::Array::end
TYP * end()
Definition: NTuple.h:354
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:472
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:492
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:953
NTuple::Item::operator++
Item & operator++(int)
Definition: NTuple.h:273
NTuple::Item::operator-=
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:291
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:1027
NTuple::Directory::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:916
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:349
NTuple::File::setType
void setType(const long typ)
Set access type.
Definition: NTuple.h:945
StatusCode
Definition: StatusCode.h:65
NTuple::File::type
long type() const
Return access type.
Definition: NTuple.h:947
NTuple::Matrix< IOpaqueAddress * >::dummy
virtual void dummy()=0
NTuple::Item< bool >::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:323
std::ostream
STL class.
NTuple::Item::operator*=
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:295
NTuple::Item::operator/=
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:299
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:249
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:728
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:530
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:433
NTuple::_Accessor::operator->
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:251
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:873
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:393
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:751
NTupleFilePtr
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1029
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:516
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:565
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:274
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:477
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
NTuple::Item::operator*
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:270
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
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:703
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:951
gaudirun.l
dictionary l
Definition: gaudirun.py:583
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:388
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:949
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:809
std
STL namespace.
NTuple::File::File
File()=default
NTuple::Item::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:283
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:906
NTuple::Matrix< IOpaqueAddress * >::~Matrix
virtual ~Matrix()=default
DataObject
Definition: DataObject.h:36
GaudiPartProp.decorators.Item
Item
Definition: decorators.py:306
NTuple
NTuple name space.
Definition: INTupleSvc.h:19
NTuple::_Accessor::operator=
_Accessor< TYP > & operator=(const _Accessor< TYP > &)=delete
Needs to be implemented in derived classes.
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:487
GaudiPython::Matrix
std::vector< Row > Matrix
Definition: Vector.h:30
NTuple::File::m_type
long m_type
Access type.
Definition: NTuple.h:930
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:957
std::out_of_range
STL class.
NTuple::File::isOpen
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:959
NTuple::Item::operator+=
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:287
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:778
NTuple::_Accessor::operator!
bool operator!() const
Check if column is present.
Definition: NTuple.h:245
NTuple::Item::operator++
Item & operator++()
Definition: NTuple.h:272
DataTypeInfo.h
NTuple::Item< bool >
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:308
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:498
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:583
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:353
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:607
NTuple::Item::operator=
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:277
NTuple::Directory::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:918
NTuple::Array
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:60
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:642
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:275
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:268
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:482
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:425
NTuple::File::m_logName
std::string m_logName
Logical file name.
Definition: NTuple.h:928
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:835
NTuple::Range
Class defining a range.
Definition: NTuple.h:46