Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fairroot/base/sim/FairModule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ void FairModule::SetGeometryFileName(TString fname, TString)

void FairModule::RegisterSensitiveVolume(FairVolume& vol)
{
vol.setModId(fModId);
vol.SetModule(this);
fAllSensitiveVolumes.push_back(&vol);
++fNbOfSensitiveVol;
}
Expand Down Expand Up @@ -249,7 +247,7 @@ void FairModule::ProcessNodes(TList* nodes)
std::ignore = node->calcLabTransform();

auto nodeTruncName = node->getTruncName();
auto volume = std::make_unique<FairVolume>(nodeTruncName, fNbOfVolumes);
auto volume = std::make_unique<FairVolume>(nodeTruncName, fNbOfVolumes, fModId, this);
volume->setRealName(node->GetName());

auto addedVol = vList->addVolume(std::move(volume));
Expand Down Expand Up @@ -280,8 +278,10 @@ void FairModule::AddSensitiveVolume(TGeoVolume* vol)
auto volName = vol->GetName();
LOG(debug2) << "AddSensitiveVolume " << volName;

auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes));
auto addedVol = vList->addVolume(std::make_unique<FairVolume>(volName, fNbOfVolumes, fModId, this));
if (!addedVol) {
LOG(debug) << "FairModule: Trying to register element " << vol->GetName() << " for detector " << GetName()
<< " failed, beacuse it was already defined";
return;
}
++fNbOfVolumes;
Expand Down
12 changes: 10 additions & 2 deletions fairroot/base/sim/FairVolumeList.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

#include "FairVolumeList.h"

#include "FairDetector.h"
#include "FairVolume.h"

FairVolume* FairVolumeList::getVolume(const TString& name)
{
auto obj = findObject(name);
Expand All @@ -35,8 +38,13 @@ FairVolume* FairVolumeList::addVolume(std::unique_ptr<FairVolume> vol)
auto vol_found = findObject(vol->GetName());

if (vol_found) {
LOG(error) << "FairVolumeList element: " << vol->GetName() << " VolId : " << vol->getVolumeId()
<< " already defined " << vol_found->getVolumeId();
// FATAL: The same volume name for different detectors
if (vol->GetDetector() != vol_found->GetDetector()) {
LOG(fatal) << "FairVolumeList Trying to register element: " << vol->GetName()
<< " (VolId=" << vol->getVolumeId() << ") for detector " << vol->GetDetector()->GetName()
<< ", but it was already defined (VolId=" << vol_found->getVolumeId() << ") for detector "
<< vol_found->GetDetector()->GetName();
}
return nullptr;
}

Expand Down