ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoTowerFromClusterMaker.h
Go to the documentation of this file.
1// -*- c++ -*-
2/* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration */
3#ifndef CALOREC_CALOTOPOTOWERFROMCLUSTERMAKER_H
4#define CALOREC_CALOTOPOTOWERFROMCLUSTERMAKER_H
5
9
10#include "GaudiKernel/ServiceHandle.h"
11
13
15#include "CaloProtoCluster.h"
16
17#include "CaloEvent/CaloCell.h"
21
22#include "CaloGeoHelpers/CaloSampling.h"
23
25
27
28#include <string>
29#include <vector>
30#include <bitset>
31#include <map>
32
33#ifndef _CALOTOPOTOWERFROMCLUSTERMAKER_BITSET_SIZE
34#define _CALOTOPOTOWERFROMCLUSTERMAKER_BITSET_SIZE 28
35#endif
36
38{
39public:
40
42 CaloTopoTowerFromClusterMaker(const std::string& type,const std::string& name,const IInterface* pParent);
45 virtual StatusCode initialize() override;
46 virtual StatusCode execute(const EventContext& ctx,
48 CaloCellClusterWeights* cellWeights) const override;
49 virtual StatusCode finalize() override;
51
52
53private:
54
57 typedef std::vector<CaloProtoCluster> protocont_t;
58 typedef std::size_t uint_t;
60
63
65 SG::ReadCondHandleKey<CaloTowerGeometry> m_towerGeoKey{this,"TowerGeometry","CaloTowerGeometry"};
66 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
67
68 SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerKey{this, "CaloTopoClusterContainerKey", "CaloTopoClusters", "SG Key for CaloClusterContainer (input)"};
69 SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this, "CaloCellContainerKey", "AllCalo", "SG Key for CaloCellContainer (input)"};
70 Gaudi::Property<bool> m_orderByPt{this, "OrderClusterByPt", false, "Turn on/off pT-ordering of CaloClusterContainer (output)"};
71 Gaudi::Property<bool> m_prepareLCW{this, "PrepareLCW", false, "Prepare data structure to apply LCW"};
72 Gaudi::Property<bool> m_useCellsFromClusters{this, "BuildTopoTowers", true, "Turn on/off topo-tower formation"};
73 Gaudi::Property<bool> m_applyCellEnergyThreshold{this, "ApplyCellEnergyThreshold", false, "Turn on/off cell energy thresholds"};
74 Gaudi::Property<bool> m_doCellIndexCheck{this, "DoCellIndexCheck", false, "Check cell hash indices for consistency"};
75 Gaudi::Property<bool> m_buildCombinedSignal{this, "BuildCombinedTopoSignal", false, "Build topo-clusters and topo-towers"};
76 Gaudi::Property<double> m_energyThreshold{this, "CellEnergyThreshold", m_energyThresholdDef-1., "Energy threshold for cells filled in clusters"};
77 Gaudi::Property<double> m_clusterRange{this, "TopoClusterRange", m_clusterRangeDef, "Rapidity range for using topo-clusters in combined signal mode"};
78 Gaudi::Property<bool> m_removeSamplingData{this, "RemoveSamplingData", true, "Remove the associated sampling data"};
80
83 //uint_t m_numberOfCells; ///< Number of cells (highest cell index + 1)
84 //uint_t m_maxCellHash; ///< Maximum hash index of cell ( number of cells - 1)
85 uint_t m_numberOfSamplings{static_cast<uint_t>(CaloSampling::Unknown)};
86 //uint_t m_numberOfTowers; ///< Number of towers
87 static const double m_energyThresholdDef;
88 static const double m_clusterRangeDef;
89 static const uint_t m_errorValueUINT;
91
96 int cleanupCells(const CaloTowerGeometry* towerGeo, CaloClusterCellLink* clk,uint_t nclus) const;
98
110 uint_t buildInclTowers(const CaloTowerGeometry* towerGeo, const CaloCellContainer& pCellCont,protocont_t& pProtoCont)const;
111 uint_t buildExclTowers(const CaloTowerGeometry* towerGeo, const CaloCellContainer& pCellCont,protocont_t& pProtoCont)const;
112 uint_t buildEMTopoTowers(const CaloTowerGeometry* towerGeo, const xAOD::CaloClusterContainer& clusCont,protocont_t& protoCont)const;
113 uint_t buildLCWTopoTowers(const CaloTowerGeometry* towerGeo, const xAOD::CaloClusterContainer& clusCont,protocont_t& protoCont,CaloCellClusterWeights* cellWeights) const;
122 bool addCellToProtoCluster(const CaloTowerGeometry* towerGeo, const CaloCell* cptr,protocont_t& pProtoCont,double weight=1.) const;
123
126 static bool filterProtoCluster(const CaloClusterCellLink& clnk) ;
127 bool checkCellIndices(const CaloTowerGeometry* towerGeo, const CaloDetDescrManager* caloDDM,
128 const CaloCellContainer* pCellCont) const;
129 bool isValidIndex(uint_t idx) const;
130 uint_t badIndexValue() const;
132
135 std::vector<CaloSampling::CaloSample> m_excludedSamplings;
136 Gaudi::Property<std::vector<std::string>> m_excludedSamplingsName{this, "ExcludedSamplings", {}, "Excluded samplings by name"};
137 std::bitset< _CALOTOPOTOWERFROMCLUSTERMAKER_BITSET_SIZE > m_excludedSamplingsPattern;
139
143};
144
146inline bool CaloTopoTowerFromClusterMaker::isValidIndex(uint_t idx) const { return idx != badIndexValue(); }
147
262#endif
Base class for cluster processing tools called from CaloClusterMaker.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Hash lookup of calibration weights for calorimeter cells.
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class provides the client interface for accessing the detector description information common to...
static const double m_energyThresholdDef
Default energy threshold.
Gaudi::Property< double > m_energyThreshold
Cell energy threshold, default is set in m_energyThresholdDef.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
static const double m_clusterRangeDef
Default cluster range.
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *pClusCont, CaloCellClusterWeights *cellWeights) const override
Execute the tool and fill the xAOD::CaloClusterContainer pointed to by pClusCont.
uint_t m_numberOfSamplings
Number of samplings.
Gaudi::Property< double > m_clusterRange
Range where topo-clusters are used when m_buildCombinedSignal = true.
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
Calorimeter cell container.
bool checkCellIndices(const CaloTowerGeometry *towerGeo, const CaloDetDescrManager *caloDDM, const CaloCellContainer *pCellCont) const
Checks consistency between cell indices and hash identifiers.
uint_t badIndexValue() const
Returns value indicating a bad index.
static const uint_t m_errorValueUINT
Error value for uint_t type values.
std::bitset< _CALOTOPOTOWERFROMCLUSTERMAKER_BITSET_SIZE > m_excludedSamplingsPattern
Bit pattern indicates if sampling is excluded.
Gaudi::Property< bool > m_useCellsFromClusters
Use cells from topo-clusters if true, else use all cells, default is true.
bool addCellToProtoCluster(const CaloTowerGeometry *towerGeo, const CaloCell *cptr, protocont_t &pProtoCont, double weight=1.) const
Adding cells to proto-clusters.
Gaudi::Property< bool > m_buildCombinedSignal
Build topo-clusters within given range, else topo-towers.
std::vector< CaloProtoCluster > protocont_t
Container for CaloProtoCluster objects.
static xAOD::CaloCluster::ClusterSize getClusterSize(uint_t etaBins, uint_t phiBins)
Returns a cluster size tag from number of eta and phi bins in tower grid.
uint_t buildInclTowers(const CaloTowerGeometry *towerGeo, const CaloCellContainer &pCellCont, protocont_t &pProtoCont) const
Inclusive towers.
std::vector< CaloSampling::CaloSample > m_excludedSamplings
List of excluded samplings (CaloSampling::CaloSample enumerators).
bool isValidIndex(uint_t idx) const
Checks if argument is a valid index value.
CaloTopoTowerFromClusterMaker(const std::string &type, const std::string &name, const IInterface *pParent)
Tool constructor.
uint_t buildExclTowers(const CaloTowerGeometry *towerGeo, const CaloCellContainer &pCellCont, protocont_t &pProtoCont) const
Exclusive towers.
uint_t buildLCWTopoTowers(const CaloTowerGeometry *towerGeo, const xAOD::CaloClusterContainer &clusCont, protocont_t &protoCont, CaloCellClusterWeights *cellWeights) const
LCW topo-towers.
Gaudi::Property< bool > m_applyCellEnergyThreshold
Apply cell energy threshold, default is false.
std::size_t uint_t
Unsigned integral type.
Gaudi::Property< bool > m_removeSamplingData
Remove sampling data for towers.
SG::ReadCondHandleKey< CaloTowerGeometry > m_towerGeoKey
the name of the key of the CaloTowerGeometry object in the ConditonsStore
virtual StatusCode initialize() override
Setting up the operational mode and corresponding parameters.
Gaudi::Property< bool > m_doCellIndexCheck
Check cell hash index consistency if true (default false).
virtual StatusCode finalize() override
Finalize the tool (no action).
static bool filterProtoCluster(const CaloClusterCellLink &clnk)
Checks for and removes invalid cell links.
uint_t buildEMTopoTowers(const CaloTowerGeometry *towerGeo, const xAOD::CaloClusterContainer &clusCont, protocont_t &protoCont) const
EM topo-towers.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainerKey
Topo-cluster container key.
Gaudi::Property< bool > m_orderByPt
Orders cluster container by , default true.
Gaudi::Property< bool > m_prepareLCW
Prepare LCW calibration, default is false.
Gaudi::Property< std::vector< std::string > > m_excludedSamplingsName
List of excluded samplings (human-readable names).
int cleanupCells(const CaloTowerGeometry *towerGeo, CaloClusterCellLink *clk, uint_t nclus) const
Checks CaloClusterCellLink for consistency.
Retrieve the list of towers associated with a calorimeter cell referenced by its hash identifier.
Property holding a SG store/key/clid from which a ReadHandle is made.
ClusterSize
Enumeration to identify different cluster sizes.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.