FairRootGroup / FairRoot

C++ simulation, reconstruction and analysis framework for particle physics experiments
http://fairroot.gsi.de
Other
57 stars 96 forks source link

Cannot register any branch in the Init() of FairGenerator #1567

Open YanzhaoW opened 2 months ago

YanzhaoW commented 2 months ago

Is your feature request related to a problem?

New branches cannot be registered during the calling of FairGenerator::Init(). Doing so will lead to a warning message:

[WARN] FairRootFileSink::RegisterAny called for branch "MyBranchName" after FairRootFileSink::CreatePersistentBranchesAny has already completed. The branch will not be registered.

with no data written to the sink file.

Describe the solution you'd like

Call the FairGenerator::Init() before calling FairRootFileSink::CreatePersistentBranchesAny would fix the problem.

fuhlig1 commented 1 month ago

@karabowi,

if I remember correctly we discussed the issue already some years ago. The problem was that the FairRoot state machine needs to call different states at defined places due to the interference with the state machines of the MC engines and it wasn't possible to change the order.

karabowi commented 1 month ago

I think I was able to find the solution in PR #1575. @YanzhaoW can you test my branch and confirm that it fixes your use case?

YanzhaoW commented 1 month ago

@karabowi Thanks for the PR. I will test it out on next Monday and see whether it works or not.