ATLAS Offline Software
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"
5 std::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(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 
50 std::string Gep::TCTowerMaker::getName() const {
51  return "TCTower";
52 }
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:281
TCTowerMaker.h
Gep::Cluster
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:13
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
createCablingJSON.eta_index
int eta_index
Definition: createCablingJSON.py:14
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Gep::TCTowerMaker::makeTowers
std::vector< Gep::Cluster > makeTowers(const xAOD::CaloClusterContainer &clusters, const CaloCellContainer &cells) const override
Definition: TCTowerMaker.cxx:6
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
TrigVSI::AlgConsts::nEta
constexpr int nEta
Default bin number of eta for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:26
Gep::Cluster::vec
TLorentzVector vec
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:35
Gep::TCTowerMaker::getName
std::string getName() const override
Definition: TCTowerMaker.cxx:50