Skip to content

Commit da49f26

Browse files
sawenzelclaude
andcommitted
Find the worker clone of a module by name
OwnModule looked the clone up by the position of the master's module, which relied on both lists having the same order. https://its.cern.ch/jira/browse/O2-7305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f9c0f8e commit da49f26

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

‎Detectors/3rdparty/FairRootBase/src/FairMCApplication.cxx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -616,19 +616,15 @@ TVirtualMCApplication* FairMCApplication::CloneForWorker() const
616616
//_____________________________________________________________________________
617617
FairModule* FairMCApplication::OwnModule(FairModule* module) const
618618
{
619-
// On a worker, the sensitive volumes still refer to the master's modules; the clones are in the same order
620-
if (!module || IsMasterApplication()) {
619+
// the worker's clone of a module, found by name
620+
if (!module || IsMasterApplication() || fModules->IndexOf(module) >= 0) {
621621
return module;
622622
}
623-
// volumes registered by the worker's own clones (in their Initialize) already point at them
624-
if (fModules->IndexOf(module) >= 0) {
625-
return module;
626-
}
627-
Int_t index = fgMasterInstance->fModules->IndexOf(module);
628-
if (index < 0 || !fModules->At(index)) {
623+
auto clone = static_cast<FairModule*>(fModules->FindObject(module->GetName()));
624+
if (!clone) {
629625
LOG(fatal) << "FairMCApplication: no worker clone for module " << module->GetName();
630626
}
631-
return static_cast<FairModule*>(fModules->At(index));
627+
return clone;
632628
}
633629

634630
//_____________________________________________________________________________

0 commit comments

Comments
 (0)