ATLAS Offline Software
Loading...
Searching...
No Matches
Gep::TCTowerMaker Class Reference

#include <TCTowerMaker.h>

Inheritance diagram for Gep::TCTowerMaker:
Collaboration diagram for Gep::TCTowerMaker:

Public Member Functions

 TCTowerMaker ()=default
 ~TCTowerMaker ()=default
std::vector< Gep::ClustermakeTowers (const xAOD::CaloClusterContainer &clusters, const CaloCellContainer &cells) const override
std::string getName () const override

Detailed Description

Definition at line 18 of file TCTowerMaker.h.

Constructor & Destructor Documentation

◆ TCTowerMaker()

Gep::TCTowerMaker::TCTowerMaker ( )
default

◆ ~TCTowerMaker()

Gep::TCTowerMaker::~TCTowerMaker ( )
default

Member Function Documentation

◆ getName()

std::string Gep::TCTowerMaker::getName ( ) const
overridevirtual

Implements Gep::ITowerMaker.

Definition at line 50 of file TCTowerMaker.cxx.

50 {
51 return "TCTower";
52}

◆ makeTowers()

std::vector< Gep::Cluster > Gep::TCTowerMaker::makeTowers ( const xAOD::CaloClusterContainer & clusters,
const CaloCellContainer & cells ) const
overridevirtual

Implements Gep::ITowerMaker.

Definition at line 6 of file TCTowerMaker.cxx.

6 {
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 }
std::vector< size_t > vec
constexpr int nEta
Default bin number of eta for vertex map.
constexpr int nPhi
Default bin number of phi for vertex map.

The documentation for this class was generated from the following files: