From e752b14f44e0762b51e476a3e9158a7cf0ce849b Mon Sep 17 00:00:00 2001 From: Archil Durglishvili Date: Sat, 30 Nov 2024 21:27:43 +0100 Subject: [PATCH] Add the method thetaMax() for HCal phi-row segmentation needed for SW clustering --- .../FCCSWHCalPhiRow_k4geo.h | 7 ++++- .../src/FCCSWHCalPhiRow_k4geo.cpp | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/detectorSegmentations/include/detectorSegmentations/FCCSWHCalPhiRow_k4geo.h b/detectorSegmentations/include/detectorSegmentations/FCCSWHCalPhiRow_k4geo.h index acda782e8..1df1353d9 100644 --- a/detectorSegmentations/include/detectorSegmentations/FCCSWHCalPhiRow_k4geo.h +++ b/detectorSegmentations/include/detectorSegmentations/FCCSWHCalPhiRow_k4geo.h @@ -111,7 +111,7 @@ namespace dd4hep { */ std::array cellTheta(const CellID& cID) const; - /** Get the vector of cell indexes in a give layer. + /** Get the vector of cell indexes in a given layer. */ inline std::vector cellIndexes(const uint layer) const { if(m_radii.empty()) calculateLayerRadii(); @@ -119,6 +119,11 @@ namespace dd4hep { else return std::vector(); } + /** Get the thetaMax needed for SW clustering + * return max theta value of the detector + */ + double thetaMax() const; + /** Get the min and max layer indexes of each HCal part. * For Endcap, returns the three elements vector, while for Barrel - single element vector. */ diff --git a/detectorSegmentations/src/FCCSWHCalPhiRow_k4geo.cpp b/detectorSegmentations/src/FCCSWHCalPhiRow_k4geo.cpp index f17059abb..09d644982 100644 --- a/detectorSegmentations/src/FCCSWHCalPhiRow_k4geo.cpp +++ b/detectorSegmentations/src/FCCSWHCalPhiRow_k4geo.cpp @@ -602,5 +602,32 @@ std::array FCCSWHCalPhiRow_k4geo::cellTheta(const CellID& cID) const return cTheta; } +/// determine maximum theta value of the detector. This is used by SW clustering +double FCCSWHCalPhiRow_k4geo::thetaMax() const { + std::vector > minMaxLayerId(getMinMaxLayerId()); + if(minMaxLayerId.empty()) return 0.; + + // get the first layerId in the Barrel or in the last part of the Endcap + uint layer = minMaxLayerId[minMaxLayerId.size()-1].first; + + if(m_radii.empty()) calculateLayerRadii(); + if(m_cellEdges.empty()) return 0; + + // get the last cell index (which is in the positive-z side) + int idx = abs(m_cellIndexes[layer].back()); + + // get the z-coordinate of the right-hand edge of the last cell + double zhigh = m_cellEdges[layer][idx].second; + + // get the inner radius of the first layer + double Rmin = m_radii[layer] - 0.5*m_layerDepth[layer]; + + // calculate the minimum theta of the last cell in the first layer -> this is the minimum theta of the detector (Barrel or Endcap) + double thetaMin = std::atan2(Rmin,zhigh); // theta min + + return (M_PI - thetaMin); // theta max +} + + } }