From 2e8226f72bbbc02dc428b1bb539213eddb411d0b Mon Sep 17 00:00:00 2001 From: Sebouh Paul Date: Mon, 26 Aug 2024 14:37:04 -0400 Subject: [PATCH] allow MultiSegmentation in calorimeter hit recon (#1594) Allow multisegmentation without giving a warning about it. ### Briefly, what does this PR introduce? There is an if statement in CalorimeterHitReco that checks if the segmentation type is one of several types of segmentations (cartesian or hexagonal) that prints a warning if the segmentation is not one of those. Adds MultiSegmentation to this list. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [X] Other: removal of unnecessary warning ### Please check if this PR fulfills the following: - [X] Tests for the changes have been added - [X] Documentation has been added / updated - [X] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? no ### Does this PR change default behavior? no --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nathan Brei --- .../calorimetry/CalorimeterHitReco.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/algorithms/calorimetry/CalorimeterHitReco.cc b/src/algorithms/calorimetry/CalorimeterHitReco.cc index e150061197..b461b790c8 100644 --- a/src/algorithms/calorimetry/CalorimeterHitReco.cc +++ b/src/algorithms/calorimetry/CalorimeterHitReco.cc @@ -8,6 +8,7 @@ #include "CalorimeterHitReco.h" #include +#include #include #include #include @@ -16,7 +17,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -242,7 +246,18 @@ void CalorimeterHitReco::process( const auto pos = local.nominal().worldToLocal(gpos); std::vector cdim; // get segmentation dimensions - auto segmentation_type = m_converter->findReadout(local).segmentation().type(); + + const dd4hep::DDSegmentation::Segmentation* segmentation = m_converter->findReadout(local).segmentation()->segmentation; + auto segmentation_type = segmentation->type(); + + while (segmentation_type == "MultiSegmentation"){ + const auto* multi_segmentation = dynamic_cast(segmentation); + const dd4hep::DDSegmentation::Segmentation& sub_segmentation = multi_segmentation->subsegmentation(cellID); + + segmentation = &sub_segmentation; + segmentation_type = segmentation->type(); + } + if (segmentation_type == "CartesianGridXY" || segmentation_type == "HexGridXY") { auto cell_dim = m_converter->cellDimensions(cellID); cdim.resize(3);