5 #ifndef GAUDIALG_TUPLEOBJ_H
6 #define GAUDIALG_TUPLEOBJ_H 1
28 #include "Math/Point3D.h"
29 #include "Math/Vector3D.h"
30 #include "Math/Vector4D.h"
31 #include "Math/SVector.h"
32 #include "Math/SMatrix.h"
291 const double value );
353 const unsigned short value );
373 const unsigned short value ,
374 const unsigned short minv ,
375 const unsigned short maxv );
437 const unsigned char value );
457 const unsigned char value ,
458 const unsigned char minv ,
459 const unsigned char maxv );
521 const unsigned int value );
541 const unsigned int value ,
542 const unsigned int minv ,
543 const unsigned int maxv );
607 const unsigned long value );
627 const unsigned long value ,
628 const unsigned long minv ,
629 const unsigned long maxv );
649 const long long value );
669 const long long value ,
670 const long long minv ,
671 const long long maxv );
691 const unsigned long long value );
711 const unsigned long long value ,
712 const unsigned long long minv ,
713 const unsigned long long maxv );
733 const signed char value )
879 template <
class DATA>
890 if( first + maxv < last )
892 Warning(
"farray('"+name+
"'): array is overflow, skip extra items") ;
893 last = first + maxv ;
897 Int* len = ints( length , 0 , maxv ) ;
901 *len = last - first ;
904 FArray* var = fArray ( name , len ) ;
909 for( ; first != last ; ++first )
910 { (*var)[ index ] = (float)(*first) ; ++index ; }
957 template <
class DATA>
962 {
return farray ( name , data.begin() , data.end() , length , maxv ) ; }
1026 template <
class FUNCTION,
class DATA>
1028 const FUNCTION&
function ,
1038 if( first + maxv < last )
1041 + name +
"'): array is overflow, skip extra entries") ;
1042 last = first + maxv ;
1046 Int* len = ints( length , 0 , maxv ) ;
1050 *len = last - first ;
1053 FArray* var = fArray ( name , len ) ;
1058 for( ; first != last ; ++first )
1059 { (*var)[ index ] =
function( *first ) ; ++index ; }
1095 template <
class FUNC1,
class FUNC2,
class DATA>
1097 const FUNC1& func1 ,
1099 const FUNC2& func2 ,
1109 if( first + maxv < last )
1113 + name2 +
"'): array is overflow, skip extra entries").ignore() ;
1114 Warning(
"farray('"+name1+
"'): array is overflow, skip extra items").ignore() ;
1115 last = first + maxv ;
1119 Int* len = ints ( length , 0 , maxv ) ;
1123 *len = last - first ;
1126 FArray* var1 = fArray ( name1 , len ) ;
1130 FArray* var2 = fArray ( name2 , len ) ;
1135 for( ; first != last ; ++first )
1137 ( *var1 ) [ index ] = func1 ( *first ) ;
1138 ( *var2 ) [ index ] = func2 ( *first ) ;
1181 template <
class FUNC1,
class FUNC2,
class FUNC3,
class DATA>
1183 const FUNC1& func1 ,
1185 const FUNC2& func2 ,
1187 const FUNC3& func3 ,
1197 if( first + maxv < last )
1202 + name3 +
"'): array is overflow, skip extra entries").ignore() ;
1203 last = first + maxv ;
1207 Int* len = ints ( length , 0 , maxv ) ;
1211 *len = last - first ;
1214 FArray* var1 = fArray ( name1 , len ) ;
1218 FArray* var2 = fArray ( name2 , len ) ;
1222 FArray* var3 = fArray ( name3 , len ) ;
1227 for( ; first != last ; ++first )
1229 ( *var1 ) [ index ] = (float)func1 ( *first ) ;
1230 ( *var2 ) [ index ] = (float)func2 ( *first ) ;
1231 ( *var3 ) [ index ] = (float)func3 ( *first ) ;
1276 template <
class FUNC1,
class FUNC2,
class FUNC3,
class FUNC4,
class DATA>
1278 const FUNC1& func1 ,
1280 const FUNC2& func2 ,
1282 const FUNC3& func3 ,
1284 const FUNC4& func4 ,
1294 if( first + maxv < last )
1300 + name4 +
"'): array is overflow, skip extra entries").ignore() ;
1301 last = first + maxv ;
1305 Int* len = ints ( length , 0 , maxv ) ;
1309 *len = last - first ;
1312 FArray* var1 = fArray ( name1 , len ) ;
1316 FArray* var2 = fArray ( name2 , len ) ;
1320 FArray* var3 = fArray ( name3 , len ) ;
1324 FArray* var4 = fArray ( name4 , len ) ;
1329 for( ; first != last ; ++first )
1331 ( *var1 ) [ index ] =
static_cast<float> ( func1 ( *first ) );
1332 ( *var2 ) [ index ] =
static_cast<float> ( func2 ( *first ) );
1333 ( *var3 ) [ index ] =
static_cast<float> ( func3 ( *first ) );
1334 ( *var4 ) [ index ] =
static_cast<float> ( func4 ( *first ) );
1393 template <
class MATRIX>
1395 const MATRIX& data ,
1407 Warning (
"fmatrix('"+name+
"'): matrix is overflow, skip extra items").ignore() ;
1408 rows = ( 0 < maxv ) ? ( maxv - 1 ) : 0 ;
1412 Int* len = ints( length , 0 , maxv ) ;
1419 FMatrix* var = fMatrix ( name , len , cols ) ;
1423 for (
size_t iCol = 0 ; iCol < cols ; ++iCol )
1425 for (
MIndex iRow = 0 ; iRow < rows ; ++iRow )
1426 { (*var)[ iRow ] [ iCol ] = (float)(data[ iRow ][ iCol ]) ; }
1468 template <
class DATA>
1480 if ( first + maxv < last )
1482 Warning(
"fmatrix('"+name+
"'): matrix is overflow, skip extra items").ignore() ;
1483 last = first + maxv ;
1487 Int* len = ints( length , 0 , maxv ) ;
1491 *len = last - first ;
1494 FMatrix* var = fMatrix ( name , len , cols ) ;
1499 for ( ; first != last ; ++first )
1502 for (
MIndex iCol = 0 ; iCol < cols ; ++iCol )
1503 { (*var)[ iRow ] [ iCol ] = (float)((*first)[ iCol ]) ; }
1589 template <
class FUN,
class DATA>
1602 if ( first + maxv < last )
1604 Warning(
"fmatrix('"+name+
"'): matrix is overflow, skip extra items").ignore() ;
1605 last = first + maxv ;
1609 Int* len = ints( length , 0 , maxv ) ;
1613 *len = last - first ;
1616 const size_t cols = funL - funF ;
1617 FMatrix* var = fMatrix ( name , len , cols ) ;
1622 for ( ; first != last ; ++first )
1625 for ( FUN fun = funF ; fun < funL ; ++fun )
1626 { (*var)[ iRow ] [ fun - funF ] = (float)((*fun) ( *first )) ; }
1658 template <
class DATA>
1668 const size_t length = last - first ;
1671 FArray* var = fArray ( name , length ) ;
1676 for ( ; first != last ; ++first )
1677 { (*var)[ iCol ] = (float)(*first) ; ++iCol ; }
1720 template <
class ARRAY>
1729 FArray* var = fArray ( name , length ) ;
1733 for (
size_t index = 0 ; index < length ; ++index )
1734 { (*var)[ index ] = (float) data[index] ; }
1768 template <
class ARRAY>
1771 {
return array ( name , data.begin() , data.end() ) ; }
1823 template <
class MATRIX>
1825 const MATRIX& data ,
1833 FMatrix* var = fMatrix ( name , rows , cols ) ;
1837 for (
size_t iCol = 0 ; iCol < cols ; ++iCol )
1839 for (
size_t iRow = 0 ; iRow < rows ; ++iRow )
1840 { (*var)[iRow][iCol] = (float)(data[iRow][iCol]) ; }
1863 template <
class TYPE>
1866 const ROOT::Math::LorentzVector<TYPE>& v )
1870 StatusCode sc1 =
this -> column ( name +
"E" , v.E () ) ;
1871 StatusCode sc2 =
this -> column ( name +
"X" , v.Px () ) ;
1872 StatusCode sc3 =
this -> column ( name +
"Y" , v.Py () ) ;
1873 StatusCode sc4 =
this -> column ( name +
"Z" , v.Pz () ) ;
1877 sc3.isFailure () ? sc3 :
1897 template <
class TYPE,
class TAG>
1900 const ROOT::Math::DisplacementVector3D<TYPE,TAG>& v )
1904 StatusCode sc1 =
this -> column ( name +
"X" , v.X () ) ;
1905 StatusCode sc2 =
this -> column ( name +
"Y" , v.Y () ) ;
1906 StatusCode sc3 =
this -> column ( name +
"Z" , v.Z () ) ;
1929 template <
class TYPE,
class TAG>
1932 const ROOT::Math::PositionVector3D<TYPE,TAG>& v )
1936 StatusCode sc1 =
this -> column ( name +
"X" , v.X () ) ;
1937 StatusCode sc2 =
this -> column ( name +
"Y" , v.Y () ) ;
1938 StatusCode sc3 =
this -> column ( name +
"Z" , v.Z () ) ;
1961 template <
class TYPE,
unsigned int DIM>
1964 const ROOT::Math::SVector<TYPE,DIM>& vect )
1966 return this->
array( name , vect.begin() , vect.end() ) ;
1977 template <
class TYPE,
unsigned int D1,
unsigned int D2,
class REP>
1980 const ROOT::Math::SMatrix<TYPE,D1,D2,REP>& mtrx )
1990 for (
size_t iCol = 0 ; iCol < D2 ; ++iCol )
1992 for (
size_t iRow = 0 ; iRow < D1 ; ++iRow )
1993 { (*var)[iRow][iCol] = (float) mtrx(iRow,iCol) ; }
2016 template <
class KEY,
class VALUE>
2021 const size_t maxv = 100 )
2031 if ( maxv < info.
size() )
2033 Warning(
"fmatrix('"+name+
"'): matrix is overflow, skip extra items") ;
2034 end = begin + maxv ;
2038 Int* len = ints( length , 0 , maxv ) ;
2042 *len = end - begin ;
2045 FMatrix* var = fMatrix ( name , len , 2 ) ;
2050 for ( ; begin !=
end ; ++begin)
2053 (*var)[iRow][0] = (float) begin->first ;
2054 (*var)[iRow][1] = (float) begin->second ;
2071 template <
class TYPE>
2098 unsigned long addRef () {
return ++m_refCount ; }
2122 bool valid ()
const {
return 0 != tuple() ; }
2136 {
return m_items.insert (
std::make_pair ( name , type ) ).second ; }
2143 {
return m_items.end() == m_items.find ( name ) ; }
2182 const unsigned char minv ,
2183 const unsigned char maxv ) ;
2191 const short maxv ) ;
2198 const unsigned short minv ,
2199 const unsigned short maxv ) ;
2214 const unsigned int minv ,
2215 const unsigned int maxv ) ;
2222 const long long minv ,
2223 const long long maxv ) ;
2226 ULongLong* ulonglongs (
const std::string& name ) ;
2230 const unsigned long long minv ,
2231 const unsigned long long maxv ) ;
2239 const MIndex& rows ) ;
2247 const MIndex& cols ) ;
2251 const MIndex& rows ,
2252 const MIndex& cols ) ;
2387 #endif // GAUDIALG_TUPLEOBJ_H