Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update sliding-window clustering for Theta-Module readout #58

Merged
merged 12 commits into from
Feb 9, 2024
10 changes: 4 additions & 6 deletions RecCalorimeter/src/components/CaloTowerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ StatusCode CaloTowerTool::initialize() {
if (GaudiTool::initialize().isFailure()) {
return StatusCode::FAILURE;
}

if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
<< "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
Expand Down Expand Up @@ -147,7 +147,7 @@ std::pair<double, double> CaloTowerTool::retrievePhiEtaExtrema(dd4hep::DDSegment
return std::make_pair(phiMax, etaMax);
}

tower CaloTowerTool::towersNumber() {
void CaloTowerTool::towersNumber(int& nEta, int& nPhi) {

std::vector<double> listPhiMax;
std::vector<double> listEtaMax;
Expand Down Expand Up @@ -193,10 +193,8 @@ tower CaloTowerTool::towersNumber() {
debug() << "Towers: phiMax " << m_phiMax << ", deltaPhiTower " << m_deltaPhiTower << ", nPhiTower " << m_nPhiTower
<< endmsg;

tower total;
total.eta = m_nEtaTower;
total.phi = m_nPhiTower;
return total;
nEta = m_nEtaTower;
nPhi = m_nPhiTower;
}

uint CaloTowerTool::buildTowers(std::vector<std::vector<float>>& aTowers, bool fillTowersCells) {
Expand Down
5 changes: 3 additions & 2 deletions RecCalorimeter/src/components/CaloTowerTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ class CaloTowerTool : public GaudiTool, virtual public ITowerTool {
* deltaPhiTower').
* Number of towers in eta is calculated from maximum detector eta ('\b etaMax`) and the size of tower in eta ('\b
* deltaEtaTower').
* @return Array containing number of towers in eta and phi.
* @param[out] nEta Number of towers in eta.
* @param[out] nPhi Number of towers in phi.
*/
virtual tower towersNumber() final;
virtual void towersNumber(int& nEta, int& nPhi) final;
/** Build calorimeter towers.
* Tower is defined by a segment in eta and phi, with the energy from all layers (no r segmentation).
* @param[out] aTowers Calorimeter towers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ StatusCode CreateCaloClustersSlidingWindow::initialize() {
return StatusCode::FAILURE;
}
// Get number of calorimeter towers
auto towerMapSize = m_towerTool->towersNumber();
m_nEtaTower = towerMapSize.eta;
m_nPhiTower = towerMapSize.phi;
m_towerTool->towersNumber(m_nEtaTower, m_nPhiTower);
debug() << "Number of calorimeter towers (eta x phi) : " << m_nEtaTower << " x " << m_nPhiTower << endmsg;
// make sure that the number of towers in eta is larger than the seeding sliding window
if (m_nEtaTower < m_nEtaWindow) {
Expand Down
14 changes: 7 additions & 7 deletions RecCalorimeter/src/components/CreateCaloClustersSlidingWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ namespace edm4hep {
class ClusterCollection;
}

// Cluster
struct cluster {
float transEnergy;
float eta;
float phi;
};

/** @class CreateCaloClustersSlidingWindow
*
* Algorithm for creating calorimeter clusters from cells.
Expand Down Expand Up @@ -81,6 +74,13 @@ class CreateCaloClustersSlidingWindow : public GaudiAlgorithm {
StatusCode finalize();

private:
// Cluster
struct cluster {
float transEnergy;
float eta;
float phi;
};

/** 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 neighbour
* of the last tower in phi with ID = m_nPhiTower - 1).
Expand Down
10 changes: 4 additions & 6 deletions RecCalorimeter/src/components/LayeredCaloTowerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ StatusCode LayeredCaloTowerTool::initialize() {
if (GaudiTool::initialize().isFailure()) {
return StatusCode::FAILURE;
}

if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
<< "Make sure you have GeoSvc and SimSvc in the right order in the "
Expand Down Expand Up @@ -64,7 +64,7 @@ StatusCode LayeredCaloTowerTool::initialize() {

StatusCode LayeredCaloTowerTool::finalize() { return GaudiTool::finalize(); }

tower LayeredCaloTowerTool::towersNumber() {
void LayeredCaloTowerTool::towersNumber(int& nEta, int& nPhi) {
// maximum eta of the detector (== eta offset + half of the cell size)
m_etaMax = fabs(m_segmentation->offsetEta()) + m_segmentation->gridSizeEta() * 0.5;
m_phiMax = fabs(m_segmentation->offsetPhi()) + M_PI / (double)m_segmentation->phiBins();
Expand All @@ -77,10 +77,8 @@ tower LayeredCaloTowerTool::towersNumber() {
debug() << "etaMax " << m_etaMax << ", deltaEtaTower " << m_deltaEtaTower << ", nEtaTower " << m_nEtaTower << endmsg;
debug() << "phiMax " << m_phiMax << ", deltaPhiTower " << m_deltaPhiTower << ", nPhiTower " << m_nPhiTower << endmsg;

tower total;
total.eta = m_nEtaTower;
total.phi = m_nPhiTower;
return total;
nEta = m_nEtaTower;
nPhi = m_nPhiTower;
}

uint LayeredCaloTowerTool::buildTowers(std::vector<std::vector<float>>& aTowers, bool fillTowerCells) {
Expand Down
5 changes: 3 additions & 2 deletions RecCalorimeter/src/components/LayeredCaloTowerTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ class LayeredCaloTowerTool : public GaudiTool, virtual public ITowerTool {
* and the size of tower in phi ('\b deltaPhiTower').
* Number of towers in eta is calculated from maximum detector eta ('\b
* etaMax`) and the size of tower in eta ('\b deltaEtaTower').
* @return Struct containing number of towers in eta and phi.
* @param[out] nEta number of towers in eta.
* @param[out] nPhi number of towers in phi.
*/
virtual tower towersNumber() final;
virtual void towersNumber(int& nEta, int& nPhi) final;
/** Build calorimeter towers.
* Tower is segmented in eta and phi, with the energy from all layers
* (no segmentation).
Expand Down
5 changes: 2 additions & 3 deletions RecCalorimeter/src/components/MassInv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,8 @@ StatusCode MassInv::initialize() {
error() << "Unable to retrieve the tower building tool." << endmsg;
return StatusCode::FAILURE;
}
auto towerMapSize = m_towerTool->towersNumber();
m_nEtaTower = towerMapSize.eta;
m_nPhiTower = towerMapSize.phi;
// Get number of calorimeter towers
m_towerTool->towersNumber(m_nEtaTower, m_nPhiTower);
debug() << "Number of calorimeter towers (eta x phi) : " << m_nEtaTower << " x " << m_nPhiTower << endmsg;

return StatusCode::SUCCESS;
Expand Down
5 changes: 2 additions & 3 deletions RecCalorimeter/src/components/PreparePileup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ StatusCode PreparePileup::initialize() {
error() << "Unable to retrieve the tower building tool." << endmsg;
return StatusCode::FAILURE;
}
auto towerMapSize = m_towerTool->towersNumber();
m_nEtaTower = towerMapSize.eta;
m_nPhiTower = towerMapSize.phi;
// Get number of calorimeter towers
m_towerTool->towersNumber(m_nEtaTower, m_nPhiTower);
debug() << "Number of calorimeter towers (eta x phi) : " << m_nEtaTower << " x " << m_nPhiTower << endmsg;
// OPTIMISATION OF CLUSTER SIZE
// sanity check
Expand Down
Loading
Loading