From a728b7aeec0bb41a8a38fcbbf1dd64bd9974f257 Mon Sep 17 00:00:00 2001 From: Archil Durglishvili Date: Thu, 5 Dec 2024 12:59:38 +0100 Subject: [PATCH] retain support for FCCSWGridPhiTheta segmentation in SW clustering --- .../src/components/CaloTowerToolFCCee.cpp | 57 +++++++++++-------- .../src/components/CaloTowerToolFCCee.h | 2 +- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.cpp b/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.cpp index a817f4c..cc04291 100644 --- a/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.cpp +++ b/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.cpp @@ -138,13 +138,20 @@ StatusCode CaloTowerToolFCCee::retrievePhiThetaExtrema(std::string aReadoutName break; } case SegmentationType::kPhiTheta: { + info() << "== Retrieving segmentation " << aSegmentation->name() << endmsg; + dd4hep::DDSegmentation::FCCSWGridPhiTheta_k4geo* segmentationHCal = dynamic_cast(aSegmentation); + phiMax = M_PI - M_PI/segmentationHCal->phiBins(); + thetaMax = M_PI - fabs(segmentationHCal->offsetTheta()) + segmentationHCal->gridSizeTheta() * .5; + break; + } + case SegmentationType::kHCalPhiTheta: { info() << "== Retrieving segmentation " << aSegmentation->name() << endmsg; dd4hep::DDSegmentation::FCCSWHCalPhiTheta_k4geo* segmentationHCal = dynamic_cast(aSegmentation); phiMax = M_PI - M_PI/segmentationHCal->phiBins(); thetaMax = M_PI - fabs(segmentationHCal->offsetTheta()) + segmentationHCal->gridSizeTheta() * .5; break; } - case SegmentationType::kPhiRow: { + case SegmentationType::kHCalPhiRow: { info() << "== Retrieving segmentation " << aSegmentation->name() << endmsg; dd4hep::DDSegmentation::FCCSWHCalPhiRow_k4geo* segmentationHCal = dynamic_cast(aSegmentation); phiMax = M_PI - M_PI/segmentationHCal->phiBins(); @@ -355,38 +362,42 @@ std::pairgetDetector()->readout(aReadoutName).segmentation().segmentation()); if (segmentation == nullptr) { - segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); + segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); if (segmentation == nullptr) { - segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); + segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); if (segmentation == nullptr) { - segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); + segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); if (segmentation == nullptr) { - segmentation = dynamic_cast( m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); - if (segmentation == nullptr) - { - warning() << "There is no module-theta, phi-theta, phi-row, endcap turbine, or multi- segmentation for the readout " << aReadoutName << " defined." << endmsg; - return std::make_pair(nullptr, SegmentationType::kWrong); - } - else + segmentation = dynamic_cast(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); + if (segmentation == nullptr) { - // check if multisegmentation contains only module-theta sub-segmentations - dd4hep::DDSegmentation::Segmentation* subsegmentation = nullptr; - for (const auto& subSegm: dynamic_cast(segmentation)->subSegmentations()) + segmentation = dynamic_cast( m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation()); + if (segmentation == nullptr) + { + warning() << "There is no module-theta, phi-theta, phi-row, endcap turbine, or multi- segmentation for the readout " << aReadoutName << " defined." << endmsg; + return std::make_pair(nullptr, SegmentationType::kWrong); + } + else { - subsegmentation = dynamic_cast(subSegm.segmentation); - if (subsegmentation == nullptr) + // check if multisegmentation contains only module-theta sub-segmentations + dd4hep::DDSegmentation::Segmentation* subsegmentation = nullptr; + for (const auto& subSegm: dynamic_cast(segmentation)->subSegmentations()) { - warning() << "At least one of the sub-segmentations in MultiSegmentation named " << aReadoutName << " is not a module-theta grid." << endmsg; - return std::make_pair(nullptr, SegmentationType::kWrong); + subsegmentation = dynamic_cast(subSegm.segmentation); + if (subsegmentation == nullptr) + { + warning() << "At least one of the sub-segmentations in MultiSegmentation named " << aReadoutName << " is not a module-theta grid." << endmsg; + return std::make_pair(nullptr, SegmentationType::kWrong); + } } - } - return std::make_pair(segmentation, SegmentationType::kMulti); - } - } else return std::make_pair(segmentation, SegmentationType::kEndcapTurbine); - } else return std::make_pair(segmentation, SegmentationType::kPhiRow); + return std::make_pair(segmentation, SegmentationType::kMulti); + } + } else return std::make_pair(segmentation, SegmentationType::kEndcapTurbine); + } else return std::make_pair(segmentation, SegmentationType::kHCalPhiRow); + } else return std::make_pair(segmentation, SegmentationType::kHCalPhiTheta); } else return std::make_pair(segmentation, SegmentationType::kPhiTheta); } else return std::make_pair(segmentation, SegmentationType::kModuleTheta); } diff --git a/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.h b/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.h index bb056bb..3405920 100644 --- a/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.h +++ b/RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.h @@ -104,7 +104,7 @@ class CaloTowerToolFCCee : public AlgTool, virtual public ITowerToolThetaModule private: /// Type of the segmentation - enum class SegmentationType {kWrong, kModuleTheta, kMulti, kPhiTheta, kPhiRow, kEndcapTurbine}; + enum class SegmentationType {kWrong, kModuleTheta, kMulti, kPhiTheta, kHCalPhiTheta, kHCalPhiRow, kEndcapTurbine}; /** Correct way to access the neighbour of the phi tower, taking into account * the full coverage in phi. * Full coverage means that first tower in phi, with ID = 0 is a direct