From 8c4fbb50b84a01801d794f63802a94b412296369 Mon Sep 17 00:00:00 2001 From: Tong Li <118776996+dasphy@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:09:13 +0100 Subject: [PATCH] update sliding-window clustering for Theta-Module readout (#158) --- k4Interface/include/k4Interface/ITowerTool.h | 15 +-- .../k4Interface/ITowerToolThetaModule.h | 92 +++++++++++++++++++ 2 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 k4Interface/include/k4Interface/ITowerToolThetaModule.h diff --git a/k4Interface/include/k4Interface/ITowerTool.h b/k4Interface/include/k4Interface/ITowerTool.h index 7c176f45..a20c7c1a 100644 --- a/k4Interface/include/k4Interface/ITowerTool.h +++ b/k4Interface/include/k4Interface/ITowerTool.h @@ -23,14 +23,10 @@ #include "GaudiKernel/IAlgTool.h" // datamodel +#include "edm4hep/CalorimeterHit.h" #include "edm4hep/CalorimeterHitCollection.h" #include "edm4hep/Cluster.h" -struct tower { - int eta; - int phi; -}; - /** @class ITowerTool RecInterface/RecInterface/ITowerTool.h ITowerTool.h * * Abstract interface to tower building tool. @@ -41,10 +37,13 @@ struct tower { class ITowerTool : virtual public IAlgTool { public: DeclareInterfaceID(ITowerTool, 1, 0); + /** Find number of calorimeter towers. - * @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() = 0; + virtual void towersNumber(int& nEta, int& nPhi) = 0; + /** Build calorimeter towers. * @param[out] aTowers Calorimeter towers. * @param[in] fillTowersCells Whether to fill maps of cells into towers, for later use in attachCells @@ -86,6 +85,8 @@ class ITowerTool : virtual public IAlgTool { virtual void attachCells(float aEta, float aPhi, uint aHalfEtaFinal, uint aHalfPhiFinal, edm4hep::MutableCluster& aEdmCluster, edm4hep::CalorimeterHitCollection* aEdmClusterCells, bool aEllipse) = 0; + + virtual ~ITowerTool() {} }; #endif /* RECINTERFACE_ITOWERTOOL_H */ diff --git a/k4Interface/include/k4Interface/ITowerToolThetaModule.h b/k4Interface/include/k4Interface/ITowerToolThetaModule.h new file mode 100644 index 00000000..fd6a91bc --- /dev/null +++ b/k4Interface/include/k4Interface/ITowerToolThetaModule.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014-2024 Key4hep-Project. + * + * This file is part of Key4hep. + * See https://key4hep.github.io/key4hep-doc/ for further info. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef RECINTERFACE_ITOWERTOOLTHETAMODULE_H +#define RECINTERFACE_ITOWERTOOLTHETAMODULE_H + +// Gaudi +#include "GaudiKernel/IAlgTool.h" + +// datamodel +#include "edm4hep/CalorimeterHit.h" +#include "edm4hep/CalorimeterHitCollection.h" +#include "edm4hep/Cluster.h" + +/** @class ITowerToolThetaModule RecInterface/RecInterface/ITowerToolThetaModule.h ITowerToolThetaModule.h + * + * Abstract interface to tower building tool. + * + * @author Anna Zaborowska + * @Modified by Tong Li (t.li at cern.ch), for sliding-window clustering at FCCee where the CaloTower is created from Theta-Phi + */ + +class ITowerToolThetaModule : virtual public IAlgTool { +public: + DeclareInterfaceID(ITowerToolThetaModule, 1, 0); + + /** Find number of calorimeter towers. + * @param[out] nTheta number of towers in theta. + * @param[out] nPhi number of towers in phi. + */ + virtual void towersNumber(int& nTheta, int& nPhi) = 0; + /** Build calorimeter towers. + * @param[out] aTowers Calorimeter towers. + * @param[in] fillTowersCells Whether to fill maps of cells into towers, for later use in attachCells + * @return Size of the cell collection. + */ + virtual uint buildTowers(std::vector>& aTowers, bool fillTowersCells = true) = 0; + /** Get the map of cells contained within a tower. + * @return Map of cells in a tower + */ + virtual std::map, std::vector> cellsInTowers() const = 0; + /** Get the tower IDs in theta. + * @param[in] aTheta Position of the calorimeter cell in theta + * @return ID (theta) of a tower + */ + virtual uint idTheta(float aTheta) const = 0; + /** Get the tower IDs in phi. + * @param[in] aPhi Position of the calorimeter cell in phi + * @return ID (phi) of a tower + */ + virtual uint idPhi(float aPhi) const = 0; + /** Get the theta position of the centre of the tower. + * @param[in] aIdTheta ID (theta) of a tower + * @return Position of the centre of the tower + */ + virtual float theta(int aIdTheta) const = 0; + /** Get the phi position of the centre of the tower. + * @param[in] aIdPhi ID (phi) of a tower + * @return Position of the centre of the tower + */ + virtual float phi(int aIdPhi) const = 0; + /** Find cells belonging to a cluster. + * @param[in] aTheta Position of the middle tower of a cluster in theta + * @param[in] aPhi Position of the middle tower of a cluster in phi + * @param[in] aHalfThetaFinal Half size of cluster in theta (in units of tower size). Cluster size is 2*aHalfThetaFinal+1 + * @param[in] aHalfPhiFinal Half size of cluster in phi (in units of tower size). Cluster size is 2*aHalfPhiFinal+1 + * @param[out] aEdmCluster Cluster of interest + * @param[out] aEdmClusterCells Cluster cells which belong to the cluster of interest + */ + virtual void attachCells(float aTheta, float aPhi, uint aHalfThetaFinal, uint aHalfPhiFinal, + edm4hep::MutableCluster& aEdmCluster, edm4hep::CalorimeterHitCollection* aEdmClusterCells, + bool aEllipse) = 0; + + virtual ~ITowerToolThetaModule() {} +}; + +#endif /* RECINTERFACE_ITOWERTOOLTHETAMODULE_H */