diff --git a/DDCore/src/plugins/DetectorChecksum.cpp b/DDCore/src/plugins/DetectorChecksum.cpp
index e1bddc7c9..8f3e8b363 100644
--- a/DDCore/src/plugins/DetectorChecksum.cpp
+++ b/DDCore/src/plugins/DetectorChecksum.cpp
@@ -515,6 +515,48 @@ const DetectorChecksum::entry_t& DetectorChecksum::handleSolid(Solid solid) cons
else if ( shape->IsA() == TGeoShapeAssembly::Class() ) {
log << "";
}
+ else if ( shape->IsA() == TGeoTessellated::Class() ) {
+ if ( hash_meshes ) {
+ const TGeoTessellated* sh = (TGeoTessellated*)shape;
+ log << "" << newline;
+ if ( sh->IsClosedBody() == false ) {
+ except("DetectorChecksum","+++ TGeoTessellated volume is not closed: %s", solid.name());
+ }
+ for (int ivertex = 0; ivertex < sh->GetNvertices(); ivertex++) {
+ // Note: const_cast since TGeoTessellated::GetVertex not marked const in ROOT <= 6.28
+ const auto& vtx = const_cast(sh)->GetVertex(ivertex);
+ log << "" << newline;
+ }
+ log << "" << newline;
+ log << "" << newline;
+ for (int ifacet = 0; ifacet < sh->GetNfacets(); ifacet++) {
+ // Note: const_cast since TGeoTessellated::GetFacet not marked const in ROOT <= 6.28
+ const auto& facet = const_cast(sh)->GetFacet(ifacet);
+ if ( facet.GetNvert() == 3 ) {
+ log << "" << newline;
+ }
+ log << "" << newline;
+ }
+ else {
+ log << "" << newline;
+ }
+ }
else {
except("DetectorChecksum","+++ Unknown shape: %s", solid.name());
}
@@ -1269,7 +1311,7 @@ void DetectorChecksum::dump_sensitives() const {
static long create_checksum(Detector& description, int argc, char** argv) {
std::vector detectors;
- int precision = 6, newline = 1, level = 1, readout = 0, debug = 0;
+ int precision = 6, newline = 1, level = 1, meshes = 0, readout = 0, debug = 0;
int dump_elements = 0, dump_materials = 0, dump_solids = 0, dump_volumes = 0;
int dump_placements = 0, dump_detelements = 0, dump_sensitives = 0;
int dump_iddesc = 0, dump_segmentations = 0;
@@ -1296,6 +1338,8 @@ static long create_checksum(Detector& description, int argc, char** argv) {
debug = ::atol(argv[++i]);
else if ( 0 == ::strncmp("+newline",argv[i],5) )
newline = 0;
+ else if ( 0 == ::strncmp("-meshes",argv[i],5) )
+ meshes = 1;
else if ( 0 == ::strncmp("-readout",argv[i],5) )
readout = 1;
else if ( 0 == ::strncmp("-dump_elements",argv[i],10) )
@@ -1320,6 +1364,9 @@ static long create_checksum(Detector& description, int argc, char** argv) {
std::cout <<
"Usage: -plugin DD4hepDetectorChecksum -arg [-arg] \n\n"
" -detector Top level DetElement path. Default: '/world' \n"
+ " -meshes also hash the detector's meshed solids \n"
+ " (may be sensitive to changes due to rounding) \n"
+ " default: false \n"
" -readout also hash the detector's readout properties \n"
" (sensitive det, id desc, segmentation) \n"
" default: false \n"
@@ -1359,6 +1406,7 @@ static long create_checksum(Detector& description, int argc, char** argv) {
if ( !dens_unit.empty() ) wr.m_densunit_nam = dens_unit;
if ( !atom_unit.empty() ) wr.m_atomunit_nam = atom_unit;
if ( newline ) wr.newline = "\n";
+ wr.hash_meshes = meshes;
wr.hash_readout = readout;
wr.max_level = level;
wr.debug = debug;
diff --git a/DDCore/src/plugins/DetectorChecksum.h b/DDCore/src/plugins/DetectorChecksum.h
index bf69edaff..5474d3bbb 100644
--- a/DDCore/src/plugins/DetectorChecksum.h
+++ b/DDCore/src/plugins/DetectorChecksum.h
@@ -114,6 +114,8 @@ namespace dd4hep {
/// Property: precision of hashed printouts
mutable int precision { 6 };
+ /// Property: Include meshed solids in detector hash
+ int hash_meshes { 0 };
/// Property: Include readout property in detector hash
int hash_readout { 0 };
/// Property: maximum depth level for printouts
diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt
index 917a55ccc..6d6fa5dd4 100644
--- a/examples/ClientTests/CMakeLists.txt
+++ b/examples/ClientTests/CMakeLists.txt
@@ -392,6 +392,24 @@ dd4hep_add_test_reg( MiniTel_check_checksum_full
REGEX_FAIL "Exception;EXCEPTION;ERROR"
)
#
+# Checksum test of a tessellated solid (default, without meshes)
+dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum
+ COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
+ EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
+ -plugin DD4hepDetectorChecksum
+ REGEX_PASS "Combined hash code c8eb13dd1d4d9ca1 \\(13 sub-codes\\)"
+ REGEX_FAIL "Exception;EXCEPTION;ERROR"
+)
+#
+# Checksum test of a tessellated solid (with meshes)
+dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum_with_meshes
+ COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
+ EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
+ -plugin DD4hepDetectorChecksum -meshes -precision 3
+ REGEX_PASS "Combined hash code ada64a13764bb466 \\(13 sub-codes\\)"
+ REGEX_FAIL "Exception;EXCEPTION;ERROR"
+)
+#
# Test the sequential processing of two xml files
dd4hep_add_test_reg( minitel_config_plugins_include_command_line
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"