Skip to content

Commit

Permalink
allow MultiSegmentation in calorimeter hit recon (#1594)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 3057963 commit 2e8226f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/algorithms/calorimetry/CalorimeterHitReco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "CalorimeterHitReco.h"

#include <DD4hep/Alignments.h>
#include <DD4hep/Handle.h>
#include <DD4hep/IDDescriptor.h>
#include <DD4hep/Objects.h>
#include <DD4hep/Readout.h>
Expand All @@ -16,7 +17,10 @@
#include <DD4hep/VolumeManager.h>
#include <DD4hep/Volumes.h>
#include <DD4hep/config.h>
#include <DD4hep/detail/SegmentationsInterna.h>
#include <DDSegmentation/BitFieldCoder.h>
#include <DDSegmentation/MultiSegmentation.h>
#include <DDSegmentation/Segmentation.h>
#include <Evaluator/DD4hepUnits.h>
#include <Math/GenVector/Cartesian3D.h>
#include <Math/GenVector/DisplacementVector3D.h>
Expand Down Expand Up @@ -242,7 +246,18 @@ void CalorimeterHitReco::process(
const auto pos = local.nominal().worldToLocal(gpos);
std::vector<double> 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<const dd4hep::DDSegmentation::MultiSegmentation*>(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);
Expand Down

0 comments on commit 2e8226f

Please sign in to comment.