42 using std::runtime_error;
44 using namespace hippodraw;
50 m_cur_entry ( UINT_MAX )
59 m_cur_entry ( UINT_MAX )
67 BranchList_t::iterator first =
m_data.begin();
68 while ( first !=
m_data.end() ) {
74 vector< double > * p = *cache++;
90 TObjArray * branches =
m_tree -> GetListOfBranches ();
91 Int_t number = branches -> GetEntries ();
93 for ( Int_t i = 0; i < number; i++ )
95 TObject *
object = branches -> At ( i );
99 branch -> SetBasketSize ( 320000 );
102 const string name =
object -> GetName ();
109 m_dups.push_back ( name );
111 m_data [ index ] = h_branch;
121 const std::vector < int > & sz,
126 if( d < sz.size() - 1 )
132 full = ( wheels[d] ==
static_cast< int >( sz[d] ) ) ?
144 full = ( wheels[d] ==
static_cast< int >( sz[d] ) ) ?
true :
false;
165 Double_t number =
m_tree -> GetEntries ();
166 return static_cast <
unsigned int > ( number );
174 vector < double > * cache =
new vector < double > (
size );
176 for (
unsigned int row = 0; row <
size; row++ ) {
177 double value = data ->
valueAt ( row );
208 if ( column <
m_data.size () ) {
210 value = data ->
valueAt ( row );
213 value =
valueAt ( row, column );
268 for (
unsigned int i = 0; i <
m_data_cache.size (); i++ ) {
295 const vector < double > &
299 const vector < string > & labels =
getLabels ();
300 unsigned int size = labels.size();
302 const string & label = labels [
column ];
307 std::string what (
"RootNTuple: can not export data source\n"
308 "because some column(s) cantain\n"
309 " variable length data" );
310 throw runtime_error ( what );
333 string what (
"RootNTuple Attempt to add a column whose label"
334 " is same as other column." );
335 throw runtime_error ( what );
338 m_data.push_back ( branch );
349 const std::vector < double > & col )
354 string what (
"RootNTuple Attempt to add a column whose label"
355 " is same as other column." );
356 throw runtime_error ( what );
359 unsigned int new_size = col.size ();
361 if (
m_data.empty () == false ) {
362 unsigned int old_size =
rows ();
364 if ( old_size != 0 && old_size != new_size ) {
365 string what (
"RootNTuple Attempt to add a column whose size"
366 " is not equal to other columns." );
367 throw runtime_error ( what );
370 vector < double > *
vec =
new vector < double > ( col );
382 const std::vector < double > &
data )
387 (
"RootNTuple: Attempt to replace non-existant column." );
388 throw runtime_error ( what );
392 unsigned int new_size = data.size ();
393 if ( size != 0 && size != new_size ) {
395 (
"RootNTuple: Attempt to replace column with one whose "
396 "size is not equal to other columns." );
397 throw runtime_error ( what );
400 std::copy ( data.begin(), data.end(),
m_data_cache [ col ] -> begin() );
413 const vector < unsigned int > &
425 unsigned int colIndex =
indexOf( column );
434 unsigned int colIndex =
indexOf( column );
449 BranchList_t::size_type
size =
m_data.size ();
450 if ( column < size ) {
452 const vector < int > & sub_shape = col ->
getShape ();
453 unsigned int rank = sub_shape.size ();
455 for (
unsigned int i = 0; i <
rank; i++ ) {
456 shape.push_back ( sub_shape [ i ] );
464 const std::vector< unsigned int >& index )
469 unsigned int colIndex =
indexOf ( column );
483 unsigned int colIndex =
indexOf ( column );
501 const vector< string > & labels =
getLabels();
503 for(
unsigned int i = 0; i < labels.size(); i++ ) {
504 const string & label = labels[i];
505 if( label.find( column +
"[" ) != string::npos ) {
514 unsigned int colIndex =
indexOf ( column );
518 unsigned int dims = colRootBranch ->
getRank ();
519 const vector < int > & sz =colRootBranch ->
getShape ();
520 int nelems = colRootBranch -> numberOfElements();
522 vector< unsigned int > indx( dims, 0);
524 vector< int > wheels( dims, 0);
525 wheels[ dims - 1 ] = -1;
528 for(
int i = 0; i < nelems; i++ )
530 #ifdef SSTREAM_DEFECT
531 std::ostrstream namestream;
533 std::ostringstream namestream;
538 for (
unsigned int j = 0; j < dims; j++ ) {
539 namestream <<
"[" << wheels[ j ] <<
"]";
542 colTBranch -> SetBasketSize ( 320000 );
545 for(
unsigned int k = 0; k < wheels.size(); k++ )
546 indx[ k ] = static_cast< unsigned int > ( wheels[ k ] );
549 rtuple ->
addColumn ( namestream.str(), h_branch );
560 string::size_type pos = column.find_first_of (
'[' );
562 if ( pos != string::npos ) {
563 const string label = column.substr ( 0, pos );
575 unsigned int size = labels.size ();
577 for (
unsigned int i = 0; i <
size; i++ ) {
578 const string &
column = labels [ i ];
583 const vector < double > &
595 const vector < double > &
598 const std::vector < int > & indices )
const
605 const vector < double > &
622 const std::vector < int > & indices )
const
624 string text ( label );
626 unsigned int size = indices.size();
627 for (
unsigned int i = 0; i <
size; i++ ) {