Skip to content

Commit 43962df

Browse files
committed
fix(Base): Only search vList once
Fix #1495
1 parent f852585 commit 43962df

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

fairroot/base/sim/FairModule.cxx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,20 @@ void FairModule::ProcessNodes(TList* aList)
250250
}
251251
}
252252

253-
void FairModule::AddSensitiveVolume(TGeoVolume* v)
253+
void FairModule::AddSensitiveVolume(TGeoVolume* vol)
254254
{
255-
LOG(debug2) << "AddSensitiveVolume " << v->GetName();
256-
257-
// Only register volumes which are not already registered
258-
// Otherwise the stepping will be slowed down
259-
if (!vList->findObject(v->GetName())) {
260-
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(v->GetName(), fNbOfVolumes++));
261-
addedVol->setModId(fModId);
262-
addedVol->SetModule(this);
263-
fAllSensitiveVolumes.push_back(addedVol);
264-
fNbOfSensitiveVol++;
255+
auto volName = vol->GetName();
256+
LOG(debug2) << "AddSensitiveVolume " << volName;
257+
258+
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
259+
if (!addedVol) {
260+
return;
265261
}
262+
++fNbOfVolumes;
263+
addedVol->setModId(fModId);
264+
addedVol->SetModule(this);
265+
fAllSensitiveVolumes.push_back(addedVol);
266+
++fNbOfSensitiveVol;
266267
}
267268

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

0 commit comments

Comments
 (0)