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,