Gaudi Framework, version v23r3

Home   Generated: Thu Jun 28 2012

TupleDecorator.cpp

Go to the documentation of this file.
00001 // $Id: TupleDecorator.cpp,v 1.7 2007/08/07 14:05:33 marcocle Exp $
00002 #ifdef __ICC
00003 // disable icc remark #1572: floating-point equality and inequality comparisons are unreliable
00004 //   Coming from ROOT GenVector
00005 #pragma warning(disable:1572)
00006 #endif
00007 // ============================================================================
00008 // Include files
00009 // ============================================================================
00010 // CLHEP
00011 // ============================================================================/
00012 #include "CLHEP/Matrix/GenMatrix.h"
00013 #include "CLHEP/Matrix/Matrix.h"
00014 #include "CLHEP/Matrix/Vector.h"
00015 // Handle CLHEP 2.0.x move to CLHEP namespace
00016 namespace CLHEP { }
00017 using namespace CLHEP;
00018 // ============================================================================/
00019 // GaudiAlg
00020 // ============================================================================
00021 #include "GaudiAlg/TupleObj.h"
00022 #include "GaudiAlg/Tuple.h"
00023 // ============================================================================
00024 // GaudiPython
00025 // ============================================================================
00026 #include "GaudiPython/Vector.h"
00027 #include "GaudiPython/TupleDecorator.h"
00028 // ===========================================================================
00034 // ============================================================================
00035 namespace
00036 {
00037   // ==========================================================================
00038   template <class TYPE>
00039   inline StatusCode _fill ( const Tuples::Tuple& tuple ,
00040                             const std::string&   name  ,
00041                             const TYPE&          value )
00042   {
00043     return tuple.valid() ? tuple->column(name,value) : StatusCode::FAILURE ;
00044   }
00045   // ==========================================================================
00046 }
00047 // ============================================================================
00048 INTuple* GaudiPython::TupleDecorator::nTuple
00049 ( const Tuples::Tuple& tuple )
00050 {
00051   if ( !tuple.valid() ) { return 0 ; }
00052   return tuple->tuple() ;
00053 }
00054 // ============================================================================
00055 NTuple::Tuple* GaudiPython::TupleDecorator::ntuple
00056 ( const Tuples::Tuple& tuple )
00057 {
00058   if ( !tuple.valid() ) { return 0 ; }
00059   return tuple->tuple() ;
00060 }
00061 // ============================================================================
00062 bool        GaudiPython::TupleDecorator::valid
00063 ( const Tuples::Tuple& tuple ) { return tuple.valid() ; }
00064 // ============================================================================
00065 StatusCode  GaudiPython::TupleDecorator::write
00066 ( const Tuples::Tuple& tuple )
00067 {
00068   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00069   return tuple->write();
00070 }
00071 // ============================================================================
00072 StatusCode GaudiPython::TupleDecorator::column
00073 ( const Tuples::Tuple& tuple ,
00074   const std::string&   name  ,
00075   const int            value )
00076 { return _fill ( tuple , name , value ) ; }
00077 // ============================================================================
00078 StatusCode GaudiPython::TupleDecorator::column
00079 ( const Tuples::Tuple& tuple ,
00080   const std::string&   name  ,
00081   const int            value ,
00082   const int            minv  ,
00083   const int            maxv  )
00084 {
00085   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00086   return tuple -> column ( name , value , minv , maxv ) ;
00087 }
00088 // ============================================================================
00089 StatusCode GaudiPython::TupleDecorator::column
00090 ( const Tuples::Tuple& tuple ,
00091   const std::string&   name  ,
00092   const double         value )
00093 { return _fill ( tuple , name , value ) ; }
00094 // ============================================================================
00095 StatusCode GaudiPython::TupleDecorator::column_ll
00096 ( const Tuples::Tuple& tuple ,
00097   const std::string&   name  ,
00098   const long long      value )
00099 { return _fill ( tuple , name , value ) ; }
00100 // ============================================================================
00101 StatusCode GaudiPython::TupleDecorator::column_ull
00102 ( const Tuples::Tuple&     tuple ,
00103   const std::string&       name  ,
00104   const unsigned long long value )
00105 { return _fill ( tuple , name , value ) ; }
00106 // ============================================================================
00107 StatusCode GaudiPython::TupleDecorator::column
00108 ( const Tuples::Tuple& tuple ,
00109   const std::string&   name  ,
00110   const bool           value )
00111 { return _fill ( tuple , name , value ) ; }
00112 // ============================================================================
00113 StatusCode GaudiPython::TupleDecorator::column
00114 ( const Tuples::Tuple&  tuple ,
00115   const std::string&    name  ,
00116   IOpaqueAddress*       value )
00117 {
00118   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00119   return tuple->column( name , value ) ;
00120 }
00121 // ============================================================================
00122 StatusCode GaudiPython::TupleDecorator::column
00123 ( const Tuples::Tuple&  tuple ,
00124   IOpaqueAddress*       value )    
00125 { return column ( tuple , "Address" , value ) ; }
00126 // ============================================================================
00127 StatusCode GaudiPython::TupleDecorator::column
00128 ( const Tuples::Tuple&        tuple ,
00129   const std::string&          name  ,
00130   const Gaudi::LorentzVector& value )
00131 { return _fill ( tuple , name , value ) ; }
00132 // ============================================================================
00133 StatusCode GaudiPython::TupleDecorator::column
00134 ( const Tuples::Tuple&               tuple ,
00135   const std::string&                 name  ,
00136   const Gaudi::XYZVector&            value )
00137 { return _fill ( tuple , name , value ) ; }
00138 // ============================================================================
00139 StatusCode GaudiPython::TupleDecorator::column
00140 ( const Tuples::Tuple&               tuple ,
00141   const std::string&                 name  ,
00142   const Gaudi::XYZPoint&             value )
00143 { return _fill ( tuple , name , value ) ; }
00144 // ============================================================================
00145 StatusCode GaudiPython::TupleDecorator::farray
00146 ( const Tuples::Tuple&       tuple  ,
00147   const std::string&         name   ,
00148   const std::vector<double>& data   ,
00149   const std::string&         length ,
00150   const size_t               maxv   )
00151 {
00152   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00153   return tuple->farray( name , data.begin() , data.end() , length , maxv ) ;
00154 }
00155 // ============================================================================
00156 StatusCode GaudiPython::TupleDecorator::fmatrix
00157 ( const Tuples::Tuple&           tuple  ,
00158   const std::string&             name   ,
00159   const GaudiPython::Matrix&     data   ,
00160   const Tuples::TupleObj::MIndex cols   , // fixed !!!
00161   const std::string&             length ,
00162   const size_t                   maxv   )
00163 {
00164   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00165   if ( !data.empty() && cols != data.front().size() )
00166   { return tuple ->
00167       Error  ("GP:fmatrix(1): mismatch in matrix dimensions!" ) ; }
00168   return tuple->fmatrix( name , data , data.size() , cols , length , maxv ) ;
00169 }
00170 // ============================================================================
00171 StatusCode GaudiPython::TupleDecorator::fmatrix
00172 ( const Tuples::Tuple&                     tuple  ,
00173   const std::string&                       name   ,
00174   const GaudiUtils::VectorMap<int,double>& info   ,
00175   const std::string&                       length ,
00176   const size_t                             maxv   )
00177 {
00178   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00179   return tuple->fmatrix ( name , info , length , maxv ) ;
00180 }
00181 // ============================================================================
00182 StatusCode GaudiPython::TupleDecorator::array
00183 ( const Tuples::Tuple&       tuple  ,
00184   const std::string&         name   ,
00185   const std::vector<double>& data   )
00186 {
00187   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00188   return tuple->array ( name , data.begin() , data.end() ) ;
00189 }
00190 // ============================================================================
00191 StatusCode GaudiPython::TupleDecorator::array
00192 ( const Tuples::Tuple&        tuple  ,
00193   const std::string&          name   ,
00194   const Gaudi::Vector1&       data   )
00195 {
00196   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00197   return tuple->array( name , data ) ;
00198 }
00199 // ============================================================================
00200 StatusCode GaudiPython::TupleDecorator::array
00201 ( const Tuples::Tuple&        tuple  ,
00202   const std::string&          name   ,
00203   const Gaudi::Vector2&       data   )
00204 {
00205   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00206   return tuple->array( name , data ) ;
00207 }
00208 // ============================================================================
00209 StatusCode GaudiPython::TupleDecorator::array
00210 ( const Tuples::Tuple&        tuple  ,
00211   const std::string&          name   ,
00212   const Gaudi::Vector3&       data   )
00213 {
00214   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00215   return tuple->array( name , data.begin() , data.begin() + 3  ) ;
00216 }
00217 // ============================================================================
00218 StatusCode GaudiPython::TupleDecorator::array
00219 ( const Tuples::Tuple&        tuple  ,
00220   const std::string&          name   ,
00221   const Gaudi::Vector4&       data   )
00222 {
00223   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00224   // return tuple->array( name , data ) ;
00225   return tuple->array( name , data.begin() , data.begin()+4 ) ;
00226 }
00227 // ============================================================================
00228 StatusCode GaudiPython::TupleDecorator::array
00229 ( const Tuples::Tuple&        tuple  ,
00230   const std::string&          name   ,
00231   const Gaudi::Vector5&       data   )
00232 {
00233   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00234   return tuple->array( name , data ) ;
00235 }
00236 // ============================================================================
00237 StatusCode GaudiPython::TupleDecorator::array
00238 ( const Tuples::Tuple&        tuple  ,
00239   const std::string&          name   ,
00240   const Gaudi::Vector6&       data   )
00241 {
00242   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00243   return tuple->array( name , data ) ;
00244 }
00245 // ============================================================================
00246 StatusCode GaudiPython::TupleDecorator::array
00247 ( const Tuples::Tuple&        tuple  ,
00248   const std::string&          name   ,
00249   const Gaudi::Vector7&       data   )
00250 {
00251   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00252   return tuple->array( name , data ) ;
00253 }
00254 // ============================================================================
00255 StatusCode GaudiPython::TupleDecorator::array
00256 ( const Tuples::Tuple&        tuple  ,
00257   const std::string&          name   ,
00258   const Gaudi::Vector8&       data   )
00259 {
00260   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00261   return tuple->array( name , data ) ;
00262 }
00263 // ============================================================================
00264 StatusCode GaudiPython::TupleDecorator::array
00265 ( const Tuples::Tuple&        tuple  ,
00266   const std::string&          name   ,
00267   const Gaudi::Vector9&       data   )
00268 {
00269   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00270   return tuple->array( name , data ) ;
00271 }
00272 // ============================================================================
00273 StatusCode GaudiPython::TupleDecorator::matrix
00274 ( const Tuples::Tuple&            tuple ,
00275   const std::string&              name   ,
00276   const GaudiPython::Matrix&      data  ,
00277   const Tuples::TupleObj::MIndex  cols  )  // fixed !!!
00278 {
00279   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00280   if ( data.empty()   )
00281   { return tuple ->
00282       Warning ("GP:matrix(1): empty fixed matrix, skip matrix "    ) ; }
00283   if ( cols != data.front().size() )
00284   { return tuple ->
00285       Error  ("GP:matrix(1): mismatch in fixed matrix dimensions!" ) ; }
00286   return tuple -> matrix ( name , data , data.size() , cols  ) ;
00287 }
00288 // ============================================================================
00289 StatusCode GaudiPython::TupleDecorator::matrix
00290 ( const Tuples::Tuple&    tuple ,
00291   const std::string&      name  ,
00292   const Gaudi::Matrix1x1& data  )
00293 {
00294   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00295   return tuple->matrix ( name , data ) ;
00296 }
00297 // ============================================================================
00298 StatusCode GaudiPython::TupleDecorator::matrix
00299 ( const Tuples::Tuple&    tuple ,
00300   const std::string&      name  ,
00301   const Gaudi::Matrix2x2& data  )
00302 {
00303   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00304   return tuple->matrix ( name , data ) ;
00305 }
00306 // ============================================================================
00307 StatusCode GaudiPython::TupleDecorator::matrix
00308 ( const Tuples::Tuple&    tuple ,
00309   const std::string&      name  ,
00310   const Gaudi::Matrix3x3& data  )
00311 {
00312   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00313   return tuple->matrix ( name , data ) ;
00314 }
00315 // ============================================================================
00316 StatusCode GaudiPython::TupleDecorator::matrix
00317 ( const Tuples::Tuple&    tuple ,
00318   const std::string&      name  ,
00319   const Gaudi::Matrix4x4& data  )
00320 {
00321   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00322   return tuple->matrix ( name , data ) ;
00323 }
00324 // ============================================================================
00325 StatusCode GaudiPython::TupleDecorator::matrix
00326 ( const Tuples::Tuple&    tuple ,
00327   const std::string&      name  ,
00328   const Gaudi::Matrix5x5& data  )
00329 {
00330   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00331   return tuple->matrix ( name , data ) ;
00332 }
00333 // ============================================================================
00334 StatusCode GaudiPython::TupleDecorator::matrix
00335 ( const Tuples::Tuple&    tuple ,
00336   const std::string&      name  ,
00337   const Gaudi::Matrix6x6& data  )
00338 {
00339   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00340   return tuple->matrix ( name , data ) ;
00341 }
00342 // ============================================================================
00343 StatusCode GaudiPython::TupleDecorator::matrix
00344 ( const Tuples::Tuple&    tuple ,
00345   const std::string&      name  ,
00346   const Gaudi::Matrix7x7& data  )
00347 {
00348   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00349   return tuple->matrix ( name , data ) ;
00350 }
00351 // ============================================================================
00352 StatusCode GaudiPython::TupleDecorator::matrix
00353 ( const Tuples::Tuple&    tuple ,
00354   const std::string&      name  ,
00355   const Gaudi::Matrix8x8& data  )
00356 {
00357   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00358   return tuple->matrix ( name , data ) ;
00359 }
00360 // ============================================================================
00361 StatusCode GaudiPython::TupleDecorator::matrix
00362 ( const Tuples::Tuple&    tuple ,
00363   const std::string&      name  ,
00364   const Gaudi::Matrix9x9& data  )
00365 {
00366   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00367   return tuple->matrix ( name , data ) ;
00368 }
00369 // ============================================================================
00370 StatusCode GaudiPython::TupleDecorator::matrix
00371 ( const Tuples::Tuple&    tuple ,
00372   const std::string&      name  ,
00373   const Gaudi::Matrix1x3& data  )
00374 {
00375   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00376   return tuple->matrix ( name , data ) ;
00377 }
00378 // ============================================================================
00379 StatusCode GaudiPython::TupleDecorator::matrix
00380 ( const Tuples::Tuple&    tuple ,
00381   const std::string&      name  ,
00382   const Gaudi::Matrix1x5& data  )
00383 {
00384   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00385   return tuple->matrix ( name , data ) ;
00386 }
00387 // ============================================================================
00388 StatusCode GaudiPython::TupleDecorator::matrix
00389 ( const Tuples::Tuple&    tuple ,
00390   const std::string&      name  ,
00391   const Gaudi::Matrix1x6& data  )
00392 {
00393   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00394   return tuple->matrix ( name , data ) ;
00395 }
00396 // ============================================================================
00397 StatusCode GaudiPython::TupleDecorator::matrix
00398 ( const Tuples::Tuple&    tuple ,
00399   const std::string&      name  ,
00400   const Gaudi::Matrix4x3& data  )
00401 {
00402   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00403   return tuple->matrix ( name , data ) ;
00404 }
00405 // ============================================================================
00406 StatusCode GaudiPython::TupleDecorator::matrix
00407 ( const Tuples::Tuple&    tuple ,
00408   const std::string&      name  ,
00409   const Gaudi::Matrix3x4& data  )
00410 {
00411   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00412   return tuple->matrix ( name , data ) ;
00413 }
00414 // ============================================================================
00415 StatusCode GaudiPython::TupleDecorator::matrix
00416 ( const Tuples::Tuple&    tuple ,
00417   const std::string&      name  ,
00418   const Gaudi::Matrix3x5& data  )
00419 {
00420   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00421   return tuple->matrix ( name , data ) ;
00422 }
00423 // ============================================================================
00424 StatusCode GaudiPython::TupleDecorator::matrix
00425 ( const Tuples::Tuple&    tuple ,
00426   const std::string&      name  ,
00427   const Gaudi::Matrix3x6& data  )
00428 {
00429   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00430   return tuple->matrix ( name , data ) ;
00431 }
00432 // ============================================================================
00433 StatusCode GaudiPython::TupleDecorator::matrix
00434 ( const Tuples::Tuple&    tuple ,
00435   const std::string&      name  ,
00436   const Gaudi::Matrix2x3& data  )
00437 {
00438   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00439   return tuple->matrix ( name , data ) ;
00440 }
00441 // ============================================================================
00442 StatusCode GaudiPython::TupleDecorator::matrix
00443 ( const Tuples::Tuple&    tuple ,
00444   const std::string&      name  ,
00445   const Gaudi::Matrix3x2& data  )
00446 {
00447   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00448   return tuple->matrix ( name , data ) ;
00449 }
00450 // ============================================================================
00451 StatusCode GaudiPython::TupleDecorator::matrix
00452 ( const Tuples::Tuple&       tuple ,
00453   const std::string&         name  ,
00454   const Gaudi::SymMatrix1x1& data  )
00455 {
00456   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00457   return tuple->matrix ( name , data ) ;
00458 }
00459 // ============================================================================
00460 StatusCode GaudiPython::TupleDecorator::matrix
00461 ( const Tuples::Tuple&       tuple ,
00462   const std::string&         name  ,
00463   const Gaudi::SymMatrix2x2& data  )
00464 {
00465   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00466   return tuple->matrix ( name , data ) ;
00467 }
00468 // ============================================================================
00469 StatusCode GaudiPython::TupleDecorator::matrix
00470 ( const Tuples::Tuple&       tuple ,
00471   const std::string&         name  ,
00472   const Gaudi::SymMatrix3x3& data  )
00473 {
00474   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00475   return tuple->matrix ( name , data ) ;
00476 }
00477 // ============================================================================
00478 StatusCode GaudiPython::TupleDecorator::matrix
00479 ( const Tuples::Tuple&       tuple ,
00480   const std::string&         name  ,
00481   const Gaudi::SymMatrix4x4& data  )
00482 {
00483   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00484   return tuple->matrix ( name , data ) ;
00485 }
00486 // ============================================================================
00487 StatusCode GaudiPython::TupleDecorator::matrix
00488 ( const Tuples::Tuple&       tuple ,
00489   const std::string&         name  ,
00490   const Gaudi::SymMatrix5x5& data  )
00491 {
00492   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00493   return tuple->matrix ( name , data ) ;
00494 }
00495 // ============================================================================
00496 StatusCode GaudiPython::TupleDecorator::matrix
00497 ( const Tuples::Tuple&       tuple ,
00498   const std::string&         name  ,
00499   const Gaudi::SymMatrix6x6& data  )
00500 {
00501   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00502   return tuple->matrix ( name , data ) ;
00503 }
00504 // ============================================================================
00505 StatusCode GaudiPython::TupleDecorator::matrix
00506 ( const Tuples::Tuple&       tuple ,
00507   const std::string&         name  ,
00508   const Gaudi::SymMatrix7x7& data  )
00509 {
00510   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00511   return tuple->matrix ( name , data ) ;
00512 }
00513 // ============================================================================
00514 StatusCode GaudiPython::TupleDecorator::matrix
00515 ( const Tuples::Tuple&       tuple ,
00516   const std::string&         name  ,
00517   const Gaudi::SymMatrix8x8& data  )
00518 {
00519   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00520   return tuple->matrix ( name , data ) ;
00521 }
00522 // ============================================================================
00523 StatusCode GaudiPython::TupleDecorator::matrix
00524 ( const Tuples::Tuple&       tuple ,
00525   const std::string&         name  ,
00526   const Gaudi::SymMatrix9x9& data  )
00527 {
00528   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00529   return tuple->matrix ( name , data ) ;
00530 }
00531 // ============================================================================
00532 // advanced column: time 
00533 // ============================================================================
00534 StatusCode GaudiPython::TupleDecorator::column
00535 ( const Tuples::Tuple&            tuple ,
00536   const Gaudi::Time&              value ) 
00537 { return column ( tuple , "" , value ) ; }
00538 // ============================================================================
00539 // advanced column: time 
00540 // ============================================================================
00541 StatusCode GaudiPython::TupleDecorator::column
00542 ( const Tuples::Tuple&            tuple ,
00543   const std::string&              name  ,
00544   const Gaudi::Time&              value ) 
00545 { 
00546   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00547   StatusCode sc = StatusCode::SUCCESS ;
00548   //
00549   sc = tuple->column ( name + "year"    , value.year    ( true )     , 1970 , 2070 ) ;
00550   if ( sc.isFailure() ) { return sc ; }
00551   sc = tuple->column ( name + "month"   , value.month   ( true ) + 1 , 1    ,   16 ) ;
00552   if ( sc.isFailure() ) { return sc ; }
00553   sc = tuple->column ( name + "day"     , value.day     ( true )     , 0    ,   32 ) ;
00554   if ( sc.isFailure() ) { return sc ; }
00555   sc = tuple->column ( name + "hour"    , value.hour    ( true )     , 0    ,   25 ) ;
00556   if ( sc.isFailure() ) { return sc ; }
00557   sc = tuple->column ( name + "minute"  , value.minute  ( true )     , 0    ,   61 ) ;
00558   if ( sc.isFailure() ) { return sc ; }
00559   sc = tuple->column ( name + "second"  , value.second  ( true )     , 0    ,   61 ) ;
00560   if ( sc.isFailure() ) { return sc ; }
00561   sc = tuple->column ( name + "nsecond" , value.nsecond () ) ;
00562   //
00563   return sc ;
00564 }
00565 // ============================================================================
00566 
00567 
00568 // ============================================================================
00569 // Legacy:
00570 // ============================================================================
00571 StatusCode GaudiPython::TupleDecorator::array
00572 ( const Tuples::Tuple&       tuple  ,
00573   const std::string&         name   ,
00574   const CLHEP::HepVector&    data   )
00575 {
00576   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00577   return tuple->array( name , data , data.num_row() ) ;
00578 }
00579 // ============================================================================
00580 StatusCode GaudiPython::TupleDecorator::farray
00581 ( const Tuples::Tuple&       tuple  ,
00582   const std::string&         name   ,
00583   const CLHEP::HepVector&    data   ,
00584   const std::string&         length ,
00585   const size_t               maxv   )
00586 {
00587   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00588   // use the trick!
00589   const double* begin = &(data[0]);
00590   const double* end   =   begin + data.num_row() ;
00591   return tuple->farray ( name , begin , end , length , maxv ) ;
00592 }
00593 // ============================================================================
00594 StatusCode GaudiPython::TupleDecorator::matrix
00595 ( const Tuples::Tuple&            tuple ,
00596   const std::string&              name   ,
00597   const CLHEP::HepGenMatrix&      data  )
00598 {
00599   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00600   if ( 1 > data.num_col()   )
00601   { return tuple ->
00602       Error  ("GP:matrix(2): illegal fixed matrix num_col" ) ; }
00603   if ( 1 > data.num_row()   )
00604   { return tuple ->
00605       Error  ("GP:matrix(2): illegal fixed matrix num_row" ) ; }
00606   return tuple->matrix( name , data , data.num_row() , data.num_col() ) ;
00607 }
00608 // ============================================================================
00609 StatusCode GaudiPython::TupleDecorator::fmatrix
00610 ( const Tuples::Tuple&           tuple  ,
00611   const std::string&             name   ,
00612   const CLHEP::HepGenMatrix&     data   ,
00613   const Tuples::TupleObj::MIndex cols   , // fixed !!!
00614   const std::string&             length ,
00615   const size_t                   maxv   )
00616 {
00617   if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
00618   if ( cols != data.num_col() )
00619   { return tuple ->
00620       Error  ("GP:fmatrix(2): mismatch in matrix dimensions!" ) ; }
00621   return tuple->fmatrix( name , data , data.num_row() , cols , length , maxv ) ;
00622 }
00623 // ============================================================================
00624 
00625 
00626 
00627 
00628 // ============================================================================
00629 // Tuple-Alg-decorator
00630 // ============================================================================
00631 Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple
00632 ( const GaudiTupleAlg&     algo  ,
00633   const std::string&       title ,
00634   const CLID&              clid  )
00635 {
00636   return algo.nTuple ( title , clid ) ;
00637 }
00638 // ============================================================================
00639 Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple
00640 ( const GaudiTupleAlg&     algo  ,
00641   const GaudiAlg::TupleID& ID    ,
00642   const std::string&       title ,
00643   const CLID&              clid  )
00644 {
00645   return algo.nTuple ( ID , title , clid ) ;
00646 }
00647 // ============================================================================
00648 Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple
00649 ( const GaudiTupleAlg&     algo  ,
00650   const int                ID    ,
00651   const std::string&       title ,
00652   const CLID&              clid  )
00653 {
00654   return algo.nTuple ( ID , title , clid ) ;
00655 }
00656 // ============================================================================
00657 Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple
00658 ( const GaudiTupleAlg&     algo  ,
00659   const std::string&       ID    ,
00660   const std::string&       title ,
00661   const CLID&              clid  )
00662 {
00663   return algo.nTuple ( ID , title , clid ) ;
00664 }
00665 // ============================================================================
00666 Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol
00667 ( const GaudiTupleAlg&     algo  ,
00668   const std::string&       title ,
00669   const CLID&              clid  )
00670 {
00671   return algo.evtCol ( title , clid ) ;
00672 }
00673 // ============================================================================
00674 Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol
00675 ( const GaudiTupleAlg&     algo  ,
00676   const GaudiAlg::TupleID& ID    ,
00677   const std::string&       title ,
00678   const CLID&              clid  )
00679 {
00680   return algo.evtCol ( ID , title , clid ) ;
00681 }
00682 // ============================================================================
00683 Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol
00684 ( const GaudiTupleAlg&     algo  ,
00685   const int                ID    ,
00686   const std::string&       title ,
00687   const CLID&              clid  )
00688 {
00689   return algo.evtCol ( ID , title , clid ) ;
00690 }
00691 // ============================================================================
00692 Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol
00693 ( const GaudiTupleAlg&     algo  ,
00694   const std::string&       ID    ,
00695   const std::string&       title ,
00696   const CLID&              clid  )
00697 {
00698   return algo.evtCol ( ID , title , clid ) ;
00699 }
00700 // ============================================================================
00701 // The END
00702 // ============================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 12:30:01 for Gaudi Framework, version v23r3 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004