| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

NTuple.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_NTUPLE_H
2 #define GAUDIKERNEL_NTUPLE_H
3 // ============================================================================
4 // STL include files
5 // ============================================================================
6 #include <string>
7 #include <limits>
8 #include <cfloat>
9 #include <stdexcept>
10 #include <algorithm>
11 // ============================================================================
12 // Framework include files
13 // ============================================================================
14 #include "GaudiKernel/DataTypeInfo.h"
15 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/INTuple.h"
17 #include "GaudiKernel/SmartDataPtr.h"
18 #include "GaudiKernel/IOpaqueAddress.h"
19 // ============================================================================
20 // Forward declarations
21 // ============================================================================
22 class NTupleFile;
23 class NTupleDirectory;
24 // ============================================================================
33 namespace NTuple
34 {
35 // local forward declarations
36 template <class TYP> class Range;
37 template <class TYP> class _Data;
38 template <class TYP> class _Item;
39 template <class TYP> class _Array;
40 template <class TYP> class _Matrix;
41 template <class TYP> class _Accessor;
42 template <class TYP> class Item;
43 template <class TYP> class Array;
44 template <class TYP> class Matrix;
45 // ==========================================================================
47 template <class TYP>
48 class Range {
50 /*const*/ TYP m_lower;
52 /*const*/ TYP m_upper;
53 public:
55 Range(TYP low, TYP upper) : m_lower(std::move(low)), m_upper(std::move(upper)) {
56 }
58 Range(const Range<TYP>& copy) : m_lower(copy.m_lower),
59 m_upper(copy.m_upper) {
60 }
62 Range& operator=(const Range<TYP>& copy) {
63 m_lower = copy.m_lower;
64 m_upper = copy.m_upper;
65 return *this;
66 }
68 virtual ~Range() = default;
70 TYP lower() const { return m_lower; }
72 TYP upper() const { return m_upper; }
74 TYP distance() const { return m_upper-m_lower; }
76 static TYP min() { return std::numeric_limits<TYP>::min() ; }
78 static TYP max() { return std::numeric_limits<TYP>::max() ; }
79 };
80 // ==========================================================================
81 template <> class Range<bool>
82 {
83 public:
85 Range(const bool /* low */ , const bool /* upper */ ) {}
87 Range(const Range<bool>& /* copy */ ) {}
89 virtual ~Range() = default;
91 bool lower() const { return false; }
93 bool upper() const { return true; }
95 bool distance() const { return true; }
97 static bool min() { return false; }
99 static bool max() { return true; }
100 };
101 // ==========================================================================
102 template <>
103 inline IOpaqueAddress*
104 Range<IOpaqueAddress* >::min() { return (IOpaqueAddress*)0x0 ; }
105 template <>
106 inline IOpaqueAddress*
107 Range<IOpaqueAddress* >::max() { return (IOpaqueAddress*)0xffffffff ; }
108 // ==========================================================================
111 template <class TYP> class GAUDI_API _Data : virtual public INTupleItem {
112 protected:
114 TYP* m_buffer = nullptr;
115 public:
117 typedef Range<TYP> ItemRange;
119 virtual void setDefault(const TYP d) = 0;
121 virtual const ItemRange& range() const = 0;
122 };
123 // ==========================================================================
126 template <class TYP> class GAUDI_API _Item : virtual public _Data<TYP> {
127 public:
129 ~_Item() override = default;
131 static _Item* create(INTuple* tup,
132 const std::string& name,
133 const std::type_info& info,
134 TYP min,
135 TYP max,
136 TYP def);
138 template <class T>
139 _Item<TYP>& operator=(const _Item<T>& copy) {
140 *this->m_buffer = copy.get();
141 return *this;
142 }
144 void set(const TYP& item) { *this->m_buffer = item; }
146 virtual TYP get() const { return *this->m_buffer; }
147 };
148 // ==========================================================================
151 template <class TYP> class GAUDI_API _Array : virtual public _Data<TYP> {
152 public:
154 static _Array* create(INTuple* tup,
155 const std::string& name,
156 const std::type_info& info,
157 const std::string& index,
158 long len,
159 TYP min,
160 TYP max,
161 TYP def);
163 template <class T>
164 _Array<TYP>& operator=(const _Array<T>& copy) {
165 long len = this->length();
166 if ( len == copy.length() ) {
167 const T* source = (const T*)copy.buffer();
168 std::copy_n(source,len,this->m_buffer);
169 return *this;
170 }
171 throw std::out_of_range
172 ("N-tuple matrix cannot be copied! The index range does not match!");
173 return *this;
174 }
176 const TYP& data(long i) const { return this->m_buffer[i]; }
178 TYP& data(long i) { return this->m_buffer[i]; }
179
180 TYP* begin() { return this->m_buffer; }
181 TYP* end() { return this->m_buffer+this->length(); }
182 };
183 // ==========================================================================
186 template <class TYP> class GAUDI_API _Matrix : virtual public _Data<TYP> {
187 protected:
189 long m_rows;
190 public:
192 static _Matrix* create(INTuple* tup,
193 const std::string& name,
194 const std::type_info& info,
195 const std::string& index,
196 long ncol,
197 long nrow,
198 TYP min,
199 TYP max,
200 TYP def);
202 template <class T>
203 _Matrix<TYP>& operator=(const _Matrix<T>& copy) {
204 long len = this->length();
205 if ( len == copy.length() ) {
206 const T* source = (const T*)copy.buffer();
207 std::copy_n(source,len,this->m_buffer);
208 return *this;
209 }
210 throw std::out_of_range
211 ("N-tuple matrix cannot be copied! The index range does not match!");
212 return *this;
213 }
215 TYP* column(long i) { return this->m_buffer + i*m_rows; }
217 const TYP* column(long i) const { return this->m_buffer + i*m_rows; }
218 };
219 // ==========================================================================
222 template <class TYP> class _Accessor {
223 friend class Tuple;
224 private:
225 _Accessor<TYP>& operator=(const _Accessor<TYP>&) {
226 return *this;
227 }
228 protected:
230 mutable TYP* m_ptr = nullptr;
231 public:
233 _Accessor() = default;
235 virtual ~_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> class Item : virtual public _Accessor< _Item<TYP> > {
251 typedef Item<TYP> _My;
252 public:
254 Item() = default;
256 operator const TYP () const { return this->m_ptr->get(); }
258 TYP operator*() { return this->m_ptr->get(); }
260 const TYP operator*() const { return this->m_ptr->get(); }
261 // Arithmetic operators defined on NTuple column entries
262 Item& operator ++ () { return *this += TYP(1); }
263 Item& operator ++ (int) { return *this += TYP(1); }
264 Item& operator -- () { return *this -= TYP(1); }
265 Item& operator -- (int) { return *this -= TYP(1); }
267 Item& operator=(const TYP data) {
268 this->m_ptr->set( data );
269 return *this;
270 }
272 template<class T>
273 Item& operator=(const Item<T>& data) {
274 this->m_ptr->set( data->get() );
275 return *this;
276 }
277 Item<TYP>& operator += (const TYP data) {
278 this->m_ptr->set ( this->m_ptr->get() + data );
279 return *this;
280 }
281 Item<TYP>& operator -= (const TYP data) {
282 this->m_ptr->set ( this->m_ptr->get() - data );
283 return *this;
284 }
285 Item<TYP>& operator *= (const TYP data) {
286 this->m_ptr->set ( this->m_ptr->get() * data );
287 return *this;
288 }
289 Item<TYP>& operator /= (const TYP data) {
290 this->m_ptr->set ( this->m_ptr->get() / data );
291 return *this;
292 }
293 };
294 // ==========================================================================
297 template <> class Item<bool> : virtual public _Accessor< _Item<bool> > {
298 typedef Item<bool> _My;
299 public:
301 Item() = default;
303 operator bool () const { return this->m_ptr->get(); }
305 Item& operator=(const bool data) {
306 this->m_ptr->set( data );
307 return *this;
308 }
310 template<class T>
311 Item& operator=(const Item<T>& data) {
312 this->m_ptr->set( data->get() );
313 return *this;
314 }
315 };
316 // ==========================================================================
319 template <class TYP> class Array : virtual public _Accessor < _Array<TYP> > {
320 public:
322 Array() = default;
324 template <class T>
325 Array& operator=(const Array<T>& copy) {
326 *(this->m_ptr) = *(copy.operator->());
327 return *this;
328 }
330 template <class T>
331 TYP& operator[] (const T i) { return this->m_ptr->data(i); }
333 template <class T>
334 const TYP& operator[] (const T i) const { return this->m_ptr->data(i); }
335
336 TYP* begin() { return this->m_ptr->begin(); }
337 TYP* end() { return this->m_ptr->end(); }
338
339
340 ~Array() override = default;
341 };
342 // =========================================================================
345 template <class TYP> class Matrix : virtual public _Accessor< _Matrix<TYP> > {
346 public:
348 Matrix() = default;
350 template <class T>
351 Matrix& operator=(const Matrix<T>& copy) {
352 *(this->m_ptr) = *(copy.operator->());
353 return *this;
354 }
356 template <class T>
357 TYP* operator[] (const T i) { return this->m_ptr->column(i); }
359 template <class T>
360 const TYP* operator[] (const T i) const { return this->m_ptr->column(i); }
361 ~Matrix() override = default;
362 };
363 // =========================================================================
370 class Tuple : public DataObject, virtual public INTuple {
371
372 protected:
374 template <class TYPE> StatusCode i_item(const std::string& name,
375 _Item<TYPE>*& result) const {
376 try {
377 result = dynamic_cast< _Item<TYPE>* > (i_find(name));
378 }
379 catch (...) {
380 result = nullptr;
381 }
382 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
383 }
385 template <class TYPE> StatusCode i_item(const std::string& name,
386 _Item<TYPE*>*& result) const {
387 try {
388 _Item<void*>* p = dynamic_cast< _Item<void*>* > (i_find(name));
389 result = (_Item<TYPE*>*)p;
390 }
391 catch (...) {
392 result = nullptr;
393 }
394 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
395 }
397 StatusCode i_item(const std::string& name,
398 _Item<IOpaqueAddress*>*& result) const {
399 try {
400 result = dynamic_cast< _Item<IOpaqueAddress*>* > (i_find(name));
401 }
402 catch (...) {
403 result = nullptr;
404 }
405 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
406 }
408 template <class TYPE> StatusCode i_item(const std::string& name,
409 _Array<TYPE>*& result) const {
410 try {
411 if ( clID() == CLID_ColumnWiseTuple ) {
412 result = dynamic_cast< _Array<TYPE>* > (i_find(name));
413 }
414 }
415 catch (...) {
416 result = nullptr;
417 }
418 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
419 }
421 template <class TYPE> StatusCode i_item(const std::string& name,
422 _Matrix<TYPE>*& result) const {
423 try {
424 if ( clID() == CLID_ColumnWiseTuple ) {
425 result = dynamic_cast< _Matrix<TYPE>* > (i_find(name));
426 }
427 }
428 catch (...) {
429 result = nullptr;
430 }
431 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
432 }
434 template <class TYPE>
435 StatusCode i_addItem(const std::string& name,
436 long,
437 const std::string&,
438 TYPE low,
439 TYPE high,
440 _Item<TYPE>*& result) {
441 if ( !i_find(name) ) {
442 TYPE nil;
443 nil = 0;
444 return add( result = _Item<TYPE>::create(this, name, typeid(TYPE), low, high, nil) );
445 }
446 return StatusCode::FAILURE;
447 }
449 template <class TYPE>
450 StatusCode i_addItem(const std::string& name,
451 long dim,
452 const std::string& index,
453 TYPE low,
454 TYPE high,
455 _Array<TYPE>*& result) {
456 if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
457 return add( result = _Array<TYPE>::create(this,
458 name,
459 typeid(TYPE),
460 index,
461 dim,
462 low,
463 high,
464 TYPE(0)) );
465 }
466 return StatusCode::FAILURE;
467 }
469 template <class TYPE>
470 StatusCode i_addItem(const std::string& name,
471 long dim1,
472 long dim2,
473 const std::string& index,
474 TYPE low,
475 TYPE high,
476 _Matrix<TYPE>*& result) {
477 if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
478 return add( result = _Matrix<TYPE>::create(this,
479 name,
480 typeid(TYPE),
481 index,
482 dim1,
483 dim2,
484 low,
485 high,
486 TYPE(0)) );
487 }
488 return StatusCode::FAILURE;
489 }
490 template <class TYPE> StatusCode
491 i_addObject(const std::string& name,_Item<TYPE*>*& result,const std::type_info& /* typ */) {
492 if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
493 return add( result = (_Item<TYPE*>*)_Item<void*>::create(this, name, typeid(TYPE),0,0,0) );
494 }
495 return StatusCode::FAILURE;
496 }
497
498 public:
500 ~Tuple() override = default;
501
503 template <class TYPE> StatusCode item(const std::string& name,
504 Item<TYPE>& result)
505 {
506 return i_item(name, result.m_ptr);
507 }
509 template <class TYPE> StatusCode item(const std::string& name,
510 const Item<TYPE>& result) const
511 {
512 return i_item(name, result.m_ptr);
513 }
515 template <class TYPE> StatusCode
516 item(const std::string& name, Array<TYPE>& result)
517 {
518 return i_item(name, result.m_ptr);
519 }
521 template <class TYPE> StatusCode item(const std::string& name,
522 const Array<TYPE>& result) const
523 {
524 return i_item(name, result.m_ptr);
525 }
527 template <class TYPE> StatusCode item(const std::string& name,
528 Matrix<TYPE>& result)
529 {
530 return i_item(name, result.m_ptr);
531 }
532
534 template <class TYPE> StatusCode item( const std::string& name,
535 const Matrix<TYPE>& result) const
536 {
537 return i_item(name, result.m_ptr);
538 }
539
553 template <class TYPE> StatusCode
554 addItem(const std::string& name, Item<TYPE>& itm) {
555 typedef Range<TYPE> _R;
556 return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
557 }
558
567 template <class TYPE> StatusCode
568 addItem(const std::string& name, Item<TYPE*>& itm) {
569 return i_addObject(name,itm.m_ptr,typeid(TYPE));
570 }
571
580 StatusCode
581 addItem(const std::string& name, Item<IOpaqueAddress*>& itm) {
582 typedef Range<IOpaqueAddress*> _R;
583 return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
584 }
585
603 template <class TYPE, class RANGE> StatusCode
604 addItem(const std::string& name,
605 Item<TYPE>& itm,
606 const RANGE low,
607 const RANGE high)
608 {
609 return i_addItem( name, 1, "", TYPE(low), TYPE(high), itm.m_ptr);
610 }
611
625 template <class TYPE> StatusCode
626 addItem(const std::string& name,
627 long dim,
628 Array<TYPE>& array)
629 {
630 return i_addItem(name,
631 dim,
632 "",
633 Range<TYPE>::min(),
634 Range<TYPE>::max(),
635 array.m_ptr);
636 }
637
657 template <class TYPE, class RANGE> StatusCode
658 addItem(const std::string& name,
659 long dim,
660 Array<TYPE>& array,
661 const RANGE low,
662 const RANGE high)
663 {
664 return i_addItem(name,
665 dim,
666 "",
667 TYPE(low),
668 TYPE(high),
669 array.m_ptr);
670 }
671
702 template <class TYPE, class INDEX, class RANGE> StatusCode
703 addItem(const std::string& name,
704 Item<INDEX>& index,
705 Array<TYPE>& array,
706 const RANGE low,
707 const RANGE high)
708 {
709 return i_addItem( name,
710 index->range().distance(),
711 index->name(),
712 TYPE(low),
713 TYPE(high),
714 array.m_ptr);
715 }
716
742 template <class TYPE, class INDEX, class RANGE> StatusCode
743 addIndexedItem( const std::string& name,
744 Item<INDEX>& index,
745 Array<TYPE>& array,
746 const RANGE low,
747 const RANGE high)
748 {
749 return i_addItem( name,
750 index->range().distance(),
751 index->name(),
752 TYPE(low),
753 TYPE(high),
754 array.m_ptr);
755 }
756
781 template <class TYPE, class INDEX> StatusCode
782 addItem(const std::string& name,
783 Item<INDEX>& index,
784 Array<TYPE>& array)
785 {
786 return i_addItem( name,
787 index->range().distance(),
788 index->name(),
789 Range<TYPE>::min(),
790 Range<TYPE>::max(),
791 array.m_ptr);
792 }
793
813 template <class TYPE, class INDEX> StatusCode
814 addIndexedItem( const std::string& name,
815 Item<INDEX>& index,
816 Array<TYPE>& array)
817 {
818 return i_addItem( name,
819 index->range().distance(),
820 index->name(),
821 Range<TYPE>::min(),
822 Range<TYPE>::max(),
823 array.m_ptr);
824 }
825
843 template <class TYPE> StatusCode
844 addItem(const std::string& name,
845 long cols,
846 long rows,
847 Matrix<TYPE>& matrix)
848 {
849 return i_addItem(name,
850 cols,
851 rows,
852 "",
853 Range<TYPE>::min(),
854 Range<TYPE>::max(),
855 matrix.m_ptr);
856 }
857
880 template <class TYPE, class RANGE> StatusCode
881 addItem(const std::string& name,
882 long cols,
883 long rows,
884 Matrix<TYPE>& result,
885 const RANGE low,
886 const RANGE high)
887 {
888 return i_addItem(name,
889 cols,
890 rows,
891 "",
892 TYPE(low),
893 TYPE(high),
894 result.m_ptr);
895 }
896
922 template <class TYPE, class INDEX> StatusCode
923 addItem(const std::string& name,
924 Item<INDEX>& index,
925 Matrix<TYPE>& matrix,
926 long rows)
927 {
928 return i_addItem( name,
929 index->range().distance(),
930 rows,
931 index->name(),
932 Range<TYPE>::min(),
933 Range<TYPE>::max(),
934 matrix.m_ptr);
935 }
936
957 template <class TYPE, class INDEX> StatusCode
958 addIndexedItem( const std::string& name,
959 Item<INDEX>& col_index,
960 long rows,
961 Matrix<TYPE>& matrix)
962 {
963 return i_addItem( name,
964 col_index->range().distance(),
965 rows,
966 col_index->name(),
967 Range<TYPE>::min(),
968 Range<TYPE>::max(),
969 matrix.m_ptr);
970 }
971
1004 template <class TYPE, class INDEX, class RANGE> StatusCode
1005 addItem(const std::string& name,
1006 Item<INDEX>& index,
1007 Matrix<TYPE>& matrix,
1008 long rows,
1009 const RANGE low,
1010 const RANGE high)
1011 {
1012 return i_addItem( name,
1013 index->range().distance(),
1014 rows,
1015 index->name(),
1016 TYPE(low),
1017 TYPE(high),
1018 matrix.m_ptr);
1019 }
1020
1048 template <class TYPE, class INDEX, class RANGE> StatusCode
1049 addIndexedItem( const std::string& name,
1050 Item<INDEX>& index,
1051 long rows,
1052 Matrix<TYPE>& matrix,
1053 const RANGE low,
1054 const RANGE high)
1055 {
1056 return i_addItem( name,
1057 index->range().distance(),
1058 rows,
1059 index->name(),
1060 TYPE(low),
1061 TYPE(high),
1062 matrix.m_ptr);
1063 }
1064 };
1065
1068 class Directory : public DataObject {
1069 public:
1071 Directory() {
1072 }
1074 ~Directory() override = default;
1075
1077 static const CLID& classID() {
1078 return CLID_NTupleDirectory;
1079 }
1081 const CLID& clID() const override {
1082 return classID();
1083 }
1084 };
1085
1088 class File : public Directory {
1089 protected:
1091 std::string m_name;
1093 std::string m_logName;
1095 long m_type = 0;
1097 bool m_isOpen = false;
1098 public:
1099 File() = default;
1101 File(long type, std::string name, std::string logName)
1102 : m_name(std::move(name)), m_logName(std::move(logName)), m_type(type) {
1103 }
1105 ~File() override = default ;
1106
1108 static const CLID& classID() {
1109 return CLID_NTupleFile;
1110 }
1112 const CLID& clID() const override {
1113 return classID();
1114 }
1116 void setType(const long typ) {
1117 m_type = typ;
1118 }
1120 long type() const {
1121 return m_type;
1122 }
1124 const std::string& name() const {
1125 return m_name;
1126 }
1128 void setName(std::string nam) {
1129 m_name = std::move(nam);
1130 }
1132 const std::string& logicalName() const {
1133 return m_logName;
1134 }
1136 void setLogicalName( std::string l) {
1137 m_logName = std::move(l);
1138 }
1140 void setOpen(bool flag) {
1141 m_isOpen = flag;
1142 }
1144 bool isOpen() const {
1145 return m_isOpen;
1146 }
1147 };
1148 // =========================================================================
1149 // inhibit certain types by defining specialized templates which do not
1150 // allow for construction.
1151 template <>
1152 class Array <IOpaqueAddress*>
1153 {
1154 Array() = delete;
1155 public:
1156 virtual ~Array() = default;
1157 virtual void dummy() = 0;
1158 };
1159 template <>
1160 class Matrix<IOpaqueAddress*>
1161 {
1162 Matrix() = delete;
1163 public:
1164 virtual ~Matrix() = default;
1165 virtual void dummy() = 0;
1166 };
1167 // =========================================================================
1168 #ifndef ALLOW_ALL_TYPES
1169 #else
1170 typedef Item<bool> BoolItem;
1171 typedef Item<char> CharItem;
1172 typedef Item<unsigned char> UCharItem;
1173 typedef Item<short> ShortItem;
1174 typedef Item<unsigned short> UShortItem;
1175 typedef Item<long> LongItem;
1176 typedef Item<long long> LongLongItem;
1177 typedef Item<unsigned long> ULongItem;
1178 typedef Item<unsigned long long> ULongLongItem;
1179 typedef Item<int> IntItem;
1180 typedef Item<unsigned int> UIntItem;
1181 typedef Item<float> FloatItem;
1182 typedef Item<double> DoubleItem;
1183 typedef Array<bool> BoolArray;
1184 typedef Array<char> CharArray;
1185 typedef Array<unsigned char> UCharArray;
1186 typedef Array<short> ShortArray;
1187 typedef Array<unsigned short> UShortArray;
1188 typedef Array<long> LongArray;
1189 typedef Array<unsigned long> ULongArray;
1190 typedef Array<int> IntArray;
1191 typedef Array<unsigned int> UIntArray;
1192 typedef Array<float> FloatArray;
1193 typedef Array<double> DoubleArray;
1194 typedef Matrix<bool> BoolMatrix;
1195 typedef Matrix<char> CharMatrix;
1196 typedef Matrix<unsigned char> UCharMatrix;
1197 typedef Matrix<short> ShortMatrix;
1198 typedef Matrix<unsigned short> UShortMatrix;
1199 typedef Matrix<long> LongMatrix;
1200 typedef Matrix<unsigned long> ULongMatrix;
1201 typedef Matrix<int> IntMatrix;
1202 typedef Matrix<unsigned int> UIntMatrix;
1203 typedef Matrix<float> FloatMatrix;
1204 typedef Matrix<double> DoubleMatrix;
1205 #endif
1206
1207 template <class T>
1208 inline std::ostream& operator<<(std::ostream& s, const Item<T>& obj)
1209 {
1210 return s << T(obj);
1211 }
1212 } // end of namespace NTuple
1213
1214 // Useful:
1215 typedef SmartDataPtr<NTuple::Tuple> NTuplePtr;
1216 typedef SmartDataPtr<NTuple::Directory> NTupleDirPtr;
1217 typedef SmartDataPtr<NTuple::File> NTupleFilePtr;
1218
1219 #endif // GAUDIKERNEL_NTUPLE_H
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:1005
NTuple::File::name
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1124
NTuple::Range< bool >::lower
bool lower() const
Lower boundary of range.
Definition: NTuple.h:91
NTuple::Item< bool >::_My
Item< bool > _My
Definition: NTuple.h:298
std::out_of_range
STL class.
StatusCode::SUCCESS
Definition: StatusCode.h:30
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1140
NTuple::File::File
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:1101
Containers::Array
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
Definition: KeyedObjectManager.h:101
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
StatusCode::FAILURE
Definition: StatusCode.h:29
NTuple::Range::m_lower
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:50
gaudirun.default
default
Definition: gaudirun.py:141
DataTypeInfo.h
operator!
bool operator!(const Gaudi::Time &t)
Definition: Time.icpp:248
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:782
NTuple::File::m_logName
std::string m_logName
Logical file name.
Definition: NTuple.h:1093
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:703
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:1049
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:57
NTuple::_Matrix
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:40
NTuple::Matrix
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:44
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:374
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:470
NTuple::_Item
Abstract class describing a column in a N tuple.
Definition: NTuple.h:38
NTuple::_Data::ItemRange
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:117
NTupleFilePtr
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1217
NTuple::_Array::operator=
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:164
NTuple::_Array::begin
TYP * begin()
Definition: NTuple.h:180
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:509
NTuple::Range::min
static TYP min()
Minimal number of data.
Definition: NTuple.h:76
NTuple::_Accessor::operator->
TYP * operator->()
Dereference operator.
Definition: NTuple.h:241
std
STL namespace.
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:534
NTuple::Item::operator*
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:260
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:844
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:521
NTuple::_Matrix::column
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:215
std::copy_n
T copy_n(T...args)
NTuple::_Matrix::operator=
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:203
NTuplePtr
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1215
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:743
NTuple::_Accessor::range
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:245
NTuple
NTuple name space.
Definition: INTupleSvc.h:10
NTuple::_Item::get
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:146
NTuple::File::type
long type() const
Return access type.
Definition: NTuple.h:1120
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:923
std::type_info
NTuple::File::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1108
std::string
STL class.
std::numeric_limits::min
T min(T...args)
INTuple
NTuple interface class definition.
Definition: INTuple.h:79
NTuple::Matrix::operator=
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:351
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:958
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:814
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:32
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:421
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:26
SmartDataPtr.h
INTuple.h
NTuple::_Accessor
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:41
INTupleItem::length
virtual long length() const =0
Access the buffer length.
NTuple::Range< bool >::max
static bool max()
Maximal number of data.
Definition: NTuple.h:99
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
gaudirun.type
type
Definition: gaudirun.py:125
NTuple::_Item::operator=
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:139
NTuple::Range::~Range
virtual ~Range()=default
Destructor.
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:604
NTuple::File::setName
void setName(std::string nam)
Set access type.
Definition: NTuple.h:1128
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:881
NTuple::File::setLogicalName
void setLogicalName(std::string l)
Definition: NTuple.h:1136
NTuple::Range::max
static TYP max()
Maximal number of data.
Definition: NTuple.h:78
NTuple::Item< bool >::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:311
NTuple::Range< bool >::upper
bool upper() const
Upper boundary of range.
Definition: NTuple.h:93
NTuple::File::m_name
std::string m_name
Physical file name.
Definition: NTuple.h:1091
NTuple::Tuple::i_addObject
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:491
NTuple::Item< bool >
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:297
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:626
NTuple::Range::upper
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:72
NTuple::_Data
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:37
NTuple::File::isOpen
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:1144
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
std::numeric_limits::max
T max(T...args)
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:581
NTuple::Range::Range
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:58
std::move
T move(T...args)
GaudiPython.GaudiAlgs.matrix
matrix
Definition: GaudiAlgs.py:1149
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
IOpaqueAddress.h
NTuple::File::setType
void setType(const long typ)
Set access type.
Definition: NTuple.h:1116
gaudirun.l
dictionary l
Definition: gaudirun.py:421
INTupleItem::buffer
virtual const void * buffer() const =0
Access data buffer (CONST)
GaudiPython::Matrix
std::vector< Row > Matrix
Definition: Vector.h:21
NTuple::Array::end
TYP * end()
Definition: NTuple.h:337
NTuple::Range::distance
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:74
NTuple::_Accessor< _Item< TYP > >::m_ptr
_Item< TYP > * m_ptr
Pointer to instance.
Definition: NTuple.h:230
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:27
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:568
NTuple::_Matrix::column
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:217
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:450
NTuple::Item::_My
Item< TYP > _My
Definition: NTuple.h:251
NTuple::Item< bool >::operator=
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:305
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:516
NTuple::Item::operator=
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:273
NTuple::Array::begin
TYP * begin()
Definition: NTuple.h:336
NTuple::_Array::data
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:176
NTuple::Item::operator=
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:267
gaudirun.s
string s
Definition: gaudirun.py:245
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:554
NTuple::_Matrix::m_rows
long m_rows
Number of rows per column.
Definition: NTuple.h:189
NTuple::Range::m_upper
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:52
NTuple::Range
Class defining a range.
Definition: NTuple.h:36
NTuple::Range< bool >::Range
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:87
NTupleDirPtr
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1216
NTuple::Array::operator=
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:325
NTuple::_Accessor::operator->
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:243
NTuple::Range< bool >::Range
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:85
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:503
NTuple::Directory::Directory
Directory()
Standard constructor.
Definition: NTuple.h:1071
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
NTuple::File::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1112
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:385
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:658
NTuple::Item
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:42
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:397
NTuple::Array
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:43
NTuple::Range< bool >::min
static bool min()
Minimal number of data.
Definition: NTuple.h:97
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
NTuple::Directory
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1068
NTuple::_Accessor::operator=
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:225
NTuple::Range< bool >::distance
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:95
NTuple::_Array::end
TYP * end()
Definition: NTuple.h:181
std::ostream
STL class.
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:527
NTuple::File::logicalName
const std::string & logicalName() const
Definition: NTuple.h:1132
NTuple::Item::operator*
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:258
NTuple::Range::lower
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:70
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:408
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:435
NTuple::Directory::clID
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1081
NTuple::_Array::data
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:178
NTuple::Range::operator=
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:62
NTuple::File
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1088
DataObject.h
NTuple::Directory::classID
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1077
NTuple::Range::Range
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:55
NTuple::Range< bool >
Definition: NTuple.h:81
NTuple::_Array
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:39