ATLAS Offline Software
Loading...
Searching...
No Matches
TCTowerMaker.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 "./TCTowerMaker.h"
5std::vector<Gep::Cluster>
7
8 std::vector<Gep::Cluster> customClusters;
9 (void)cells; // Mark as intentionally unused
10 for(const auto* iClus : clusters){
11 Gep::Cluster clus;
12 clus.vec.SetPxPyPzE(iClus->p4().Px(), iClus->p4().Py(),
13 iClus->p4().Pz(), iClus->e());
14 customClusters.push_back(std::move(clus));
15 }
16
17 // Define tower array (98 eta bins x 64 phi bins)
18 static constexpr int nEta{98};
19 static constexpr int nPhi{64};
20 //avoid stack use of 605kb
21 auto tow = new Gep::Cluster[nEta][nPhi]();
22
23
24 // Single loop over clusters to assign them to towers
25 for (const auto& cluster : customClusters) {
26 // Compute eta and phi indices
27 int eta_index = static_cast<int>(std::floor(cluster.vec.Eta() * 10)) + 49;
28 int phi_index = static_cast<int>(std::floor(cluster.vec.Phi() * 10)) + 32;
29
30 // Ensure indices are within bounds
31 if (eta_index < 0 || eta_index >= nEta || phi_index < 0 || phi_index >= nPhi) continue;
32
33 // Accumulate cluster data into the corresponding tower
34 tow[eta_index][phi_index].vec += cluster.vec;
35 }
36
37 // Collect non-empty towers into a vector
38 std::vector<Gep::Cluster> customTowers;
39 for (int i = 0; i < nEta; ++i) {
40 for (int j = 0; j < nPhi; ++j) {
41 if (tow[i][j].vec.Et() > 0) {
42 customTowers.push_back(tow[i][j]);
43 }
44 }
45 }
46 delete[] tow;
47 return customTowers;
48 }
49
50std::string Gep::TCTowerMaker::getName() const {
51 return "TCTower";
52}
std::vector< size_t > vec
Container class for CaloCell.
std::string getName() const override
std::vector< Gep::Cluster > makeTowers(const xAOD::CaloClusterContainer &clusters, const CaloCellContainer &cells) const override
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.