File indexing completed on 2025-06-30 08:36:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_NTUPLE_H
0012 #define GAUDIKERNEL_NTUPLE_H
0013
0014
0015
0016 #include <GaudiKernel/DataObject.h>
0017 #include <GaudiKernel/DataTypeInfo.h>
0018 #include <GaudiKernel/INTuple.h>
0019 #include <GaudiKernel/IOpaqueAddress.h>
0020 #include <GaudiKernel/SmartDataPtr.h>
0021
0022
0023
0024 #include <algorithm>
0025 #include <cfloat>
0026 #include <limits>
0027 #include <stdexcept>
0028 #include <string>
0029
0030
0031
0032 class NTupleFile;
0033 class NTupleDirectory;
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 namespace NTuple {
0044
0045 template <class TYP>
0046 class Range;
0047 template <class TYP>
0048 class _Data;
0049 template <class TYP>
0050 class _Item;
0051 template <class TYP>
0052 class _Array;
0053 template <class TYP>
0054 class _Matrix;
0055 template <class TYP>
0056 class _Accessor;
0057 template <class TYP>
0058 class Item;
0059 template <class TYP>
0060 class Array;
0061 template <class TYP>
0062 class Matrix;
0063
0064
0065 template <class TYP>
0066 class Range {
0067
0068 TYP m_lower;
0069
0070 TYP m_upper;
0071
0072 public:
0073
0074 Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
0075
0076 Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
0077
0078 Range& operator=( const Range<TYP>& copy ) {
0079 m_lower = copy.m_lower;
0080 m_upper = copy.m_upper;
0081 return *this;
0082 }
0083
0084 virtual ~Range() = default;
0085
0086 TYP lower() const { return m_lower; }
0087
0088 TYP upper() const { return m_upper; }
0089
0090 TYP distance() const { return m_upper - m_lower; }
0091
0092 static TYP min() { return std::numeric_limits<TYP>::min(); }
0093
0094 static TYP max() { return std::numeric_limits<TYP>::max(); }
0095 };
0096
0097 template <>
0098 class Range<bool> {
0099 public:
0100
0101 Range( const bool , const bool ) {}
0102
0103 Range( const Range<bool>& ) {}
0104
0105 virtual ~Range() = default;
0106
0107 bool lower() const { return false; }
0108
0109 bool upper() const { return true; }
0110
0111 bool distance() const { return true; }
0112
0113 static bool min() { return false; }
0114
0115 static bool max() { return true; }
0116 };
0117
0118 template <>
0119 inline IOpaqueAddress* Range<IOpaqueAddress*>::min() {
0120 return (IOpaqueAddress*)0x0;
0121 }
0122 template <>
0123 inline IOpaqueAddress* Range<IOpaqueAddress*>::max() {
0124 return (IOpaqueAddress*)0xffffffff;
0125 }
0126
0127
0128
0129 template <class TYP>
0130 class GAUDI_API _Data : virtual public INTupleItem {
0131 protected:
0132
0133 TYP* m_buffer = nullptr;
0134
0135 public:
0136
0137 typedef Range<TYP> ItemRange;
0138
0139 virtual void setDefault( const TYP d ) = 0;
0140
0141 virtual const ItemRange& range() const = 0;
0142 };
0143
0144
0145
0146 template <class TYP>
0147 class GAUDI_API _Item : virtual public _Data<TYP> {
0148 public:
0149
0150 static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
0151 TYP def );
0152
0153 template <class T>
0154 _Item<TYP>& operator=( const _Item<T>& copy ) {
0155 *this->m_buffer = copy.get();
0156 return *this;
0157 }
0158
0159 void set( const TYP& item ) { *this->m_buffer = item; }
0160
0161 virtual TYP get() const { return *this->m_buffer; }
0162 };
0163
0164
0165
0166 template <class TYP>
0167 class GAUDI_API _Array : virtual public _Data<TYP> {
0168 public:
0169
0170 static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
0171 long len, TYP min, TYP max, TYP def );
0172
0173 template <class T>
0174 _Array<TYP>& operator=( const _Array<T>& copy ) {
0175 long len = this->length();
0176 if ( len == copy.length() ) {
0177 const T* source = (const T*)copy.buffer();
0178 std::copy_n( source, len, this->m_buffer );
0179 return *this;
0180 }
0181 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
0182 return *this;
0183 }
0184
0185 const TYP& data( long i ) const { return this->m_buffer[i]; }
0186
0187 TYP& data( long i ) { return this->m_buffer[i]; }
0188
0189 TYP* begin() { return this->m_buffer; }
0190 TYP* end() { return this->m_buffer + this->length(); }
0191 };
0192
0193
0194
0195 template <class TYP>
0196 class GAUDI_API _Matrix : virtual public _Data<TYP> {
0197 protected:
0198
0199 long m_rows;
0200
0201 public:
0202
0203 static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
0204 long ncol, long nrow, TYP min, TYP max, TYP def );
0205
0206 template <class T>
0207 _Matrix<TYP>& operator=( const _Matrix<T>& copy ) {
0208 long len = this->length();
0209 if ( len == copy.length() ) {
0210 const T* source = (const T*)copy.buffer();
0211 std::copy_n( source, len, this->m_buffer );
0212 return *this;
0213 }
0214 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
0215 return *this;
0216 }
0217
0218 TYP* column( long i ) { return this->m_buffer + i * m_rows; }
0219
0220 const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
0221 };
0222
0223
0224
0225 template <class TYP>
0226 class _Accessor {
0227 friend class Tuple;
0228
0229 private:
0230
0231 _Accessor<TYP>& operator=( const _Accessor<TYP>& ) = delete;
0232
0233 protected:
0234
0235 mutable TYP* m_ptr = nullptr;
0236
0237 public:
0238
0239 _Accessor() = default;
0240
0241 virtual ~_Accessor() = default;
0242
0243 _Accessor( const _Accessor& ) = default;
0244
0245 bool operator!() const { return m_ptr != 0; }
0246
0247 operator const void*() const { return m_ptr; }
0248
0249 TYP* operator->() { return m_ptr; }
0250
0251 const TYP* operator->() const { return m_ptr; }
0252
0253 const Range<TYP>& range() const { return m_ptr->range(); }
0254 };
0255
0256
0257
0258 template <class TYP>
0259 class Item : virtual public _Accessor<_Item<TYP>> {
0260 typedef Item<TYP> _My;
0261
0262 public:
0263
0264 Item() = default;
0265
0266 operator const TYP() const { return this->m_ptr->get(); }
0267
0268 TYP operator*() { return this->m_ptr->get(); }
0269
0270 const TYP operator*() const { return this->m_ptr->get(); }
0271
0272 Item& operator++() { return *this += TYP( 1 ); }
0273 Item& operator++( int ) { return *this += TYP( 1 ); }
0274 Item& operator--() { return *this -= TYP( 1 ); }
0275 Item& operator--( int ) { return *this -= TYP( 1 ); }
0276
0277 Item& operator=( const TYP data ) {
0278 this->m_ptr->set( data );
0279 return *this;
0280 }
0281
0282 template <class T>
0283 Item& operator=( const Item<T>& data ) {
0284 this->m_ptr->set( data->get() );
0285 return *this;
0286 }
0287 Item<TYP>& operator+=( const TYP data ) {
0288 this->m_ptr->set( this->m_ptr->get() + data );
0289 return *this;
0290 }
0291 Item<TYP>& operator-=( const TYP data ) {
0292 this->m_ptr->set( this->m_ptr->get() - data );
0293 return *this;
0294 }
0295 Item<TYP>& operator*=( const TYP data ) {
0296 this->m_ptr->set( this->m_ptr->get() * data );
0297 return *this;
0298 }
0299 Item<TYP>& operator/=( const TYP data ) {
0300 this->m_ptr->set( this->m_ptr->get() / data );
0301 return *this;
0302 }
0303 };
0304
0305
0306
0307 template <>
0308 class Item<bool> : virtual public _Accessor<_Item<bool>> {
0309 typedef Item<bool> _My;
0310
0311 public:
0312
0313 Item() = default;
0314
0315 operator bool() const { return this->m_ptr->get(); }
0316
0317 Item& operator=( const bool data ) {
0318 this->m_ptr->set( data );
0319 return *this;
0320 }
0321
0322 template <class T>
0323 Item& operator=( const Item<T>& data ) {
0324 this->m_ptr->set( data->get() );
0325 return *this;
0326 }
0327 };
0328
0329
0330
0331 template <class TYP>
0332 class Array : virtual public _Accessor<_Array<TYP>> {
0333 public:
0334
0335 Array() = default;
0336
0337 template <class T>
0338 Array& operator=( const Array<T>& copy ) {
0339 *( this->m_ptr ) = *( copy.operator->() );
0340 return *this;
0341 }
0342
0343 template <class T>
0344 TYP& operator[]( const T i ) {
0345 return this->m_ptr->data( i );
0346 }
0347
0348 template <class T>
0349 const TYP& operator[]( const T i ) const {
0350 return this->m_ptr->data( i );
0351 }
0352
0353 TYP* begin() { return this->m_ptr->begin(); }
0354 TYP* end() { return this->m_ptr->end(); }
0355 };
0356
0357
0358
0359 template <class TYP>
0360 class Matrix : virtual public _Accessor<_Matrix<TYP>> {
0361 public:
0362
0363 Matrix() = default;
0364
0365 template <class T>
0366 Matrix& operator=( const Matrix<T>& copy ) {
0367 *( this->m_ptr ) = *( copy.operator->() );
0368 return *this;
0369 }
0370
0371 template <class T>
0372 TYP* operator[]( const T i ) {
0373 return this->m_ptr->column( i );
0374 }
0375
0376 template <class T>
0377 const TYP* operator[]( const T i ) const {
0378 return this->m_ptr->column( i );
0379 }
0380 };
0381
0382
0383
0384
0385
0386
0387
0388 class Tuple : public DataObject, virtual public INTuple {
0389
0390 protected:
0391
0392 template <class TYPE>
0393 StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
0394 try {
0395 result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
0396 } catch ( ... ) { result = nullptr; }
0397 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0398 }
0399
0400 template <class TYPE>
0401 StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
0402 try {
0403 _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
0404 result = (_Item<TYPE*>*)p;
0405 } catch ( ... ) { result = nullptr; }
0406 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0407 }
0408
0409 StatusCode i_item( const std::string& name, _Item<IOpaqueAddress*>*& result ) const {
0410 try {
0411 result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
0412 } catch ( ... ) { result = nullptr; }
0413 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0414 }
0415
0416 template <class TYPE>
0417 StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
0418 try {
0419 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
0420 } catch ( ... ) { result = nullptr; }
0421 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0422 }
0423
0424 template <class TYPE>
0425 StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
0426 try {
0427 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
0428 } catch ( ... ) { result = nullptr; }
0429 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0430 }
0431
0432 template <class TYPE>
0433 StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
0434 _Item<TYPE>*& result ) {
0435 if ( !i_find( name ) ) {
0436 TYPE nil;
0437 nil = 0;
0438 return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
0439 }
0440 return StatusCode::FAILURE;
0441 }
0442
0443 template <class TYPE>
0444 StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
0445 _Array<TYPE>*& result ) {
0446 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0447 return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
0448 }
0449 return StatusCode::FAILURE;
0450 }
0451
0452 template <class TYPE>
0453 StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
0454 _Matrix<TYPE>*& result ) {
0455 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0456 return add( result =
0457 _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
0458 }
0459 return StatusCode::FAILURE;
0460 }
0461 template <class TYPE>
0462 StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& ) {
0463 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0464 return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
0465 }
0466 return StatusCode::FAILURE;
0467 }
0468
0469 public:
0470
0471 template <class TYPE>
0472 StatusCode item( const std::string& name, Item<TYPE>& result ) {
0473 return i_item( name, result.m_ptr );
0474 }
0475
0476 template <class TYPE>
0477 StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
0478 return i_item( name, result.m_ptr );
0479 }
0480
0481 template <class TYPE>
0482 StatusCode item( const std::string& name, Array<TYPE>& result ) {
0483 return i_item( name, result.m_ptr );
0484 }
0485
0486 template <class TYPE>
0487 StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
0488 return i_item( name, result.m_ptr );
0489 }
0490
0491 template <class TYPE>
0492 StatusCode item( const std::string& name, Matrix<TYPE>& result ) {
0493 return i_item( name, result.m_ptr );
0494 }
0495
0496
0497 template <class TYPE>
0498 StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
0499 return i_item( name, result.m_ptr );
0500 }
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515 template <class TYPE>
0516 StatusCode addItem( const std::string& name, Item<TYPE>& itm ) {
0517 typedef Range<TYPE> _R;
0518 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
0519 }
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529 template <class TYPE>
0530 StatusCode addItem( const std::string& name, Item<TYPE*>& itm ) {
0531 return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
0532 }
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542 StatusCode addItem( const std::string& name, Item<IOpaqueAddress*>& itm ) {
0543 typedef Range<IOpaqueAddress*> _R;
0544 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
0545 }
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564 template <class TYPE, class RANGE>
0565 StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
0566 return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
0567 }
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582 template <class TYPE>
0583 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array ) {
0584 return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
0585 }
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606 template <class TYPE, class RANGE>
0607 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
0608 return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
0609 }
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641 template <class TYPE, class INDEX, class RANGE>
0642 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
0643 const RANGE high ) {
0644 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
0645 }
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672 template <class TYPE, class INDEX, class RANGE>
0673 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
0674 const RANGE high ) {
0675 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
0676 }
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702 template <class TYPE, class INDEX>
0703 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
0704 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0705 array.m_ptr );
0706 }
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727 template <class TYPE, class INDEX>
0728 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
0729 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0730 array.m_ptr );
0731 }
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750 template <class TYPE>
0751 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
0752 return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
0753 }
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777 template <class TYPE, class RANGE>
0778 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
0779 const RANGE high ) {
0780 return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
0781 }
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808 template <class TYPE, class INDEX>
0809 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
0810 return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0811 matrix.m_ptr );
0812 }
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834 template <class TYPE, class INDEX>
0835 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
0836 return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
0837 Range<TYPE>::max(), matrix.m_ptr );
0838 }
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872 template <class TYPE, class INDEX, class RANGE>
0873 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
0874 const RANGE high ) {
0875 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
0876 }
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905 template <class TYPE, class INDEX, class RANGE>
0906 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, long rows, Matrix<TYPE>& matrix,
0907 const RANGE low, const RANGE high ) {
0908 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
0909 }
0910 };
0911
0912
0913
0914 struct Directory : DataObject {
0915
0916 static const CLID& classID() { return CLID_NTupleDirectory; }
0917
0918 const CLID& clID() const override { return classID(); }
0919 };
0920
0921
0922
0923 class File : public Directory {
0924 protected:
0925
0926 std::string m_name;
0927
0928 std::string m_logName;
0929
0930 long m_type = 0;
0931
0932 bool m_isOpen = false;
0933
0934 public:
0935 File() = default;
0936
0937 File( long type, std::string name, std::string logName )
0938 : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
0939
0940
0941 static const CLID& classID() { return CLID_NTupleFile; }
0942
0943 const CLID& clID() const override { return classID(); }
0944
0945 void setType( const long typ ) { m_type = typ; }
0946
0947 long type() const { return m_type; }
0948
0949 const std::string& name() const { return m_name; }
0950
0951 void setName( std::string nam ) { m_name = std::move( nam ); }
0952
0953 const std::string& logicalName() const { return m_logName; }
0954
0955 void setLogicalName( std::string l ) { m_logName = std::move( l ); }
0956
0957 void setOpen( bool flag ) { m_isOpen = flag; }
0958
0959 bool isOpen() const { return m_isOpen; }
0960 };
0961
0962
0963
0964 template <>
0965 class Array<IOpaqueAddress*> {
0966 Array() = delete;
0967
0968 public:
0969 virtual ~Array() = default;
0970 virtual void dummy() = 0;
0971 };
0972 template <>
0973 class Matrix<IOpaqueAddress*> {
0974 Matrix() = delete;
0975
0976 public:
0977 virtual ~Matrix() = default;
0978 virtual void dummy() = 0;
0979 };
0980
0981 #ifndef ALLOW_ALL_TYPES
0982 #else
0983 typedef Item<bool> BoolItem;
0984 typedef Item<char> CharItem;
0985 typedef Item<unsigned char> UCharItem;
0986 typedef Item<short> ShortItem;
0987 typedef Item<unsigned short> UShortItem;
0988 typedef Item<long> LongItem;
0989 typedef Item<long long> LongLongItem;
0990 typedef Item<unsigned long> ULongItem;
0991 typedef Item<unsigned long long> ULongLongItem;
0992 typedef Item<int> IntItem;
0993 typedef Item<unsigned int> UIntItem;
0994 typedef Item<float> FloatItem;
0995 typedef Item<double> DoubleItem;
0996 typedef Array<bool> BoolArray;
0997 typedef Array<char> CharArray;
0998 typedef Array<unsigned char> UCharArray;
0999 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 }
1025
1026
1027 typedef SmartDataPtr<NTuple::Tuple> NTuplePtr;
1028 typedef SmartDataPtr<NTuple::Directory> NTupleDirPtr;
1029 typedef SmartDataPtr<NTuple::File> NTupleFilePtr;
1030
1031 #endif