7 std::vector<Gep::Cluster>
13 for (
auto const& cell_itr : *caloCellsMap) {
19 std::vector<Gep::GepCaloCell> cluster_cells =
clusterFromCells(cell_itr.second, caloCellsMap);
34 if (
cell.isBadCell())
return false;
35 if (fabs(
cell.sigma) < m_seed_threshold)
return false;
36 if (!isInAllowedSampling(
cell.sampling, m_allowed_seed_samplings))
return false;
44 for (
unsigned int i = 0;
i < list_of_samplings.size(); ++
i) {
45 if (list_of_samplings[
i] == sampling)
return true;
53 for (
unsigned int i = 0;
i < seenCells.size(); ++
i) {
54 if (
id == seenCells[
i])
return false;
61 std::vector<Gep::GepCaloCell>
65 std::vector<Gep::GepCaloCell> v_clusterCells;
67 std::vector<Gep::GepCaloCell> cellsNextLayer, cellsThisLayer;
68 std::vector<unsigned int> seenCells;
71 v_clusterCells.push_back(seed);
72 cellsNextLayer.push_back(seed);
73 seenCells.push_back(seed.id);
77 while (!cellsNextLayer.empty() && i_shell <= m_max_shells) {
79 cellsThisLayer = cellsNextLayer;
80 cellsNextLayer.clear();
84 for (
unsigned int i_cell = 0; i_cell < cellsThisLayer.size(); ++i_cell) {
87 for (
unsigned int i_neighbour = 0; i_neighbour < (cellsThisLayer[i_cell]).neighbours.size(); ++i_neighbour) {
90 auto const& nghbr_itr = caloCellsMap->find((cellsThisLayer[i_cell]).neighbours[i_neighbour]);
91 if (nghbr_itr == caloCellsMap->end())
continue;
99 if (fabs(neighbour.
sigma) < m_clustering_threshold)
continue;
102 if (!isNewCell(neighbour.
id, seenCells))
continue;
105 if (!isInAllowedSampling(neighbour.
sampling, m_allowed_clustering_samplings))
continue;
107 seenCells.push_back(neighbour.
id);
108 cellsNextLayer.push_back(neighbour);
109 v_clusterCells.push_back(neighbour);
112 cellsThisLayer.clear();
115 return v_clusterCells;
123 std::vector<unsigned int> v_cellIDs;
124 double cluster_e = 0.0;
130 double seed_phi =
cells[0].phi;
131 for (
unsigned int i_cell = 0; i_cell <
cells.size(); ++i_cell) {
132 float cell_e =
cells[i_cell].et * TMath::CosH(
cells[i_cell].eta);
134 abs_e += fabs(cell_e);
135 v_cellIDs.push_back(
cells[i_cell].
id);
136 etaSum += fabs(cell_e) *
cells[i_cell].eta;
145 double cluster_eta = etaSum / abs_e;
146 double cluster_phi = calculateClusterPhi(seed_phi, phiSum / abs_e);
147 double cluster_et = (cluster_e * (1.0 / std::cosh(cluster_eta))) /
weight;
148 cluster.
setEtEtaPhi(cluster_et, cluster_eta, cluster_phi);
155 double delta_phi = fabs(fabs( fabs( phi - seed_phi ) - TMath::Pi() ) - TMath::Pi());
158 if ((fabs(phi + seed_phi) < TMath::Pi()) && (fabs(phi) + fabs(seed_phi) > 5.0))
delta_phi *= -1.00;
164 if (phi > TMath::Pi()) phi = -1.0*TMath::Pi() + (phi - TMath::Pi());
165 if (phi < (-1.0)*TMath::Pi()) phi = TMath::Pi() + (phi + TMath::Pi());
172 std::vector<Gep::Cluster> v_ordered;
173 for (
unsigned int i_cluster = 0; i_cluster < v_clusters.size(); ++i_cluster) {
174 float et = v_clusters[i_cluster].et();
177 if (v_ordered.empty()) {
178 v_ordered.push_back(v_clusters[i_cluster]);
183 for (
unsigned int i = 0;
i < v_ordered.size(); ++
i) {
184 if (v_ordered[
i].
et() <
et) {
185 v_ordered.insert(v_ordered.begin()+
i, v_clusters[i_cluster]);
191 if (v_ordered.size() != i_cluster+1) v_ordered.push_back(v_clusters[i_cluster]);
194 v_clusters = v_ordered;