Gaudi Framework, version v23r2

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

Generated at Thu Jun 28 2012 23:27:28 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004