Skip to content

Commit 3c60879

Browse files
committed
Fix: apply global density scaling factor in MaterialManager::getDensity
1 parent 69f6737 commit 3c60879

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Detectors/Base/src/MaterialManager.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ float MaterialManager::getDensity(std::string const& modname)
129129
initDensityMap();
130130
}
131131
if (mDensityMap.find(modname) != mDensityMap.end()) {
132-
return mDensityMap[modname];
132+
return o2::conf::SimMaterialParams::Instance().globalDensityFactor * mDensityMap[modname];
133133
}
134-
return o2::conf::SimMaterialParams::Instance().globalDensityFactor;
134+
LOG(warning) << "MaterialManager::getDensity: Material '" << modname
135+
<< "' not found in density map. Returning 0.";
136+
return 0.0;
135137
}
136138

137139
void MaterialManager::Material(const char* modname, Int_t imat, const char* name, Float_t a, Float_t z, Float_t dens,

0 commit comments

Comments
 (0)