@@ -369,71 +369,7 @@ namespace larcv {
369369 LARCV_DEBUG () << " Current input tree index: " << _in_tree_index << std::endl;
370370 return true ;
371371 }
372-
373-
374- bool IOManager::save_entry (const std::string& type, const std::string& producer)
375- {
376- LARCV_DEBUG () << " start" << std::endl;
377-
378- if (!_prepared) {
379- LARCV_CRITICAL () << " Cannot be called before initialize()!" << std::endl;
380- throw larbys ();
381- }
382-
383- if (_io_mode == kREAD ) {
384- LARCV_ERROR () << " Cannot save in READ mode..." << std::endl;
385- return false ;
386- }
387-
388- TTree* current_tree = nullptr ;
389- EventBase* current_product = nullptr ;
390-
391- auto prod_name = ProducerName_t (type, producer);
392- std::string tree_name = prod_name.first + " _" + prod_name.second + " _tree" ;
393- // Find the tree by name
394- for (size_t i = 0 ; i < _out_tree_v.size (); ++i) {
395- if (!_out_tree_v[i]) break ;
396- if (std::string (_out_tree_v[i]->GetName ()) == tree_name) {
397- current_tree = _out_tree_v[i];
398- current_product = _product_ptr_v[i];
399- break ;
400- }
401- }
402-
403- if (!current_tree) {
404- LARCV_ERROR () << " Tree with name \" " << tree_name << " \" not found!" << std::endl;
405- return false ;
406- }
407-
408- LARCV_INFO () << " Saving new entry in current tree " << current_tree->GetName () << std::endl;
409-
410- set_id ();
411-
412- // Update event ID if not set externally
413- if (!_set_event_id.valid ()) {
414- current_product->_run = _event_id.run ();
415- current_product->_subrun = _event_id.subrun ();
416- current_product->_event = _event_id.event ();
417- }
418-
419- // Fill the current tree
420- current_tree->Fill ();
421-
422- // Clear the product data
423- current_product->clear ();
424-
425- // Clear event ID
426- _event_id.clear ();
427- _set_event_id.clear ();
428-
429- _out_tree_entries += 1 ;
430- _out_tree_index += 1 ;
431-
432- return true ;
433- }
434-
435-
436-
372+
437373 bool IOManager::save_entry ()
438374 {
439375 LARCV_DEBUG () << " start" << std::endl;
@@ -505,14 +441,14 @@ namespace larcv {
505441 p->clear ();
506442 }
507443 }
444+
508445 clear_entry ();
509446
510447 _out_tree_entries += 1 ;
511448 _out_tree_index += 1 ;
512449
513450 return true ;
514451 }
515-
516452 void IOManager::clear_entry ()
517453 {
518454 for (auto & p : _product_ptr_v) {
@@ -616,7 +552,6 @@ namespace larcv {
616552 __ioman_mtx.unlock ();
617553 return _product_ptr_v[id];
618554 }
619-
620555 void IOManager::set_id (const size_t run, const size_t subrun, const size_t event) {
621556
622557 if (_io_mode == kREAD ) {
@@ -636,8 +571,7 @@ namespace larcv {
636571
637572 _set_event_id = tmp;
638573
639- }
640-
574+ }
641575 void IOManager::set_id () {
642576 LARCV_DEBUG () << " start" << std::endl;
643577
@@ -667,8 +601,7 @@ namespace larcv {
667601 }
668602
669603 }
670- }
671-
604+ }
672605 void IOManager::finalize ()
673606 {
674607 LARCV_DEBUG () << " start" << std::endl;
@@ -693,7 +626,7 @@ namespace larcv {
693626 LARCV_NORMAL () << " Writing " << t->GetName () << " with " << t->GetEntries () << " entries" << std::endl;
694627 t->Write ();
695628 }
696- }
629+ }
697630 LARCV_NORMAL () << " Closing output file" << std::endl;
698631 _out_file->Close ();
699632 _out_file = nullptr ;
0 commit comments