Skip to content

Commit e351b22

Browse files
committed
fix(sim): Add check for multiple sensitive volumes with same name
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 #1595.
1 parent 23a39ba commit e351b22

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fairroot/base/sim/FairModule.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,14 @@ void FairModule::AddSensitiveVolume(TGeoVolume* vol)
280280
auto volName = vol->GetName();
281281
LOG(debug2) << "AddSensitiveVolume " << volName;
282282

283-
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
284-
if (!addedVol) {
285-
return;
283+
if (!vList->findObject(volName)) {
284+
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
285+
if (!addedVol) {
286+
return;
287+
}
288+
++fNbOfVolumes;
289+
RegisterSensitiveVolume(*addedVol);
286290
}
287-
++fNbOfVolumes;
288-
RegisterSensitiveVolume(*addedVol);
289291
}
290292

291293
FairVolume* FairModule::getFairVolume(FairGeoNode* fN)

0 commit comments

Comments
 (0)