Skip to content

Commit

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

The commit reintroduces the check for same volume names in 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 6c0e792
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 6c0e792

Please sign in to comment.