From d2aa9921f90b059a770c7fbd6fbd559b05062ecc Mon Sep 17 00:00:00 2001 From: Sebouh Paul Date: Mon, 26 Aug 2024 21:39:10 -0400 Subject: [PATCH] HcalEndcapPInsertImagingProtoClusters: use a larger hit spacing threshold (#1595) ### Briefly, what does this PR introduce? Uses a larger threshold for the distance between the neighboring hits in the insert, due to the new cell size. Also include "side" field (ie, left vs right) in the hit merger algorithm ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [X] Other: change of parameters ### 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? Probably. Including the detector "side" as a field in the hit merger algorithm probably breaks the code if using a version of the epic repository from before pull request https://github.com/eic/epic/pull/771 is merged. Therefore this pull request and https://github.com/eic/epic/pull/771 should be merged at the same time as one another ### Does this PR change default behavior? yes. Changes the parameters of the topo clustering and also uses the "side" field in the hit merger. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dmitry Kalinkin --- src/detectors/FHCAL/FHCAL.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index 0d78240fc..f64c71087 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -1,10 +1,15 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // Copyright (C) 2023 Friederike Bock, Wouter Deconinck +#include #include #include #include #include +#include +#include +#include +#include #include #include "algorithms/calorimetry/CalorimeterHitDigiConfig.h" @@ -18,6 +23,7 @@ #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" #include "factories/calorimetry/HEXPLIT_factory.h" #include "factories/calorimetry/ImagingTopoCluster_factory.h" +#include "services/geometry/dd4hep/DD4hep_service.h" extern "C" { void InitPlugin(JApplication *app) { @@ -89,13 +95,20 @@ extern "C" { app // TODO: Remove me once fixed )); - double side_length=18.89 * dd4hep::mm; + // define the distance between neighbors in terms of the largest possible distance between subcell hits + auto detector = app->GetService()->detector(); + double side_length; + try { + side_length = std::max({detector->constant("HcalEndcapPInsertCellSizeLGRight"), detector->constant("HcalEndcapPInsertCellSizeLGLeft")}); + } catch (std::runtime_error&) { + side_length = 31. * dd4hep::mm; + } app->Add(new JOmniFactoryGeneratorT( "HcalEndcapPInsertImagingProtoClusters", {"HcalEndcapPInsertSubcellHits"}, {"HcalEndcapPInsertImagingProtoClusters"}, { .neighbourLayersRange = 1, - .localDistXY = {0.76*side_length, 0.76*side_length*sin(M_PI/3)}, - .layerDistXY = {0.76*side_length, 0.76*side_length*sin(M_PI/3)}, + .localDistXY = {0.5*side_length, 0.5*side_length*sin(M_PI/3)}, + .layerDistXY = {0.25*side_length, 0.25*side_length*sin(M_PI/3)}, .layerMode = eicrecon::ImagingTopoClusterConfig::ELayerMode::xy, .sectorDist = 10.0 * dd4hep::cm, .minClusterHitEdep = 5.0 * dd4hep::keV,