ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CaloRecGPU::GeometryArr Struct Reference

#include <ConstantInfoDefinitions.h>

Collaboration diagram for CaloRecGPU::GeometryArr:

Public Member Functions

constexpr bool is_HECIW_or_FCal (const int cell) const
 
constexpr bool is_PS (const int cell) const
 
constexpr int sampling (const int cell) const
 
constexpr int intra_calorimeter_sampling (const int cell) const
 
constexpr int subcalo (const int cell) const
 
constexpr int region (const int cell) const
 
constexpr int get_neighbours (const unsigned int neigh_options, const int cell, int *neigh_arr) const
 Places the neighbours according to the option(s) in neigh_options in the array and returns the number of such neighbours (not the total number of neighbours of the cell). More...
 
constexpr int get_number_of_neighbours (const unsigned int neigh_options, const int cell) const
 
CUDA_HOS_DEV void fill_eta_phi_map ()
 
constexpr int get_closest_cell (const int sampling, const float test_eta, const float test_phi) const
 

Static Public Member Functions

constexpr static bool is_tile (const int cell)
 

Public Attributes

float x [NCaloCells]
 
float y [NCaloCells]
 
float z [NCaloCells]
 
float r [NCaloCells]
 
float eta [NCaloCells]
 
float phi [NCaloCells]
 
float dx [NCaloCells]
 
float dy [NCaloCells]
 
float dz [NCaloCells]
 
float dr [NCaloCells]
 
float deta [NCaloCells]
 
float dphi [NCaloCells]
 
float volume [NCaloCells]
 
NeighArr neighbours
 
EtaPhiToCellMap etaPhiToCell
 
OtherCellInfo::carrier otherCellInfo [NCaloCells]
 

Detailed Description

Definition at line 218 of file ConstantInfoDefinitions.h.

Member Function Documentation

◆ fill_eta_phi_map()

CUDA_HOS_DEV void CaloRecGPU::GeometryArr::fill_eta_phi_map ( )
inline

Definition at line 302 of file ConstantInfoDefinitions.h.

303  {
304  for (int i = 0; i < NCaloCells; ++i)
305  {
307  }
308 
309  struct DeAllocWrapper
310  {
311  int * buf;
312  CUDA_HOS_DEV DeAllocWrapper(const size_t new_size)
313  {
314  buf = new int[Helpers::int_ceil_div(new_size, sizeof(int))];
315  }
316  CUDA_HOS_DEV ~DeAllocWrapper()
317  {
318  delete[] buf;
319  }
320  CUDA_HOS_DEV DeAllocWrapper (const DeAllocWrapper &) = delete;
321  CUDA_HOS_DEV DeAllocWrapper (DeAllocWrapper &&) = delete;
322  CUDA_HOS_DEV DeAllocWrapper & operator=(const DeAllocWrapper &) = delete;
323  CUDA_HOS_DEV DeAllocWrapper & operator=(DeAllocWrapper &&) = delete;
324  };
325  //Simple allocation/de-allocation
326  //to still be GPU-compatible if needed
327  //(new and delete valid on GPU code...),
328  //while still preventing leaks,
329  //all without pulling in unique_ptr.
330 
331  DeAllocWrapper wrapper(etaPhiToCell.finish_initializing_buffer_size());
332 
333  etaPhiToCell.finish_initializing(wrapper.buf);
334 
335  }

◆ get_closest_cell()

constexpr int CaloRecGPU::GeometryArr::get_closest_cell ( const int  sampling,
const float  test_eta,
const float  test_phi 
) const
inlineconstexpr

Definition at line 337 of file ConstantInfoDefinitions.h.

338  {
340 
341  const int n_cells = etaPhiToCell.get_possible_cells_from_coords(sampling, test_eta, test_phi, cells);
342 
343  if (n_cells < 1)
344  {
345  return -1;
346  }
347  else if (n_cells == 1)
348  {
349  return cells[0];
350  }
351  else
352  {
353  float distance = 1e38f;
354  int ret = -1;
355 
356  for (int i = 0; i < n_cells; ++i)
357  {
358  const int this_cell = cells[i];
359 
360  const float delta_eta = eta[this_cell] - test_eta;
361  const float delta_phi = Helpers::angular_difference(phi[this_cell], test_phi);
362 
363  const float this_dist = delta_eta * delta_eta + delta_phi * delta_phi;
364  if (this_dist < distance || (this_dist == distance && this_cell > ret))
365  {
366  distance = this_dist;
367  ret = this_cell;
368  }
369  }
370  return ret;
371  }
372  }

◆ get_neighbours()

constexpr int CaloRecGPU::GeometryArr::get_neighbours ( const unsigned int  neigh_options,
const int  cell,
int *  neigh_arr 
) const
inlineconstexpr

Places the neighbours according to the option(s) in neigh_options in the array and returns the number of such neighbours (not the total number of neighbours of the cell).

We're using C arrays for more immediate CUDA compatibility.

Definition at line 292 of file ConstantInfoDefinitions.h.

293  {
294  return neighbours.get_neighbours(neigh_options, cell, neigh_arr);
295  }

◆ get_number_of_neighbours()

constexpr int CaloRecGPU::GeometryArr::get_number_of_neighbours ( const unsigned int  neigh_options,
const int  cell 
) const
inlineconstexpr

Definition at line 297 of file ConstantInfoDefinitions.h.

298  {
299  return neighbours.get_number_of_neighbours(neigh_options, cell);
300  }

◆ intra_calorimeter_sampling()

constexpr int CaloRecGPU::GeometryArr::intra_calorimeter_sampling ( const int  cell) const
inlineconstexpr

Definition at line 269 of file ConstantInfoDefinitions.h.

270  {
271  const OtherCellInfo cell_info = otherCellInfo[cell];
272  return cell_info.intra_calorimeter_sampling();
273  }

◆ is_HECIW_or_FCal()

constexpr bool CaloRecGPU::GeometryArr::is_HECIW_or_FCal ( const int  cell) const
inlineconstexpr

Definition at line 251 of file ConstantInfoDefinitions.h.

252  {
253  const OtherCellInfo cell_info = otherCellInfo[cell];
254  return cell_info.is_HECIW_or_FCal();
255  }

◆ is_PS()

constexpr bool CaloRecGPU::GeometryArr::is_PS ( const int  cell) const
inlineconstexpr

Definition at line 257 of file ConstantInfoDefinitions.h.

258  {
259  const OtherCellInfo cell_info = otherCellInfo[cell];
260  return cell_info.is_PS();
261  }

◆ is_tile()

constexpr static bool CaloRecGPU::GeometryArr::is_tile ( const int  cell)
inlinestaticconstexpr

Definition at line 246 of file ConstantInfoDefinitions.h.

247  {
248  return cell >= TileCellStart && cell < TileCellAfterEnd;
249  }

◆ region()

constexpr int CaloRecGPU::GeometryArr::region ( const int  cell) const
inlineconstexpr

Definition at line 281 of file ConstantInfoDefinitions.h.

282  {
283  const OtherCellInfo cell_info = otherCellInfo[cell];
284  return cell_info.region();
285  }

◆ sampling()

constexpr int CaloRecGPU::GeometryArr::sampling ( const int  cell) const
inlineconstexpr

Definition at line 263 of file ConstantInfoDefinitions.h.

264  {
265  const OtherCellInfo cell_info = otherCellInfo[cell];
266  return cell_info.sampling();
267  }

◆ subcalo()

constexpr int CaloRecGPU::GeometryArr::subcalo ( const int  cell) const
inlineconstexpr

Definition at line 275 of file ConstantInfoDefinitions.h.

276  {
277  const OtherCellInfo cell_info = otherCellInfo[cell];
278  return cell_info.subcalo();
279  }

Member Data Documentation

◆ deta

float CaloRecGPU::GeometryArr::deta[NCaloCells]

Definition at line 231 of file ConstantInfoDefinitions.h.

◆ dphi

float CaloRecGPU::GeometryArr::dphi[NCaloCells]

Definition at line 232 of file ConstantInfoDefinitions.h.

◆ dr

float CaloRecGPU::GeometryArr::dr[NCaloCells]

Definition at line 230 of file ConstantInfoDefinitions.h.

◆ dx

float CaloRecGPU::GeometryArr::dx[NCaloCells]

Definition at line 227 of file ConstantInfoDefinitions.h.

◆ dy

float CaloRecGPU::GeometryArr::dy[NCaloCells]

Definition at line 228 of file ConstantInfoDefinitions.h.

◆ dz

float CaloRecGPU::GeometryArr::dz[NCaloCells]

Definition at line 229 of file ConstantInfoDefinitions.h.

◆ eta

float CaloRecGPU::GeometryArr::eta[NCaloCells]

Definition at line 224 of file ConstantInfoDefinitions.h.

◆ etaPhiToCell

EtaPhiToCellMap CaloRecGPU::GeometryArr::etaPhiToCell

Definition at line 242 of file ConstantInfoDefinitions.h.

◆ neighbours

NeighArr CaloRecGPU::GeometryArr::neighbours

Definition at line 236 of file ConstantInfoDefinitions.h.

◆ otherCellInfo

OtherCellInfo::carrier CaloRecGPU::GeometryArr::otherCellInfo[NCaloCells]

Definition at line 244 of file ConstantInfoDefinitions.h.

◆ phi

float CaloRecGPU::GeometryArr::phi[NCaloCells]

Definition at line 225 of file ConstantInfoDefinitions.h.

◆ r

float CaloRecGPU::GeometryArr::r[NCaloCells]

Definition at line 223 of file ConstantInfoDefinitions.h.

◆ volume

float CaloRecGPU::GeometryArr::volume[NCaloCells]

Definition at line 234 of file ConstantInfoDefinitions.h.

◆ x

float CaloRecGPU::GeometryArr::x[NCaloCells]

Definition at line 220 of file ConstantInfoDefinitions.h.

◆ y

float CaloRecGPU::GeometryArr::y[NCaloCells]

Definition at line 221 of file ConstantInfoDefinitions.h.

◆ z

float CaloRecGPU::GeometryArr::z[NCaloCells]

Definition at line 222 of file ConstantInfoDefinitions.h.


The documentation for this struct was generated from the following file:
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloRecGPU::GeometryArr::phi
float phi[NCaloCells]
Definition: ConstantInfoDefinitions.h:225
CaloRecGPU::Helpers::int_ceil_div
constexpr int int_ceil_div(const int num, const int denom)
Returns the ceiling of num/denom, with proper rounding.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:214
CaloRecGPU::GeometryArr::etaPhiToCell
EtaPhiToCellMap etaPhiToCell
Definition: ConstantInfoDefinitions.h:242
CaloRecGPU::GeometryArr::eta
float eta[NCaloCells]
Definition: ConstantInfoDefinitions.h:224
CaloRecGPU::NeighArr::get_neighbours
constexpr int get_neighbours(const unsigned int neigh_options, const int cell, int *neigh_arr) const
Places the neighbours according to the option(s) in neigh_options in the array and returns the number...
Definition: NeighArr.h:202
CaloRecGPU::TileCellAfterEnd
constexpr int TileCellAfterEnd
Definition: BaseDefinitions.h:19
CUDA_HOS_DEV
#define CUDA_HOS_DEV
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:101
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
CaloRecGPU::GeometryArr::deta
float deta[NCaloCells]
Definition: ConstantInfoDefinitions.h:231
CaloRecGPU::GeometryArr::sampling
constexpr int sampling(const int cell) const
Definition: ConstantInfoDefinitions.h:263
CaloRecGPU::NCaloCells
constexpr int NCaloCells
Definition: BaseDefinitions.h:13
CaloRecGPU::EtaPhiToCellMap::finish_initializing
CUDA_HOS_DEV void finish_initializing(void *buffer)
!
Definition: EtaPhiMap.h:1107
CaloRecGPU::EtaPhiToCellMap::s_max_overlap_cells
static constexpr int s_max_overlap_cells
Definition: EtaPhiMap.h:673
CaloRecGPU::EtaPhiToCellMap::finish_initializing_buffer_size
constexpr size_t finish_initializing_buffer_size() const
Definition: EtaPhiMap.h:1097
CaloRecGPU::GeometryArr::otherCellInfo
OtherCellInfo::carrier otherCellInfo[NCaloCells]
Definition: ConstantInfoDefinitions.h:244
CaloRecGPU::EtaPhiToCellMap::register_cell
constexpr void register_cell(const int cell, const int sampling, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
Definition: EtaPhiMap.h:1091
eFEXNTuple.delta_phi
def delta_phi(phi1, phi2)
Definition: eFEXNTuple.py:15
CaloRecGPU::GeometryArr::neighbours
NeighArr neighbours
Definition: ConstantInfoDefinitions.h:236
CaloRecGPU::NeighArr::get_number_of_neighbours
constexpr int get_number_of_neighbours(const unsigned int neigh_options, const int cell) const
Definition: NeighArr.h:226
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
CaloRecGPU::TileCellStart
constexpr int TileCellStart
Definition: BaseDefinitions.h:17
CaloRecGPU::EtaPhiToCellMap::get_possible_cells_from_coords
constexpr int get_possible_cells_from_coords(const int sampling, const float test_eta, const float test_phi, int *cell_arr) const
We assume cell_arr is large enough.
Definition: EtaPhiMap.h:1113
CaloRecGPU::GeometryArr::dphi
float dphi[NCaloCells]
Definition: ConstantInfoDefinitions.h:232