From e3112d6a6b3288a65d8edb36b9b74c19efbb68e1 Mon Sep 17 00:00:00 2001 From: martinunland Date: Thu, 29 Aug 2024 16:43:59 +0200 Subject: [PATCH] const properties always with unit --- common/data/Materials/Surf_Generic_Photocathode_20nm.dat | 6 +++++- common/data/scintillation/Custom_Vitrovex_radioactivity.dat | 2 +- common/framework/src/OMSimMaterialHandler.cc | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/data/Materials/Surf_Generic_Photocathode_20nm.dat b/common/data/Materials/Surf_Generic_Photocathode_20nm.dat index 221546143b..997dc6e1eb 100644 --- a/common/data/Materials/Surf_Generic_Photocathode_20nm.dat +++ b/common/data/Materials/Surf_Generic_Photocathode_20nm.dat @@ -3,7 +3,11 @@ "jFinish": "polished", "jType": "coated", "jConstProperties": { - "COATEDTHICKNESS": 20 + "COATEDTHICKNESS": { + "jValue": 20, + "jUnit": "nm", + "jInvertUnit" : "" + } }, "jProperties": { "RINDEX": { diff --git a/common/data/scintillation/Custom_Vitrovex_radioactivity.dat b/common/data/scintillation/Custom_Vitrovex_radioactivity.dat index 04427f978e..9d48b45c22 100644 --- a/common/data/scintillation/Custom_Vitrovex_radioactivity.dat +++ b/common/data/scintillation/Custom_Vitrovex_radioactivity.dat @@ -1,7 +1,7 @@ { "jName": "Radioactivity_Vitrovex", "jMaterialName": "RiAbs_Glass_Vitrovex", - "ConstProperties": { + "jConstProperties": { "K40_ACTIVITY": { "jValue": 61, "jUnit": "kg", diff --git a/common/framework/src/OMSimMaterialHandler.cc b/common/framework/src/OMSimMaterialHandler.cc index 3d405480b9..58ee33e4e5 100644 --- a/common/framework/src/OMSimMaterialHandler.cc +++ b/common/framework/src/OMSimMaterialHandler.cc @@ -154,8 +154,8 @@ void OMSimMaterialHandler::processConstProperties() for (const auto &property : m_jsonTree.get_child("jConstProperties")) { G4String key = property.first; - G4double value = property.second.get_value(); - m_MPT->AddConstProperty(key.c_str(), value); + G4double value = m_fileData->getValueWithUnit(m_jsonTree.get("jName"), "jConstProperties." + key); + m_MPT->AddConstProperty(key.c_str(), value, true); } }