From f990861674e2846f808f11bb5c3d74305a7e436c Mon Sep 17 00:00:00 2001 From: aidenwu23 Date: Sat, 22 Aug 2026 16:39:32 -0400 Subject: [PATCH 1/4] Support updated insert geometry --- src/detectors/FHCAL/FHCAL.cc | 96 ++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index ec0c2c178e..b6f2408cf1 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -1,7 +1,11 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // Copyright (C) 2023 - 2025 Friederike Bock, Wouter Deconinck +#include +#include +#include #include +#include #include #include #include @@ -22,6 +26,7 @@ #include "factories/calorimetry/HEXPLIT_factory.h" #include "factories/calorimetry/ImagingTopoCluster_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" +#include "services/geometry/dd4hep/DD4hep_service.h" extern "C" { void InitPlugin(JApplication* app) { @@ -30,6 +35,16 @@ void InitPlugin(JApplication* app) { InitJANAPlugin(app); + // Select the insert clustering path from the loaded geometry's readout segmentation. + bool insertUsesPhysicalTiles = false; + try { + auto detector = app->GetService()->detector(); + const auto insertSegmentation = detector->readout("HcalEndcapPInsertHits").segmentation(); + insertUsesPhysicalTiles = insertSegmentation.type() == "NoSegmentation"; + } catch (...) { + // Preserve legacy reconstruction when the insert readout is unavailable. + } + // Make sure digi and reco use the same value decltype(CalorimeterHitDigiConfig::capADC) HcalEndcapPInsert_capADC = 32768; decltype(CalorimeterHitDigiConfig::dyRangeADC) HcalEndcapPInsert_dyRangeADC = 200 * dd4hep::MeV; @@ -84,40 +99,57 @@ void InitPlugin(JApplication* app) { app // TODO: Remove me once fixed )); - app->Add(new JOmniFactoryGeneratorT( - "HcalEndcapPInsertSubcellHits", {"HcalEndcapPInsertRecHits"}, - {"HcalEndcapPInsertSubcellHits"}, - { - .MIP = 480. * dd4hep::keV, - .Emin_in_MIPs = 0.5, - .tmax = 162 * dd4hep::ns, //150 ns + (z at front face)/(speed of light) - }, - app // TODO: Remove me once fixed - )); + // Clustering for the new insert design + if (insertUsesPhysicalTiles) { + app->Add(new JOmniFactoryGeneratorT( + "HcalEndcapPInsertImagingProtoClusters", {"HcalEndcapPInsertRecHits"}, + {"HcalEndcapPInsertImagingProtoClusters"}, + { + .sectorDist = 10.0 * dd4hep::cm, + .dimScaledLocalDistXY = {1.5, 1.5}, + .splitCluster = false, + .minClusterHitEdep = 5.0 * dd4hep::keV, + .minClusterCenterEdep = 3.0 * dd4hep::MeV, + }, + app // TODO: Remove me once fixed + )); + } else { + // Also preserve the previous scheme + app->Add(new JOmniFactoryGeneratorT( + "HcalEndcapPInsertSubcellHits", {"HcalEndcapPInsertRecHits"}, + {"HcalEndcapPInsertSubcellHits"}, + { + .MIP = 480. * dd4hep::keV, + .Emin_in_MIPs = 0.5, + .tmax = 162 * dd4hep::ns, //150 ns + (z at front face)/(speed of light) + }, + app // TODO: Remove me once fixed + )); - app->Add(new JOmniFactoryGeneratorT( - "HcalEndcapPInsertImagingProtoClusters", {"HcalEndcapPInsertSubcellHits"}, - {"HcalEndcapPInsertImagingProtoClusters"}, - { - .neighbourLayersRange = 1, - .sameLayerDistXY = - {"0.5 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft)", - "0.5 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft) * " - "sin(pi / 3)"}, - .diffLayerDistXY = - {"0.25 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft)", - "0.25 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft) * " - "sin(pi / 3)"}, + app->Add(new JOmniFactoryGeneratorT( + "HcalEndcapPInsertImagingProtoClusters", {"HcalEndcapPInsertSubcellHits"}, + {"HcalEndcapPInsertImagingProtoClusters"}, + { + .neighbourLayersRange = 1, + .sameLayerDistXY = + {"0.5 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft)", + "0.5 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft) * " + "sin(pi / 3)"}, + .diffLayerDistXY = + {"0.25 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft)", + "0.25 * max(HcalEndcapPInsertCellSizeLGRight, HcalEndcapPInsertCellSizeLGLeft) * " + "sin(pi / 3)"}, - .sameLayerMode = eicrecon::ImagingTopoClusterConfig::ELayerMode::xy, - .sectorDist = 10.0 * dd4hep::cm, - .minClusterHitEdep = 5.0 * dd4hep::keV, - .minClusterCenterEdep = 3.0 * dd4hep::MeV, - .minClusterEdep = 11.0 * dd4hep::MeV, - .minClusterNhits = 100, - }, - app // TODO: Remove me once fixed - )); + .sameLayerMode = eicrecon::ImagingTopoClusterConfig::ELayerMode::xy, + .sectorDist = 10.0 * dd4hep::cm, + .minClusterHitEdep = 5.0 * dd4hep::keV, + .minClusterCenterEdep = 3.0 * dd4hep::MeV, + .minClusterEdep = 11.0 * dd4hep::MeV, + .minClusterNhits = 100, + }, + app // TODO: Remove me once fixed + )); + } app->Add(new JOmniFactoryGeneratorT( "HcalEndcapPInsertTruthClustersWithoutShapes", From cdba8c50a5508e4cb510f43df32674233106dec9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Aug 2026 22:45:08 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/detectors/FHCAL/FHCAL.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index b6f2408cf1..70fcad5883 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -38,7 +38,7 @@ void InitPlugin(JApplication* app) { // Select the insert clustering path from the loaded geometry's readout segmentation. bool insertUsesPhysicalTiles = false; try { - auto detector = app->GetService()->detector(); + auto detector = app->GetService()->detector(); const auto insertSegmentation = detector->readout("HcalEndcapPInsertHits").segmentation(); insertUsesPhysicalTiles = insertSegmentation.type() == "NoSegmentation"; } catch (...) { From 0f1751d4ea646c2747580e27d81098c3c7b8f595 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 27 Aug 2026 11:23:14 -0400 Subject: [PATCH 3/4] copyright --- src/detectors/FHCAL/FHCAL.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index 70fcad5883..8e741c5a30 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2023 - 2025 Friederike Bock, Wouter Deconinck +// Copyright (C) 2023 - 2026 Friederike Bock, Wouter Deconinck, Aider Wu #include #include From 2c464f3a5044942eddac34fa3a014b33f07bddce Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 27 Aug 2026 11:23:30 -0400 Subject: [PATCH 4/4] typo --- src/detectors/FHCAL/FHCAL.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index 8e741c5a30..5ac0c9b4b7 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2023 - 2026 Friederike Bock, Wouter Deconinck, Aider Wu +// Copyright (C) 2023 - 2026 Friederike Bock, Wouter Deconinck, Aiden Wu #include #include