Skip to content

Commit

Permalink
retain support for FCCSWGridPhiTheta segmentation in SW clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
Archil Durglishvili committed Dec 5, 2024
1 parent 17cfd1c commit a728b7a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
57 changes: 34 additions & 23 deletions RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<dd4hep::DDSegmentation::FCCSWGridPhiTheta_k4geo*>(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<dd4hep::DDSegmentation::FCCSWHCalPhiTheta_k4geo*>(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<dd4hep::DDSegmentation::FCCSWHCalPhiRow_k4geo*>(aSegmentation);
phiMax = M_PI - M_PI/segmentationHCal->phiBins();
Expand Down Expand Up @@ -355,38 +362,42 @@ std::pair<dd4hep::DDSegmentation::Segmentation*, CaloTowerToolFCCee::Segmentatio
m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
if (segmentation == nullptr)
{
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWHCalPhiTheta_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWGridPhiTheta_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
if (segmentation == nullptr)
{
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWHCalPhiRow_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWHCalPhiTheta_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
if (segmentation == nullptr)
{
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWEndcapTurbine_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWHCalPhiRow_k4geo*>(m_geoSvc->getDetector()->readout(aReadoutName).segmentation().segmentation());
if (segmentation == nullptr)
{
segmentation = dynamic_cast<dd4hep::DDSegmentation::MultiSegmentation*>( 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<dd4hep::DDSegmentation::FCCSWEndcapTurbine_k4geo*>(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<dd4hep::DDSegmentation::MultiSegmentation*>(segmentation)->subSegmentations())
segmentation = dynamic_cast<dd4hep::DDSegmentation::MultiSegmentation*>( 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<dd4hep::DDSegmentation::FCCSWGridModuleThetaMerged_k4geo*>(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<dd4hep::DDSegmentation::MultiSegmentation*>(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<dd4hep::DDSegmentation::FCCSWGridModuleThetaMerged_k4geo*>(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);
}
Expand Down
2 changes: 1 addition & 1 deletion RecFCCeeCalorimeter/src/components/CaloTowerToolFCCee.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a728b7a

Please sign in to comment.