ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigGepPerf
src
BasicGepClusterMaker.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./BasicGepClusterMaker.h
"
6
7
std::vector<Gep::Cluster>
8
Gep::BasicGepClusterMaker::makeClusters
(
const
pGepCellMap
& caloCellsMap)
const
{
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
}
29
30
31
bool
Gep::BasicGepClusterMaker::isSeedCell
(
const
Gep::GepCaloCell
& cell,
const
std::vector<unsigned int> &seenSeedCells)
const
{
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
}
40
41
42
bool
Gep::BasicGepClusterMaker::isInAllowedSampling
(
int
sampling,
const
std::vector<int>& list_of_samplings)
const
{
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
}
49
50
51
bool
Gep::BasicGepClusterMaker::isNewCell
(
unsigned
int
id
,
const
std::vector<unsigned int>& seenCells)
const
{
52
53
for
(
unsigned
int
i = 0; i < seenCells.size(); ++i) {
54
if
(
id
== seenCells[i])
return
false
;
55
}
56
57
return
true
;
58
}
59
60
61
std::vector<Gep::GepCaloCell>
62
Gep::BasicGepClusterMaker::clusterFromCells
(
const
Gep::GepCaloCell
& seed,
63
const
pGepCellMap
& caloCellsMap, std::vector<unsigned int> &seenSeedCells)
const
{
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
106
if
(!
isInAllowedSampling
(neighbour.
sampling
,
m_disallowed_clustering_samplings
))
continue
;
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
}
121
122
123
Gep::Cluster
Gep::BasicGepClusterMaker::getClusterFromListOfCells
(
const
std::vector<Gep::GepCaloCell>& cells)
const
{
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
}
145
146
147
std::string
Gep::BasicGepClusterMaker::getName
()
const
{
148
return
"GEPBasic"
;
149
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
BasicGepClusterMaker.h
pGepCellMap
std::unique_ptr< GepCellMap > pGepCellMap
Definition
IClusterMaker.h:17
Gep::BasicGepClusterMaker::isNewCell
bool isNewCell(unsigned int id, const std::vector< unsigned int > &seenCells) const
Definition
BasicGepClusterMaker.cxx:51
Gep::BasicGepClusterMaker::m_disallowed_seed_samplings
const std::vector< int > m_disallowed_seed_samplings
Definition
BasicGepClusterMaker.h:32
Gep::BasicGepClusterMaker::makeClusters
std::vector< Gep::Cluster > makeClusters(const pGepCellMap &) const override
Definition
BasicGepClusterMaker.cxx:8
Gep::BasicGepClusterMaker::isSeedCell
bool isSeedCell(const Gep::GepCaloCell &cell, const std::vector< unsigned int > &seenSeedCells) const
Definition
BasicGepClusterMaker.cxx:31
Gep::BasicGepClusterMaker::m_disallowed_clustering_samplings
const std::vector< int > m_disallowed_clustering_samplings
Definition
BasicGepClusterMaker.h:33
Gep::BasicGepClusterMaker::isInAllowedSampling
bool isInAllowedSampling(int sampling, const std::vector< int > &list_of_samplings) const
Definition
BasicGepClusterMaker.cxx:42
Gep::BasicGepClusterMaker::clusterFromCells
std::vector< Gep::GepCaloCell > clusterFromCells(const Gep::GepCaloCell &seed, const pGepCellMap &, std::vector< unsigned int > &seenSeedCells) const
Definition
BasicGepClusterMaker.cxx:62
Gep::BasicGepClusterMaker::getClusterFromListOfCells
Gep::Cluster getClusterFromListOfCells(const std::vector< Gep::GepCaloCell > &cells) const
Definition
BasicGepClusterMaker.cxx:123
Gep::BasicGepClusterMaker::getName
std::string getName() const override
Definition
BasicGepClusterMaker.cxx:147
Gep::BasicGepClusterMaker::m_max_shells
const int m_max_shells
Definition
BasicGepClusterMaker.h:30
Gep::BasicGepClusterMaker::m_clustering_threshold
const float m_clustering_threshold
Definition
BasicGepClusterMaker.h:29
Gep::BasicGepClusterMaker::m_seed_threshold
const float m_seed_threshold
Definition
BasicGepClusterMaker.h:28
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
Gep::Cluster
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:13
Gep::Cluster::cell_id
std::vector< unsigned int > cell_id
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:36
Gep::Cluster::setEtEtaPhi
void setEtEtaPhi(double et, double eta, double phi)
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:28
Gep::Cluster::time
float time
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:34
Gep::Cluster::ncells
int ncells
Definition
Trigger/TrigT1/TrigGepPerf/src/Cluster.h:33
Gep::GepCaloCell
Definition
GepCaloCell.h:13
Gep::GepCaloCell::sampling
unsigned int sampling
Definition
GepCaloCell.h:49
Gep::GepCaloCell::id
unsigned int id
Definition
GepCaloCell.h:50
Gep::GepCaloCell::isBadCell
bool isBadCell() const
Definition
GepCaloCell.h:59
Gep::GepCaloCell::sigma
float sigma
Definition
GepCaloCell.h:22
et
Extra patterns decribing particle interation process.
Generated on
for ATLAS Offline Software by
1.17.0