ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Gep::WFSClusterMaker Class Reference

#include <WFSClusterMaker.h>

Inheritance diagram for Gep::WFSClusterMaker:
Collaboration diagram for Gep::WFSClusterMaker:

Public Member Functions

 WFSClusterMaker ()
 
 ~WFSClusterMaker ()
 
std::vector< Gep::ClustermakeClusters (const pGepCellMap &) const override
 
std::string getName () const override
 

Private Member Functions

bool isSeedCell (const Gep::CustomCaloCell &cell) 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::CustomCaloCellclusterFromCells (const Gep::CustomCaloCell &seed, const pGepCellMap &) const
 
Gep::Cluster getClusterFromListOfCells (const std::vector< Gep::CustomCaloCell > &cells) const
 
double calculateClusterPhi (double seed_phi, double delta_phi) const
 
void orderClustersInEt (std::vector< Gep::Cluster > &v_clusters) const
 
double getDeltaPhi (double phi, double seed_phi) const
 

Private Attributes

float m_seed_threshold = 4.0
 
float m_clustering_threshold = 2.0
 
int m_max_shells = 8
 
std::vector< int > m_allowed_seed_samplings = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
 
std::vector< int > m_allowed_clustering_samplings = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
 

Detailed Description

Definition at line 14 of file WFSClusterMaker.h.

Constructor & Destructor Documentation

◆ WFSClusterMaker()

Gep::WFSClusterMaker::WFSClusterMaker ( )
inline

Definition at line 18 of file WFSClusterMaker.h.

18 {}

◆ ~WFSClusterMaker()

Gep::WFSClusterMaker::~WFSClusterMaker ( )
inline

Definition at line 19 of file WFSClusterMaker.h.

19 {}

Member Function Documentation

◆ calculateClusterPhi()

double Gep::WFSClusterMaker::calculateClusterPhi ( double  seed_phi,
double  delta_phi 
) const
private

Definition at line 157 of file WFSClusterMaker.cxx.

157  {
158  double phi = seed_phi + delta_phi;
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());
161  return phi;
162 }

◆ clusterFromCells()

std::vector< Gep::CustomCaloCell > Gep::WFSClusterMaker::clusterFromCells ( const Gep::CustomCaloCell seed,
const pGepCellMap caloCellsMap 
) const
private

Definition at line 63 of file WFSClusterMaker.cxx.

64  {
65 
66  std::vector<Gep::CustomCaloCell> v_clusterCells;
67 
68  std::vector<Gep::CustomCaloCell> cellsNextLayer, cellsThisLayer;
69  std::vector<unsigned int> seenCells;
70 
71  // Fill seed into supporting vectors
72  v_clusterCells.push_back(seed);
73  cellsNextLayer.push_back(seed);
74  seenCells.push_back(seed.id);
75 
76  int i_shell = 1;
77 
78  while (!cellsNextLayer.empty() && i_shell <= m_max_shells) {
79 
80  cellsThisLayer = 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  Gep::CustomCaloCell neighbour = caloCellsMap->at((cellsThisLayer[i_cell]).neighbours[i_neighbour]);
90 
91  // reject if bad cell
92  if (neighbour.isBadCell()) continue;
93 
94  // Reject if cell is not above clustering threshold
95  if (fabs(neighbour.sigma) < m_clustering_threshold) continue;
96 
97  // Reject if cell was already considered
98  if (!isNewCell(neighbour.id, seenCells)) continue;
99 
100  // Ignore cells in disallowed samplings
102 
103  seenCells.push_back(neighbour.id);
104  cellsNextLayer.push_back(neighbour);
105  v_clusterCells.push_back(neighbour);
106  }
107  }
108  cellsThisLayer.clear();
109  }
110 
111  return v_clusterCells;
112 }

◆ getClusterFromListOfCells()

Gep::Cluster Gep::WFSClusterMaker::getClusterFromListOfCells ( const std::vector< Gep::CustomCaloCell > &  cells) const
private

Definition at line 115 of file WFSClusterMaker.cxx.

115  {
116 
117  Gep::Cluster cluster;
118 
119  std::vector<unsigned int> v_cellIDs;
120  double cluster_e = 0.0;
121  double etaSum = 0.0;
122  double phiSum = 0.0;
123  double abs_e = 0.0;
124  float weight = 0.0;
125 
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;
132  phiSum += fabs(cells[i_cell].e) * getDeltaPhi(cells[i_cell].phi, seed_phi);
133  if (fabs(cells[i_cell].sigma) > m_seed_threshold) weight += 1.0;
134  }
135 
136  cluster.ncells = cells.size();
137  cluster.time = cells[0].time; // Take time of seed cell
138  cluster.cell_id = v_cellIDs;
139 
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);
144 
145  return cluster;
146 }

◆ getDeltaPhi()

double Gep::WFSClusterMaker::getDeltaPhi ( double  phi,
double  seed_phi 
) const
private

Definition at line 149 of file WFSClusterMaker.cxx.

149  {
150  double delta_phi = fabs(fabs( fabs( phi - seed_phi ) - TMath::Pi() ) - TMath::Pi());
151  if (phi < seed_phi) delta_phi *= -1.00;
152  // Taking care of the -pi/pi split
153  if ((fabs(phi + seed_phi) < TMath::Pi()) && (fabs(phi) + fabs(seed_phi) > 5.0)) delta_phi *= -1.00;
154  return delta_phi;
155 }

◆ getName()

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

Implements Gep::IClusterMaker.

Definition at line 196 of file WFSClusterMaker.cxx.

196  {
197  return "CaloWFS";
198 }

◆ isInAllowedSampling()

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

Definition at line 43 of file WFSClusterMaker.cxx.

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

◆ isNewCell()

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

Definition at line 52 of file WFSClusterMaker.cxx.

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

◆ isSeedCell()

bool Gep::WFSClusterMaker::isSeedCell ( const Gep::CustomCaloCell cell) const
private

Definition at line 33 of file WFSClusterMaker.cxx.

33  {
34 
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;
38 
39  return true;
40 }

◆ makeClusters()

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

Implements Gep::IClusterMaker.

Definition at line 8 of file WFSClusterMaker.cxx.

8  {
9 
10  std::vector<Gep::Cluster> clusters;
11 
12  // Loop over all cells
13  for (auto const& cell_itr : *caloCellsMap) {
14 
15  // Select only seed cells
16  if (!isSeedCell(cell_itr.second)) continue;
17 
18  // Clustering
19  std::vector<Gep::CustomCaloCell> cluster_cells = clusterFromCells(cell_itr.second, caloCellsMap);
20 
21  Gep::Cluster cluster = getClusterFromListOfCells(cluster_cells);
22  clusters.push_back(cluster);
23 
24  }
25 
26  // Order topo clusters according to their et
28 
29  return clusters;
30 }

◆ orderClustersInEt()

void Gep::WFSClusterMaker::orderClustersInEt ( std::vector< Gep::Cluster > &  v_clusters) const
private

Definition at line 165 of file WFSClusterMaker.cxx.

165  {
166 
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();
170 
171  // Fill first cluster
172  if (v_ordered.empty()) {
173  v_ordered.push_back(v_clusters[i_cluster]);
174  continue;
175  }
176 
177  // Find correct position for filling
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]);
181  break;
182  }
183  }
184 
185  // If cluster has smallest et so far, it wasn't filled at all so we need to take care of it
186  if (v_ordered.size() != i_cluster+1) v_ordered.push_back(v_clusters[i_cluster]);
187  }
188 
189  v_clusters = v_ordered;
190 
191  return;
192 
193 }

Member Data Documentation

◆ m_allowed_clustering_samplings

std::vector<int> Gep::WFSClusterMaker::m_allowed_clustering_samplings = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
private

Definition at line 32 of file WFSClusterMaker.h.

◆ m_allowed_seed_samplings

std::vector<int> Gep::WFSClusterMaker::m_allowed_seed_samplings = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
private

Definition at line 31 of file WFSClusterMaker.h.

◆ m_clustering_threshold

float Gep::WFSClusterMaker::m_clustering_threshold = 2.0
private

Definition at line 29 of file WFSClusterMaker.h.

◆ m_max_shells

int Gep::WFSClusterMaker::m_max_shells = 8
private

Definition at line 30 of file WFSClusterMaker.h.

◆ m_seed_threshold

float Gep::WFSClusterMaker::m_seed_threshold = 4.0
private

Definition at line 28 of file WFSClusterMaker.h.


The documentation for this class was generated from the following files:
Gep::WFSClusterMaker::isSeedCell
bool isSeedCell(const Gep::CustomCaloCell &cell) const
Definition: WFSClusterMaker.cxx:33
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
et
Extra patterns decribing particle interation process.
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
Gep::CustomCaloCell::sampling
unsigned int sampling
Definition: CustomCaloCell.h:51
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
Gep::WFSClusterMaker::m_allowed_seed_samplings
std::vector< int > m_allowed_seed_samplings
Definition: WFSClusterMaker.h:31
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
Gep::Cluster::setEtEtaPhi
void setEtEtaPhi(double et, double eta, double phi)
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:29
Gep::Cluster::ncells
int ncells
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:34
Gep::Cluster
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:13
Gep::CustomCaloCell::id
unsigned int id
Definition: CustomCaloCell.h:52
Gep::CustomCaloCell
Definition: CustomCaloCell.h:13
Gep::WFSClusterMaker::m_seed_threshold
float m_seed_threshold
Definition: WFSClusterMaker.h:28
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
Gep::WFSClusterMaker::isNewCell
bool isNewCell(unsigned int id, const std::vector< unsigned int > &seenCells) const
Definition: WFSClusterMaker.cxx:52
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
lumiFormat.i
int i
Definition: lumiFormat.py:92
Gep::CustomCaloCell::isBadCell
bool isBadCell() const
Definition: CustomCaloCell.h:56
Gep::WFSClusterMaker::m_clustering_threshold
float m_clustering_threshold
Definition: WFSClusterMaker.h:29
Gep::Cluster::cell_id
std::vector< unsigned int > cell_id
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:37
Gep::WFSClusterMaker::calculateClusterPhi
double calculateClusterPhi(double seed_phi, double delta_phi) const
Definition: WFSClusterMaker.cxx:157
Gep::WFSClusterMaker::getClusterFromListOfCells
Gep::Cluster getClusterFromListOfCells(const std::vector< Gep::CustomCaloCell > &cells) const
Definition: WFSClusterMaker.cxx:115
Gep::WFSClusterMaker::isInAllowedSampling
bool isInAllowedSampling(int sampling, const std::vector< int > &list_of_samplings) const
Definition: WFSClusterMaker.cxx:43
Gep::WFSClusterMaker::orderClustersInEt
void orderClustersInEt(std::vector< Gep::Cluster > &v_clusters) const
Definition: WFSClusterMaker.cxx:165
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Gep::WFSClusterMaker::m_max_shells
int m_max_shells
Definition: WFSClusterMaker.h:30
eFEXNTuple.delta_phi
def delta_phi(phi1, phi2)
Definition: eFEXNTuple.py:15
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
Gep::WFSClusterMaker::m_allowed_clustering_samplings
std::vector< int > m_allowed_clustering_samplings
Definition: WFSClusterMaker.h:32
Gep::WFSClusterMaker::getDeltaPhi
double getDeltaPhi(double phi, double seed_phi) const
Definition: WFSClusterMaker.cxx:149
Gep::CustomCaloCell::sigma
float sigma
Definition: CustomCaloCell.h:24
Gep::WFSClusterMaker::clusterFromCells
std::vector< Gep::CustomCaloCell > clusterFromCells(const Gep::CustomCaloCell &seed, const pGepCellMap &) const
Definition: WFSClusterMaker.cxx:63
Gep::Cluster::time
float time
Definition: Trigger/TrigT1/TrigGepPerf/src/Cluster.h:35