From ec416435a86ec7a90678680e49a9fdf232124c1d Mon Sep 17 00:00:00 2001 From: "Joseph F. Boudreau" <boudreau@pitt.edu> Date: Tue, 15 Aug 2023 16:05:18 +0200 Subject: [PATCH] Fixup bug in gmex mass calculation --- .../VP1GeometrySystems/src/VP1GeometrySystem.cxx | 12 +++++++++--- .../src/settings_interactions_form.ui | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx index 3e97ae236..b6b1d0f9a 100644 --- a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx +++ b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx @@ -1126,11 +1126,17 @@ double VP1GeometrySystem::Imp::inclusiveMass(const PVConstLink& pv) { GeoVolumeCursor av(pv); while (!av.atEnd()) { - mass += inclusiveMass(av.getVolume()); - mass -= volume(av.getVolume())*density; + std::string materialName=av.getVolume()->getLogVol()->getMaterial()->getName(); + + if (QString(materialName.c_str()).endsWith("Ether") || QString(materialName.c_str()).endsWith("HyperUranium")) { + // Do nothing. These are not real volumes. + } + else { + double delta = inclusiveMass(av.getVolume()) - (volume(av.getVolume())*density); + mass += delta; + } av.next(); } - return mass; } diff --git a/GeoModelVisualization/VP1GeometrySystems/src/settings_interactions_form.ui b/GeoModelVisualization/VP1GeometrySystems/src/settings_interactions_form.ui index 7ebd63257..16ab476e8 100644 --- a/GeoModelVisualization/VP1GeometrySystems/src/settings_interactions_form.ui +++ b/GeoModelVisualization/VP1GeometrySystems/src/settings_interactions_form.ui @@ -77,7 +77,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In the case where either the selected volume or one its daugthers (or daughters daughters, etc.), is defined as a boolean volume, this might not give an entirely accurate result.</p></body></html></string> </property> <property name="text"> - <string>Mass (unreliable)</string> + <string>Mass (slow!)</string> </property> </widget> </item> -- GitLab