7 std::vector<Gep::Cluster>
13 for (
auto const& cell_itr : *caloCellsMap) {
19 std::vector<Gep::CustomCaloCell> cluster_cells =
clusterFromCells(cell_itr.second, caloCellsMap);
35 if (
cell.isBadCell())
return false;
36 if (fabs(
cell.sigma) < m_seed_threshold)
return false;
37 if (!isInAllowedSampling(
cell.sampling, m_allowed_seed_samplings))
return false;
45 for (
unsigned int i = 0;
i < list_of_samplings.size(); ++
i) {
46 if (list_of_samplings[
i] == sampling)
return true;
54 for (
unsigned int i = 0;
i < seenCells.size(); ++
i) {
55 if (
id == seenCells[
i])
return false;
62 std::vector<Gep::CustomCaloCell>
66 std::vector<Gep::CustomCaloCell> v_clusterCells;
68 std::vector<Gep::CustomCaloCell> cellsNextLayer, cellsThisLayer;
69 std::vector<unsigned int> seenCells;
72 v_clusterCells.push_back(seed);
73 cellsNextLayer.push_back(seed);
74 seenCells.push_back(seed.id);
78 while (!cellsNextLayer.empty() && i_shell <= m_max_shells) {
80 cellsThisLayer = cellsNextLayer;
81 cellsNextLayer.clear();
85 for (
unsigned int i_cell = 0; i_cell < cellsThisLayer.size(); ++i_cell) {
88 for (
unsigned int i_neighbour = 0; i_neighbour < (cellsThisLayer[i_cell]).neighbours.size(); ++i_neighbour) {
89 Gep::CustomCaloCell neighbour = caloCellsMap->at((cellsThisLayer[i_cell]).neighbours[i_neighbour]);
95 if (fabs(neighbour.
sigma) < m_clustering_threshold)
continue;
98 if (!isNewCell(neighbour.
id, seenCells))
continue;
101 if (!isInAllowedSampling(neighbour.
sampling, m_allowed_clustering_samplings))
continue;
103 seenCells.push_back(neighbour.
id);
104 cellsNextLayer.push_back(neighbour);
105 v_clusterCells.push_back(neighbour);
108 cellsThisLayer.clear();
111 return v_clusterCells;
119 std::vector<unsigned int> v_cellIDs;
120 double cluster_e = 0.0;
126 double seed_phi =
cells[0].phi;
127 for (
unsigned int i_cell = 0; i_cell <
cells.size(); ++i_cell) {
128 cluster_e +=
cells[i_cell].e;
129 abs_e += fabs(
cells[i_cell].
e);
130 v_cellIDs.push_back(
cells[i_cell].
id);
131 etaSum += fabs(
cells[i_cell].
e) *
cells[i_cell].eta;
140 double cluster_eta = etaSum / abs_e;
141 double cluster_phi = calculateClusterPhi(seed_phi, phiSum / abs_e);
142 double cluster_et = (cluster_e * (1.0 / std::cosh(cluster_eta))) /
weight;
143 cluster.
setEtEtaPhi(cluster_et, cluster_eta, cluster_phi);
150 double delta_phi = fabs(fabs( fabs(
phi - seed_phi ) - TMath::Pi() ) - TMath::Pi());
153 if ((fabs(
phi + seed_phi) < TMath::Pi()) && (fabs(
phi) + fabs(seed_phi) > 5.0))
delta_phi *= -1.00;
159 if (
phi > TMath::Pi())
phi = -1.0*TMath::Pi() + (
phi - TMath::Pi());
160 if (
phi < (-1.0)*TMath::Pi())
phi = TMath::Pi() + (
phi + TMath::Pi());
167 std::vector<Gep::Cluster> v_ordered;
168 for (
unsigned int i_cluster = 0; i_cluster < v_clusters.size(); ++i_cluster) {
169 float et = v_clusters[i_cluster].et();
172 if (v_ordered.empty()) {
173 v_ordered.push_back(v_clusters[i_cluster]);
178 for (
unsigned int i = 0;
i < v_ordered.size(); ++
i) {
179 if (v_ordered[
i].
et() <
et) {
180 v_ordered.insert(v_ordered.begin()+
i, v_clusters[i_cluster]);
186 if (v_ordered.size() != i_cluster+1) v_ordered.push_back(v_clusters[i_cluster]);
189 v_clusters = v_ordered;