9std::vector<Gep::Cluster>
12 std::vector<Gep::Cluster> clusters;
15 for (
auto const& cell_itr : *caloCellsMap) {
21 std::vector<Gep::GepCaloCell> cluster_cells =
clusterFromCells(cell_itr.second, caloCellsMap);
34 if (cell.isBadCell())
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;
61std::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;
107 seenCells.push_back(neighbour.
id);
108 cellsNextLayer.push_back(neighbour);
109 v_clusterCells.push_back(std::move(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 += std::fabs(cell_e);
135 v_cellIDs.push_back(cells[i_cell].
id);
136 etaSum += std::fabs(cell_e) * cells[i_cell].eta;
137 phiSum += std::fabs(cell_e) *
getDeltaPhi(cells[i_cell].
phi, seed_phi);
141 cluster.
ncells = cells.size();
142 cluster.
time = cells[0].time;
143 cluster.
cell_id = std::move(v_cellIDs);
144 if (abs_e == 0.) [[
unlikely]]
throw std::runtime_error(
"Gep::WFSClusterMaker::getClusterFromListOfCells: abs_e is zero");
145 double cluster_eta = etaSum / abs_e;
147 if (weight == 0.) [[
unlikely]]
throw std::runtime_error(
"Gep::WFSClusterMaker::getClusterFromListOfCells: weight is zero");
148 double cluster_et = (cluster_e * (1.0 / std::cosh(cluster_eta))) / weight;
149 cluster.
setEtEtaPhi(cluster_et, cluster_eta, cluster_phi);
156 double delta_phi = std::fabs(std::fabs( std::fabs(
phi - seed_phi ) - TMath::Pi() ) - TMath::Pi());
157 if (
phi < seed_phi) delta_phi *= -1.00;
159 if ((std::fabs(
phi + seed_phi) < TMath::Pi()) && (std::fabs(
phi) + std::fabs(seed_phi) > 5.0)) delta_phi *= -1.00;
164 double phi = seed_phi + delta_phi;
165 if (
phi > TMath::Pi())
phi = -1.0*TMath::Pi() + (
phi - TMath::Pi());
166 if (
phi < (-1.0)*TMath::Pi())
phi = TMath::Pi() + (
phi + TMath::Pi());
173 std::vector<Gep::Cluster> v_ordered;
174 for (
unsigned int i_cluster = 0; i_cluster < v_clusters.size(); ++i_cluster) {
175 float et = v_clusters[i_cluster].et();
178 if (v_ordered.empty()) {
179 v_ordered.push_back(v_clusters[i_cluster]);
184 for (
unsigned int i = 0; i < v_ordered.size(); ++i) {
185 if (v_ordered[i].
et() <
et) {
186 v_ordered.insert(v_ordered.begin()+i, v_clusters[i_cluster]);
192 if (v_ordered.size() != i_cluster+1) v_ordered.push_back(v_clusters[i_cluster]);
195 v_clusters = std::move(v_ordered);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::unique_ptr< GepCellMap > pGepCellMap
float et(const xAOD::jFexSRJetRoI *j)
std::vector< Gep::GepCaloCell > clusterFromCells(const Gep::GepCaloCell &seed, const pGepCellMap &) const
std::vector< Gep::Cluster > makeClusters(const pGepCellMap &) const override
float m_clustering_threshold
double getDeltaPhi(double phi, double seed_phi) const
Gep::Cluster getClusterFromListOfCells(const std::vector< Gep::GepCaloCell > &cells) const
std::string getName() const override
bool isSeedCell(const Gep::GepCaloCell &cell) const
std::vector< int > m_allowed_seed_samplings
std::vector< int > m_allowed_clustering_samplings
bool isNewCell(unsigned int id, const std::vector< unsigned int > &seenCells) const
bool isInAllowedSampling(int sampling, const std::vector< int > &list_of_samplings) const
double calculateClusterPhi(double seed_phi, double delta_phi) const
void orderClustersInEt(std::vector< Gep::Cluster > &v_clusters) const
std::vector< unsigned int > cell_id
void setEtEtaPhi(double et, double eta, double phi)
Extra patterns decribing particle interation process.