Skip to content
Snippets Groups Projects

bugfix in some macros: save RTDB after the run initialization

Merged Sergey Gorbunov requested to merge se.gorbunov/cbmroot:parfile into master
All threads resolved!

Bug fix in some macros that look "official" to me. The other 350 macros should be probably fixed by their authors.

The problem I found is that the FairRuntimeDb::saveOutput() does not work when FairRunAna is not initialized.

Here is the typical case:

  FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
  parOut->open(parFile.Data());
  rtdb->setOutput(parOut);
  rtdb->saveOutput();
  rtdb->print();

 ..

  run->Run(..);

Here rtdb->saveOutput(); writes an empty file. One should call it after run->Init() or after run->Run().

Why it happens:

In principle, there is no need to call the rtdb->saveOutput(). Once the output file is set, the FairRuntimeDb is supposed to save the database automatically. It internally calls saveOutput() whenever the run number changes + at the end of the data processing, namely in the FairRuntimeDb destructor.

The problem is that in our macros, the FairRuntimeDb destructor is never called since we never care to delete the database or the run objects. Therefore, the database is not automatically written at the end.

To get around this problem, we call the rtdb->saveOutput() explicitly. But this approach only works when the run is already initialized, i.e., after run->Init();

I think the best place to call the rtdb->saveOutput() is not after run->Init() but at the very end, after run->Run(). This solution works for the case when the run number changes during the reconstruction.

Merge request reports

Merge request pipeline #30691 passed

Merge request pipeline passed for 1da4117b

Approval is optional

Merged by Florian UhligFlorian Uhlig 1 year ago (Aug 2, 2024 1:32pm UTC)

Merge details

  • Changes merged into with 1da4117b.
  • Deleted the source branch.
  • Auto-merge enabled

Pipeline #30692 passed

Pipeline passed for 1da4117b on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Dear @i.selyuzhenkov, @se.gorbunov, @v.akishina, @f.uhlig, @p.-a.loizeau,

    you have been identified as code owner of at least one file which was changed with this merge request.

    Please check the changes and approve them or request changes.

  • Pierre-Alain Loizeau requested review from @f.uhlig and removed review request for @p.-a.loizeau

    requested review from @f.uhlig and removed review request for @p.-a.loizeau

  • Sergey Gorbunov added 1 commit

    added 1 commit

    • 003018d4 - bugfix in macros: save rtdb after the run initialization

    Compare with previous version

  • Sergey Gorbunov added 306 commits

    added 306 commits

    Compare with previous version

  • Florian Uhlig approved this merge request

    approved this merge request

  • Florian Uhlig resolved all threads

    resolved all threads

  • Florian Uhlig enabled an automatic merge when the pipeline for 1da4117b succeeds

    enabled an automatic merge when the pipeline for 1da4117b succeeds

  • merged

  • Please register or sign in to reply
    Loading