ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigGepPerf
src
TopoTowerMaker.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
./TopoTowerMaker.h
"
5
6
std::vector<Gep::Cluster>
7
Gep::TopoTowerMaker::makeTowers
(
const
xAOD::CaloClusterContainer
& clusters,
const
CaloCellContainer
& cells)
const
{
8
9
std::vector<Gep::Cluster> customTowers;
10
11
// Define tower array (98 eta bins x 64 phi bins)
12
static
constexpr
int
nEta{98};
13
static
constexpr
int
nPhi{64};
14
//avoid stack use of 605kb
15
auto
tow =
new
Gep::Cluster
[nEta][nPhi]();
16
17
18
// Loop over clusters and their associated cells
19
for
(
const
auto
* iClust : clusters) {
20
CaloClusterCellLink::const_iterator
cellBegin = iClust->cell_begin();
21
CaloClusterCellLink::const_iterator
cellEnd = iClust->cell_end();
22
23
for
(; cellBegin != cellEnd; ++cellBegin) {
24
unsigned
int
cellIndex = cellBegin.
index
();
25
if
(cellIndex >= cells.size())
continue
;
// avoid out-of-bounds
26
const
CaloCell
* cell = cells[cellIndex];
27
if
(!cell)
continue
;
28
29
// Compute eta and phi indices (binning in steps of 0.1)
30
int
eta_index =
static_cast<
int
>
(std::floor(cell->eta() * 10)) + 49;
31
int
phi_index =
static_cast<
int
>
(std::floor(cell->phi() * 10)) + 32;
32
33
// Ensure indices are within bounds
34
if
(eta_index < 0 || eta_index >= nEta || phi_index < 0 || phi_index >= nPhi)
continue
;
35
36
// Accumulate cell data into the corresponding tower
37
TLorentzVector cellVector;
38
cellVector.SetPtEtaPhiE(cell->energy() * 1.0 / TMath::CosH(cell->eta()),
39
cell->eta(), cell->phi(), cell->energy());
40
tow[eta_index][phi_index].vec += cellVector;
41
}
42
}
43
44
// Collect non-empty towers into a vector
45
for
(
int
i = 0; i < nEta; ++i) {
46
for
(
int
j = 0; j < nPhi; ++j) {
47
if
(tow[i][j].
vec
.Et() > 0) {
48
customTowers.push_back(tow[i][j]);
49
}
50
}
51
}
52
delete
[] tow;
53
return
customTowers;
54
}
55
56
std::string
Gep::TopoTowerMaker::getName
()
const
{
57
return
"TopoTower"
;
58
}
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
TopoTowerMaker.h
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloClusterCellLink::const_iterator
const_iterator to loop over cells belonging to a cluster
Definition
CaloClusterCellLink.h:57
CaloClusterCellLink::const_iterator::index
unsigned index() const
Accessor for the index of the cell in the CaloCellContainer.
Definition
CaloClusterCellLink.h:86
Gep::TopoTowerMaker::makeTowers
std::vector< Gep::Cluster > makeTowers(const xAOD::CaloClusterContainer &clusters, const CaloCellContainer &cells) const override
Definition
TopoTowerMaker.cxx:7
Gep::TopoTowerMaker::getName
std::string getName() const override
Definition
TopoTowerMaker.cxx:56
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
Gep::Cluster
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:13
Generated on
for ATLAS Offline Software by
1.17.0