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

#include <BasicGepClusterMaker.h>

Inheritance diagram for Gep::BasicGepClusterMaker:
Collaboration diagram for Gep::BasicGepClusterMaker:

Public Member Functions

 BasicGepClusterMaker ()=default
 ~BasicGepClusterMaker ()=default
std::vector< Gep::ClustermakeClusters (const pGepCellMap &) const override
std::string getName () const override

Private Member Functions

bool isSeedCell (const Gep::GepCaloCell &cell, const std::vector< unsigned int > &seenSeedCells) const
bool isInAllowedSampling (int sampling, const std::vector< int > &list_of_samplings) const
bool isNewCell (unsigned int id, const std::vector< unsigned int > &seenCells) const
std::vector< Gep::GepCaloCellclusterFromCells (const Gep::GepCaloCell &seed, const pGepCellMap &, std::vector< unsigned int > &seenSeedCells) const
Gep::Cluster getClusterFromListOfCells (const std::vector< Gep::GepCaloCell > &cells) const

Private Attributes

const float m_seed_threshold = 4.0
const float m_clustering_threshold = 2.0
const int m_max_shells = 9999
const std::vector< int > m_disallowed_seed_samplings = {}
const std::vector< int > m_disallowed_clustering_samplings = {}

Detailed Description

Definition at line 14 of file BasicGepClusterMaker.h.

Constructor & Destructor Documentation

◆ BasicGepClusterMaker()

Gep::BasicGepClusterMaker::BasicGepClusterMaker ( )
default

◆ ~BasicGepClusterMaker()

Gep::BasicGepClusterMaker::~BasicGepClusterMaker ( )
default

Member Function Documentation

◆ clusterFromCells()

std::vector< Gep::GepCaloCell > Gep::BasicGepClusterMaker::clusterFromCells ( const Gep::GepCaloCell & seed,
const pGepCellMap & caloCellsMap,
std::vector< unsigned int > & seenSeedCells ) const
private

Definition at line 62 of file BasicGepClusterMaker.cxx.

63 {
64
65 std::vector<Gep::GepCaloCell> v_clusterCells;
66
67 std::vector<Gep::GepCaloCell> cellsNextLayer, cellsThisLayer;
68 std::vector<unsigned int> seenCells;
69
70 // Fill seed into supporting vectors
71 v_clusterCells.push_back(seed);
72 cellsNextLayer.push_back(seed);
73 seenCells.push_back(seed.id);
74 seenSeedCells.push_back(seed.id);
75
76 int i_shell = 1;
77
78 while (!cellsNextLayer.empty() && i_shell <= m_max_shells) {
79
80 cellsThisLayer.swap(cellsNextLayer);
81 cellsNextLayer.clear();
82 ++i_shell;
83
84 // Loop over all cells in this shell
85 for (unsigned int i_cell = 0; i_cell < cellsThisLayer.size(); ++i_cell) {
86
87 // Go through list of neighbouring cells and check whether they are part of the cluster
88 for (unsigned int i_neighbour = 0; i_neighbour < (cellsThisLayer[i_cell]).neighbours.size(); ++i_neighbour) {
89
90 // Check whether this neighbouring cell was sent to the GEP
91 auto const& nghbr_itr = caloCellsMap->find((cellsThisLayer[i_cell]).neighbours[i_neighbour]);
92 if (nghbr_itr == caloCellsMap->end()) continue;
93
94 Gep::GepCaloCell neighbour = nghbr_itr->second;
95
96 // reject if bad cell
97 if (neighbour.isBadCell()) continue;
98
99 // Reject if cell is not above clustering threshold
100 if (neighbour.sigma < m_clustering_threshold) continue;
101
102 // Reject if cell was already considered
103 if (!isNewCell(neighbour.id, seenCells)) continue;
104
105 // Ignore cells in disallowed samplings
107
108 seenCells.push_back(neighbour.id);
109 cellsNextLayer.push_back(neighbour);
110 v_clusterCells.push_back(neighbour);
111
112 // If the cell is another seed cell, we write it into the list of seen seed cells to not reconstruct this cluster again
113 if (neighbour.sigma > m_seed_threshold) seenSeedCells.push_back(neighbour.id);
114 }
115 }
116 cellsThisLayer.clear();
117 }
118
119 return v_clusterCells;
120}
bool isNewCell(unsigned int id, const std::vector< unsigned int > &seenCells) const
const std::vector< int > m_disallowed_clustering_samplings
bool isInAllowedSampling(int sampling, const std::vector< int > &list_of_samplings) const
unsigned int sampling
Definition GepCaloCell.h:49
unsigned int id
Definition GepCaloCell.h:50
bool isBadCell() const
Definition GepCaloCell.h:59

◆ getClusterFromListOfCells()

Gep::Cluster Gep::BasicGepClusterMaker::getClusterFromListOfCells ( const std::vector< Gep::GepCaloCell > & cells) const
private

Definition at line 123 of file BasicGepClusterMaker.cxx.

123 {
124
125 Gep::Cluster cluster;
126 std::vector<unsigned int> v_cellIDs;
127
128 TLorentzVector tlv_cluster;
129 for (unsigned int i_cell = 0; i_cell < cells.size(); ++i_cell) {
130 TLorentzVector cell;
131 cell.SetPtEtaPhiE(cells[i_cell].et, cells[i_cell].eta, cells[i_cell].phi, cells[i_cell].et*std::cosh(cells[i_cell].eta));
132
133 tlv_cluster += cell;
134
135 v_cellIDs.push_back(cells[i_cell].id);
136 }
137
138 cluster.ncells = cells.size();
139 cluster.time = cells[0].time; // Take time of seed cell
140 cluster.cell_id = std::move(v_cellIDs);
141 cluster.setEtEtaPhi(tlv_cluster.Et(), tlv_cluster.Eta(), tlv_cluster.Phi());
142
143 return cluster;
144}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
float et(const xAOD::jFexSRJetRoI *j)
std::vector< unsigned int > cell_id
void setEtEtaPhi(double et, double eta, double phi)

◆ getName()

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

Implements Gep::IClusterMaker.

Definition at line 147 of file BasicGepClusterMaker.cxx.

147 {
148 return "GEPBasic";
149}

◆ isInAllowedSampling()

bool Gep::BasicGepClusterMaker::isInAllowedSampling ( int sampling,
const std::vector< int > & list_of_samplings ) const
private

Definition at line 42 of file BasicGepClusterMaker.cxx.

42 {
43
44 for (unsigned int i = 0; i < list_of_samplings.size(); ++i) {
45 if (list_of_samplings[i] == sampling) return false;
46 }
47 return true;
48}

◆ isNewCell()

bool Gep::BasicGepClusterMaker::isNewCell ( unsigned int id,
const std::vector< unsigned int > & seenCells ) const
private

Definition at line 51 of file BasicGepClusterMaker.cxx.

51 {
52
53 for (unsigned int i = 0; i < seenCells.size(); ++i) {
54 if (id == seenCells[i]) return false;
55 }
56
57 return true;
58}

◆ isSeedCell()

bool Gep::BasicGepClusterMaker::isSeedCell ( const Gep::GepCaloCell & cell,
const std::vector< unsigned int > & seenSeedCells ) const
private

Definition at line 31 of file BasicGepClusterMaker.cxx.

31 {
32
33 if (cell.isBadCell()) return false;
34 if (cell.sigma < m_seed_threshold) return false;
35 if (!isNewCell(cell.id, seenSeedCells)) return false;
36 if (!isInAllowedSampling(cell.sampling, m_disallowed_seed_samplings)) return false;
37
38 return true;
39}
const std::vector< int > m_disallowed_seed_samplings

◆ makeClusters()

std::vector< Gep::Cluster > Gep::BasicGepClusterMaker::makeClusters ( const pGepCellMap & caloCellsMap) const
overridevirtual

Implements Gep::IClusterMaker.

Definition at line 8 of file BasicGepClusterMaker.cxx.

8 {
9
10 std::vector<Gep::Cluster> clusters;
11
12 // Loop over all cells
13 std::vector<unsigned int> seenSeedCells;
14 for (auto const& cell_itr : *caloCellsMap) {
15
16 // Select only seed cells
17 if (!isSeedCell(cell_itr.second, seenSeedCells)) continue;
18
19 // Clustering
20 const std::vector<Gep::GepCaloCell> & cluster_cells = clusterFromCells(cell_itr.second, caloCellsMap, seenSeedCells);
21 clusters.push_back(getClusterFromListOfCells(cluster_cells));
22 }
23
24 // Order topo clusters according to their Et
25 std::sort(clusters.begin(), clusters.end(),[](const auto &c1, const auto &c2) {return c1.et() > c2.et();});
26
27 return clusters;
28}
bool isSeedCell(const Gep::GepCaloCell &cell, const std::vector< unsigned int > &seenSeedCells) const
std::vector< Gep::GepCaloCell > clusterFromCells(const Gep::GepCaloCell &seed, const pGepCellMap &, std::vector< unsigned int > &seenSeedCells) const
Gep::Cluster getClusterFromListOfCells(const std::vector< Gep::GepCaloCell > &cells) const
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

Member Data Documentation

◆ m_clustering_threshold

const float Gep::BasicGepClusterMaker::m_clustering_threshold = 2.0
private

Definition at line 29 of file BasicGepClusterMaker.h.

◆ m_disallowed_clustering_samplings

const std::vector<int> Gep::BasicGepClusterMaker::m_disallowed_clustering_samplings = {}
private

Definition at line 33 of file BasicGepClusterMaker.h.

33{};

◆ m_disallowed_seed_samplings

const std::vector<int> Gep::BasicGepClusterMaker::m_disallowed_seed_samplings = {}
private

Definition at line 32 of file BasicGepClusterMaker.h.

32{};

◆ m_max_shells

const int Gep::BasicGepClusterMaker::m_max_shells = 9999
private

Definition at line 30 of file BasicGepClusterMaker.h.

◆ m_seed_threshold

const float Gep::BasicGepClusterMaker::m_seed_threshold = 4.0
private

Definition at line 28 of file BasicGepClusterMaker.h.


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