Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
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-2025 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 #pragma once
12 
13 #include <GaudiKernel/DataObject.h>
15 #include <GaudiKernel/INTuple.h>
18 #include <algorithm>
19 #include <cfloat>
20 #include <limits>
21 #include <stdexcept>
22 #include <string>
23 
24 class NTupleFile;
25 class NTupleDirectory;
26 
35 namespace NTuple {
36  // local forward declarations
37  template <class TYP>
38  class Range;
39  template <class TYP>
40  class _Data;
41  template <class TYP>
42  class _Item;
43  template <class TYP>
44  class _Array;
45  template <class TYP>
46  class _Matrix;
47  template <class TYP>
48  class _Accessor;
49  template <class TYP>
50  class Item;
51  template <class TYP>
52  class Array;
53  template <class TYP>
54  class Matrix;
55 
57  template <class TYP>
58  class Range {
60  /*const*/ TYP m_lower;
62  /*const*/ TYP m_upper;
63 
64  public:
66  Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
68  Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
70  Range& operator=( const Range<TYP>& copy ) {
71  m_lower = copy.m_lower;
72  m_upper = copy.m_upper;
73  return *this;
74  }
76  virtual ~Range() = default;
78  TYP lower() const { return m_lower; }
80  TYP upper() const { return m_upper; }
82  TYP distance() const { return m_upper - m_lower; } // cppcheck-suppress CastIntegerToAddressAtReturn
84  static TYP min() { return std::numeric_limits<TYP>::min(); }
86  static TYP max() { return std::numeric_limits<TYP>::max(); }
87  };
88 
89  template <>
90  class Range<bool> {
91  public:
93  Range( const bool /* low */, const bool /* upper */ ) {}
95  Range( const Range<bool>& /* copy */ ) {}
97  virtual ~Range() = default;
99  bool lower() const { return false; }
101  bool upper() const { return true; }
103  bool distance() const { return true; }
105  static bool min() { return false; }
107  static bool max() { return true; }
108  };
109 
110  template <>
112  return (IOpaqueAddress*)0x0;
113  }
114  template <>
116  return (IOpaqueAddress*)0xffffffff;
117  }
118 
121  template <class TYP>
122  class GAUDI_API _Data : virtual public INTupleItem {
123  protected:
125  TYP* m_buffer = nullptr;
126 
127  public:
131  virtual void setDefault( const TYP d ) = 0; // cppcheck-suppress passedByValue; small type
133  virtual const ItemRange& range() const = 0;
134  };
135 
138  template <class TYP>
139  class GAUDI_API _Item : virtual public _Data<TYP> {
140  public:
142  static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
143  TYP def );
145  template <class T>
146  _Item<TYP>& operator=( const _Item<T>& copy ) {
147  *this->m_buffer = copy.get();
148  return *this;
149  }
151  void set( const TYP& item ) { *this->m_buffer = item; }
153  virtual TYP get() const { return *this->m_buffer; }
154  };
155 
158  template <class TYP>
159  class GAUDI_API _Array : virtual public _Data<TYP> {
160  public:
162  static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
163  long len, TYP min, TYP max, TYP def );
165  template <class T>
166  _Array<TYP>& operator=( const _Array<T>& copy ) {
167  long len = this->length();
168  if ( len == copy.length() ) {
169  const T* source = (const T*)copy.buffer();
170  std::copy_n( source, len, this->m_buffer );
171  return *this;
172  }
173  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
174  return *this;
175  }
177  const TYP& data( long i ) const { return this->m_buffer[i]; }
179  TYP& data( long i ) { return this->m_buffer[i]; }
180 
181  TYP* begin() { return this->m_buffer; }
182  TYP* end() { return this->m_buffer + this->length(); }
183  };
184 
187  template <class TYP>
188  class GAUDI_API _Matrix : virtual public _Data<TYP> {
189  protected:
191  long m_rows;
192 
193  public:
195  static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
196  long ncol, long nrow, TYP min, TYP max, TYP def );
198  template <class T>
200  long len = this->length();
201  if ( len == copy.length() ) {
202  const T* source = (const T*)copy.buffer();
203  std::copy_n( source, len, this->m_buffer );
204  return *this;
205  }
206  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
207  return *this;
208  }
210  TYP* column( long i ) { return this->m_buffer + i * m_rows; }
212  const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
213  };
214 
217  template <class TYP>
218  class _Accessor {
219  friend class Tuple;
220 
221  private:
224 
225  protected:
227  mutable TYP* m_ptr = nullptr;
228 
229  public:
231  _Accessor() = default;
233  virtual ~_Accessor() = default;
235  _Accessor( const _Accessor& ) = default;
237  bool operator!() const { return m_ptr != 0; }
239  operator const void*() const { return m_ptr; }
241  TYP* operator->() { return m_ptr; }
243  const TYP* operator->() const { return m_ptr; }
245  const Range<TYP>& range() const { return m_ptr->range(); }
246  };
247 
250  template <class TYP>
251  class Item : virtual public _Accessor<_Item<TYP>> {
252  typedef Item<TYP> _My;
253 
254  public:
256  Item() = default;
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 <>
300  class Item<bool> : virtual public _Accessor<_Item<bool>> {
301  typedef Item<bool> _My;
302 
303  public:
305  Item() = default;
307  operator bool() const { return this->m_ptr->get(); }
309  Item& operator=( const bool data ) {
310  this->m_ptr->set( data );
311  return *this;
312  }
314  template <class T>
315  Item& operator=( const Item<T>& data ) {
316  this->m_ptr->set( data->get() );
317  return *this;
318  }
319  };
320 
323  template <class TYP>
324  class Array : virtual public _Accessor<_Array<TYP>> {
325  public:
327  Array() = default;
329  template <class T>
330  Array& operator=( const Array<T>& copy ) {
331  *( this->m_ptr ) = *( copy.operator->() );
332  return *this;
333  }
335  template <class T>
336  TYP& operator[]( const T i ) {
337  return this->m_ptr->data( i );
338  }
340  template <class T>
341  const TYP& operator[]( const T i ) const {
342  return this->m_ptr->data( i );
343  }
344 
345  TYP* begin() { return this->m_ptr->begin(); }
346  TYP* end() { return this->m_ptr->end(); }
347  };
348 
351  template <class TYP>
352  class Matrix : virtual public _Accessor<_Matrix<TYP>> {
353  public:
355  Matrix() = default;
357  template <class T>
358  Matrix& operator=( const Matrix<T>& copy ) {
359  *( this->m_ptr ) = *( copy.operator->() );
360  return *this;
361  }
363  template <class T>
364  TYP* operator[]( const T i ) {
365  return this->m_ptr->column( i );
366  }
368  template <class T>
369  const TYP* operator[]( const T i ) const {
370  return this->m_ptr->column( i );
371  }
372  };
373 
380  class Tuple : public DataObject, virtual public INTuple {
381 
382  protected:
384  template <class TYPE>
385  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
386  try {
387  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
388  } catch ( ... ) { result = nullptr; }
389  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
390  }
392  template <class TYPE>
393  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
394  try {
395  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
396  result = (_Item<TYPE*>*)p;
397  } catch ( ... ) { result = nullptr; }
398  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
399  }
401  StatusCode i_item( const std::string& name, _Item<IOpaqueAddress*>*& result ) const {
402  try {
403  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
404  } catch ( ... ) { result = nullptr; }
405  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
406  }
408  template <class TYPE>
409  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
410  try {
411  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( 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, _Matrix<TYPE>*& result ) const {
418  try {
419  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
420  } catch ( ... ) { result = nullptr; }
421  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
422  }
424  template <class TYPE>
425  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
426  _Item<TYPE>*& result ) {
427  if ( !i_find( name ) ) {
428  TYPE nil;
429  nil = 0;
430  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
431  }
432  return StatusCode::FAILURE;
433  }
435  template <class TYPE>
436  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
437  _Array<TYPE>*& result ) {
438  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
439  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
440  }
441  return StatusCode::FAILURE;
442  }
444  template <class TYPE>
445  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
446  _Matrix<TYPE>*& result ) {
447  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
448  return add( result =
449  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
450  }
451  return StatusCode::FAILURE;
452  }
453  template <class TYPE>
454  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ ) {
455  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
456  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
457  }
458  return StatusCode::FAILURE;
459  }
460 
461  public:
463  template <class TYPE>
464  StatusCode item( const std::string& name, Item<TYPE>& result ) {
465  return i_item( name, result.m_ptr );
466  }
468  template <class TYPE>
469  StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
470  return i_item( name, result.m_ptr );
471  }
473  template <class TYPE>
474  StatusCode item( const std::string& name, Array<TYPE>& result ) {
475  return i_item( name, result.m_ptr );
476  }
478  template <class TYPE>
479  StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
480  return i_item( name, result.m_ptr );
481  }
483  template <class TYPE>
484  StatusCode item( const std::string& name, Matrix<TYPE>& result ) {
485  return i_item( name, result.m_ptr );
486  }
487 
489  template <class TYPE>
490  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
491  return i_item( name, result.m_ptr );
492  }
493 
507  template <class TYPE>
508  StatusCode addItem( const std::string& name, Item<TYPE>& itm ) {
509  typedef Range<TYPE> _R;
510  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
511  }
512 
521  template <class TYPE>
522  StatusCode addItem( const std::string& name, Item<TYPE*>& itm ) {
523  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
524  }
525 
534  StatusCode addItem( const std::string& name, Item<IOpaqueAddress*>& itm ) {
535  typedef Range<IOpaqueAddress*> _R;
536  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
537  }
538 
556  template <class TYPE, class RANGE>
557  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
558  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
559  }
560 
574  template <class TYPE>
575  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array ) {
576  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
577  }
578 
598  template <class TYPE, class RANGE>
599  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
600  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
601  }
602 
633  template <class TYPE, class INDEX, class RANGE>
634  StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
635  const RANGE high ) {
636  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
637  }
638 
664  template <class TYPE, class INDEX, class RANGE>
665  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
666  const RANGE high ) {
667  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
668  }
669 
694  template <class TYPE, class INDEX>
696  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
697  array.m_ptr );
698  }
699 
719  template <class TYPE, class INDEX>
721  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
722  array.m_ptr );
723  }
724 
742  template <class TYPE>
743  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
744  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
745  }
746 
769  template <class TYPE, class RANGE>
770  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
771  const RANGE high ) {
772  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
773  }
774 
800  template <class TYPE, class INDEX>
801  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
802  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
803  matrix.m_ptr );
804  }
805 
826  template <class TYPE, class INDEX>
827  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
828  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
829  Range<TYPE>::max(), matrix.m_ptr );
830  }
831 
864  template <class TYPE, class INDEX, class RANGE>
865  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
866  const RANGE high ) {
867  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
868  }
869 
897  template <class TYPE, class INDEX, class RANGE>
898  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, long rows, Matrix<TYPE>& matrix,
899  const RANGE low, const RANGE high ) {
900  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
901  }
902  };
903 
908  static const CLID& classID() { return CLID_NTupleDirectory; }
910  const CLID& clID() const override { return classID(); }
911  };
912 
915  class File : public Directory {
916  protected:
918  std::string m_name;
920  std::string m_logName;
922  long m_type = 0;
924  bool m_isOpen = false;
925 
926  public:
927  File() = default;
929  File( long type, std::string name, std::string logName )
930  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
931 
933  static const CLID& classID() { return CLID_NTupleFile; }
935  const CLID& clID() const override { return classID(); }
937  void setType( const long typ ) { m_type = typ; }
939  long type() const { return m_type; }
941  const std::string& name() const { return m_name; }
943  void setName( std::string nam ) { m_name = std::move( nam ); }
945  const std::string& logicalName() const { return m_logName; }
947  void setLogicalName( std::string l ) { m_logName = std::move( l ); }
949  void setOpen( bool flag ) { m_isOpen = flag; }
951  bool isOpen() const { return m_isOpen; }
952  };
953 
954  // inhibit certain types by defining specialized templates which do not
955  // allow for construction.
956  template <>
958  Array() = delete;
959 
960  public:
961  virtual ~Array() = default;
962  virtual void dummy() = 0;
963  };
964  template <>
966  Matrix() = delete;
967 
968  public:
969  virtual ~Matrix() = default;
970  virtual void dummy() = 0;
971  };
972 
973 #ifndef ALLOW_ALL_TYPES
974 #else
975  typedef Item<bool> BoolItem;
976  typedef Item<char> CharItem;
977  typedef Item<unsigned char> UCharItem;
978  typedef Item<short> ShortItem;
979  typedef Item<unsigned short> UShortItem;
980  typedef Item<long> LongItem;
981  typedef Item<long long> LongLongItem;
982  typedef Item<unsigned long> ULongItem;
983  typedef Item<unsigned long long> ULongLongItem;
984  typedef Item<int> IntItem;
985  typedef Item<unsigned int> UIntItem;
986  typedef Item<float> FloatItem;
987  typedef Item<double> DoubleItem;
988  typedef Array<bool> BoolArray;
989  typedef Array<char> CharArray;
990  typedef Array<unsigned char> UCharArray;
991  typedef Array<short> ShortArray;
992  typedef Array<unsigned short> UShortArray;
993  typedef Array<long> LongArray;
994  typedef Array<unsigned long> ULongArray;
995  typedef Array<int> IntArray;
996  typedef Array<unsigned int> UIntArray;
997  typedef Array<float> FloatArray;
998  typedef Array<double> DoubleArray;
999  typedef Matrix<bool> BoolMatrix;
1000  typedef Matrix<char> CharMatrix;
1001  typedef Matrix<unsigned char> UCharMatrix;
1002  typedef Matrix<short> ShortMatrix;
1003  typedef Matrix<unsigned short> UShortMatrix;
1004  typedef Matrix<long> LongMatrix;
1005  typedef Matrix<unsigned long> ULongMatrix;
1006  typedef Matrix<int> IntMatrix;
1007  typedef Matrix<unsigned int> UIntMatrix;
1008  typedef Matrix<float> FloatMatrix;
1009  typedef Matrix<double> DoubleMatrix;
1010 #endif
1011 
1012  template <class T>
1013  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1014  return s << T( obj );
1015  }
1016 } // namespace NTuple
1017 
1018 // Useful:
NTuple::_Array::begin
TYP * begin()
Definition: NTuple.h:181
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:665
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:166
NTuple::Array< IOpaqueAddress * >::~Array
virtual ~Array()=default
NTuple::Range< bool >::Range
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:93
NTuple::Item< bool >::operator=
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:309
NTuple::_Accessor::range
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:245
Containers::Array
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
Definition: KeyedObjectManager.h:103
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:915
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:336
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:401
NTuple::Item< bool >::_My
Item< bool > _My
Definition: NTuple.h:301
NTuple::_Accessor::m_ptr
TYP * m_ptr
Pointer to instance.
Definition: NTuple.h:227
NTuple::Range< bool >::lower
bool lower() const
Lower boundary of range.
Definition: NTuple.h:99
GaudiPartProp.decorators.std
std
Definition: decorators.py:32
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:947
NTuple::Directory
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:906
NTuple::Tuple::i_addObject
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:454
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:409
NTuple::File::File
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:929
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:445
gaudirun.s
string s
Definition: gaudirun.py:346
IOpaqueAddress
Definition: IOpaqueAddress.h:28
NTuple::File::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:935
NTuple::Range< bool >
Definition: NTuple.h:90
NTuple::operator<<
std::ostream & operator<<(std::ostream &s, const Item< T > &obj)
Definition: NTuple.h:1013
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:436
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:534
NTuple::_Accessor
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:48
Properties.DoubleArray
DoubleArray
Definition: Properties.py:40
NTuple::Matrix::operator[]
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:369
NTuple::Matrix::operator[]
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:364
NTuple::_Item
Abstract class describing a column in a N tuple.
Definition: NTuple.h:42
NTuple::_Array::data
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:177
NTuple::_Array::end
TYP * end()
Definition: NTuple.h:182
NTuple::_Item::get
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:153
NTuple::Array::operator=
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:330
NTuple::_Matrix::column
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:212
NTuple::File::m_name
std::string m_name
Physical file name.
Definition: NTuple.h:918
NTuple::File::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:933
NTupleDirPtr
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1020
NTuple::File::m_isOpen
bool m_isOpen
Flag to indicate wether the file was opened already.
Definition: NTuple.h:924
NTuple::Item::_My
Item< TYP > _My
Definition: NTuple.h:252
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:393
NTuple::Range::lower
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:78
NTuple::Matrix::operator=
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:358
NTuple::Array::end
TYP * end()
Definition: NTuple.h:346
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:464
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:484
NTuple::_Array::data
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:179
NTuple::Range< bool >::distance
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:103
NTuple::File::logicalName
const std::string & logicalName() const
Definition: NTuple.h:945
NTuple::Item::operator++
Item & operator++(int)
Definition: NTuple.h:265
NTuple::Item::operator-=
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:283
NTuple::_Accessor::_Accessor
_Accessor(const _Accessor &)=default
Default copy constructor.
NTuple::_Data
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:40
NTuple::_Matrix::operator=
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:199
NTuplePtr
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1019
NTuple::Directory::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:908
NTuple::_Matrix::m_rows
long m_rows
Number of rows per column.
Definition: NTuple.h:191
NTuple::Array::operator[]
const TYP & operator[](const T i) const
Array operator.
Definition: NTuple.h:341
NTuple::File::setType
void setType(const long typ)
Set access type.
Definition: NTuple.h:937
StatusCode
Definition: StatusCode.h:64
NTuple::File::type
long type() const
Return access type.
Definition: NTuple.h:939
NTuple::Matrix< IOpaqueAddress * >::dummy
virtual void dummy()=0
NTuple::Item< bool >::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:315
NTuple::Item::operator*=
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:287
NTuple::Item::operator/=
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:291
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:151
NTuple::Range< bool >::max
static bool max()
Maximal number of data.
Definition: NTuple.h:107
IOpaqueAddress.h
NTuple::Range< bool >::Range
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:95
NTuple::_Accessor::operator->
TYP * operator->()
Dereference operator.
Definition: NTuple.h:241
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:720
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:522
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:425
NTuple::_Accessor::operator->
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:243
INTuple
Definition: INTuple.h:86
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:865
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:385
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:16
NTuple::Range::distance
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:82
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:743
NTupleFilePtr
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1021
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:508
INTupleItem
Definition: INTuple.h:32
NTuple::Range::Range
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:68
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:557
NTuple::Range::upper
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:80
NTuple::Range::operator=
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:70
NTuple::Item::operator--
Item & operator--()
Definition: NTuple.h:266
NTuple::Range::~Range
virtual ~Range()=default
Destructor.
NTuple::Range::max
static TYP max()
Maximal number of data.
Definition: NTuple.h:86
NTuple::_Array
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:44
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:469
NTuple::Matrix
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:54
NTuple::Item::operator*
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:262
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
NTuple::_Matrix
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:46
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:695
NTuple::_Accessor::~_Accessor
virtual ~_Accessor()=default
Standard Destructor.
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:29
NTuple::File::setName
void setName(std::string nam)
Set access type.
Definition: NTuple.h:943
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:44
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:380
NTuple::Range< bool >::min
static bool min()
Minimal number of data.
Definition: NTuple.h:105
NTuple::File::name
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:941
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:801
NTuple::File::File
File()=default
NTuple::Item::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:275
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:898
NTuple::Matrix< IOpaqueAddress * >::~Matrix
virtual ~Matrix()=default
DataObject
Definition: DataObject.h:37
GaudiPartProp.decorators.Item
Item
Definition: decorators.py:306
NTuple
NTuple name space.
Definition: INTupleSvc.h:16
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:479
GaudiPython::Matrix
std::vector< Row > Matrix
Definition: Vector.h:29
NTuple::File::m_type
long m_type
Access type.
Definition: NTuple.h:922
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:949
NTuple::File::isOpen
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:951
NTuple::Item::operator+=
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:279
NTuple::_Item::operator=
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:146
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:770
NTuple::_Accessor::operator!
bool operator!() const
Check if column is present.
Definition: NTuple.h:237
NTuple::Item::operator++
Item & operator++()
Definition: NTuple.h:264
DataTypeInfo.h
NTuple::Item< bool >
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:300
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
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:490
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:575
NTuple::Range::Range
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:66
NTuple::Range::m_upper
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:62
NTuple::Range::m_lower
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:60
NTuple::Array::begin
TYP * begin()
Definition: NTuple.h:345
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:599
NTuple::Item::operator=
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:269
NTuple::Directory::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:910
NTuple::Array
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:52
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:634
NTuple::_Matrix::column
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:210
NTuple::_Data::ItemRange
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:129
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:267
NTuple::Range::min
static TYP min()
Minimal number of data.
Definition: NTuple.h:84
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
NTuple::Item::operator*
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:260
NTuple::Range< bool >::upper
bool upper() const
Upper boundary of range.
Definition: NTuple.h:101
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:474
NTuple::Item
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:50
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:417
NTuple::File::m_logName
std::string m_logName
Logical file name.
Definition: NTuple.h:920
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:827
NTuple::Range
Class defining a range.
Definition: NTuple.h:38