From 3d639becc8dc87e6cc1e4eddc0912b1dce90ea6f Mon Sep 17 00:00:00 2001 From: Giovanni Marchiori <39376142+giovannimarchiori@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:49:44 +0200 Subject: [PATCH] fix metadata of topoclusters (#118) * fix metadata of topoclusters * also fix tool for FCChh --- RecCalorimeter/src/components/CaloTopoCluster.cpp | 7 ++++++- RecCalorimeter/src/components/CaloTopoCluster.h | 11 +++++++++-- .../src/components/CaloTopoClusterFCCee.cpp | 4 ++++ .../src/components/CaloTopoClusterFCCee.h | 11 +++++++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/RecCalorimeter/src/components/CaloTopoCluster.cpp b/RecCalorimeter/src/components/CaloTopoCluster.cpp index c652ef44..e85cb31f 100644 --- a/RecCalorimeter/src/components/CaloTopoCluster.cpp +++ b/RecCalorimeter/src/components/CaloTopoCluster.cpp @@ -7,7 +7,7 @@ // k4geo #include "detectorCommon/DetUtils_k4geo.h" -// datamodel +// EDM4HEP #include "edm4hep/Cluster.h" #include "edm4hep/ClusterCollection.h" #include "edm4hep/CalorimeterHit.h" @@ -79,6 +79,11 @@ StatusCode CaloTopoCluster::initialize() { return StatusCode::FAILURE; } } + + // initialise the list of metadata for the clusters + std::vector shapeParameterNames = {"dR_over_E"}; + m_shapeParametersHandle.put(shapeParameterNames); + return StatusCode::SUCCESS; } diff --git a/RecCalorimeter/src/components/CaloTopoCluster.h b/RecCalorimeter/src/components/CaloTopoCluster.h index 56d26e8c..42b3a785 100644 --- a/RecCalorimeter/src/components/CaloTopoCluster.h +++ b/RecCalorimeter/src/components/CaloTopoCluster.h @@ -5,8 +5,9 @@ #include "Gaudi/Algorithm.h" #include "GaudiKernel/ToolHandle.h" -// k4FWCore +// Key4HEP #include "k4FWCore/DataHandle.h" +#include "k4FWCore/MetaDataHandle.h" #include "k4Interface/ICaloReadCellNoiseMap.h" #include "k4Interface/ICaloReadNeighboursMap.h" #include "k4Interface/ICalorimeterTool.h" @@ -15,13 +16,14 @@ class IGeoSvc; -// datamodel +// EDM4HEP namespace edm4hep { class CalorimeterHit; class CalorimeterHitCollection; class ClusterCollection; } +// DD4HEP namespace DD4hep { namespace DDSegmentation { class Segmentation; @@ -97,6 +99,11 @@ class CaloTopoCluster : public Gaudi::Algorithm { mutable DataHandle m_clusterCollection{"calo/clusters", Gaudi::DataHandle::Writer, this}; // Cluster cells in collection mutable DataHandle m_clusterCellsCollection{"calo/clusterCells", Gaudi::DataHandle::Writer, this}; + /// Handle for the cluster shape metadata to write + MetaDataHandle> m_shapeParametersHandle{ + m_clusterCollection, + edm4hep::labels::ShapeParameterNames, + Gaudi::DataHandle::Writer}; /// Pointer to the geometry service SmartIF m_geoSvc; /// Handle for the input tool diff --git a/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.cpp b/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.cpp index 56a08287..261f0018 100644 --- a/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.cpp +++ b/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.cpp @@ -86,6 +86,10 @@ StatusCode CaloTopoClusterFCCee::initialize() { m_decoder_ecal = m_geoSvc->getDetector()->readout(m_readoutName).idSpec().decoder(); m_index_layer_ecal = m_decoder_ecal->index("layer"); + // initialise the list of metadata for the clusters + std::vector shapeParameterNames = {"dR_over_E"}; + m_shapeParametersHandle.put(shapeParameterNames); + return StatusCode::SUCCESS; } diff --git a/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.h b/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.h index 86a48839..0958c229 100644 --- a/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.h +++ b/RecFCCeeCalorimeter/src/components/CaloTopoClusterFCCee.h @@ -10,8 +10,9 @@ #include "Gaudi/Algorithm.h" #include "GaudiKernel/ToolHandle.h" -// k4FWCore +// Key4HEP #include "k4FWCore/DataHandle.h" +#include "k4FWCore/MetaDataHandle.h" #include "k4Interface/ICaloReadCellNoiseMap.h" #include "k4Interface/ICaloReadNeighboursMap.h" #include "k4Interface/ICalorimeterTool.h" @@ -21,13 +22,14 @@ // k4SimGeant4 class IGeoSvc; -// Datamodel +// EDM4HEP namespace edm4hep { class CalorimeterHit; class CalorimeterHitCollection; class ClusterCollection; } +// DD4HEP namespace DD4hep { namespace DDSegmentation { class Segmentation; @@ -102,6 +104,11 @@ class CaloTopoClusterFCCee : public Gaudi::Algorithm { mutable DataHandle m_clusterCollection{"calo/clusters", Gaudi::DataHandle::Writer, this}; // Cluster cells in collection mutable DataHandle m_clusterCellsCollection{"calo/clusterCells", Gaudi::DataHandle::Writer, this}; + /// Handle for the cluster shape metadata to write + MetaDataHandle> m_shapeParametersHandle{ + m_clusterCollection, + edm4hep::labels::ShapeParameterNames, + Gaudi::DataHandle::Writer}; /// Pointer to the geometry service SmartIF m_geoSvc; /// Handle for the input tool