Skip to content

Commit

Permalink
fix(sim): Add check for multiple sensitive volumes with same name
Browse files Browse the repository at this point in the history
Both the transport engines and FairRoot allow registering
of multiple nodes with the same volume/same volume name (copy mechanism).
However currently such workflow logs errors from `FairVolumeList::addVolume()`.

The commit reintroduces the check for same volume names into the
`FairModule::AddSensitiveVolume()` function thus preventing
registration of copy volumes.

Fixes the issue FairRootGroup#1595.
  • Loading branch information
karabowi committed Nov 22, 2024
1 parent 23a39ba commit e351b22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions fairroot/base/sim/FairModule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,14 @@ void FairModule::AddSensitiveVolume(TGeoVolume* vol)
auto volName = vol->GetName();
LOG(debug2) << "AddSensitiveVolume " << volName;

auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
if (!addedVol) {
return;
if (!vList->findObject(volName)) {
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
if (!addedVol) {
return;
}
++fNbOfVolumes;
RegisterSensitiveVolume(*addedVol);
}
++fNbOfVolumes;
RegisterSensitiveVolume(*addedVol);
}

FairVolume* FairModule::getFairVolume(FairGeoNode* fN)
Expand Down

0 comments on commit e351b22

Please sign in to comment.