7#ifndef CALORECGPU_CONSTANTINFODEFINITIONS_H
8#define CALORECGPU_CONSTANTINFODEFINITIONS_H
204 const carrier intra_calo_sampling,
208 const bool HECIW_or_FCal):
242#if CALORECGPU_ADD_FULL_PAIRS_LIST_TO_CONSTANT_INFORMATION
250 constexpr static bool is_tile (
const int cell)
261 constexpr bool is_PS(
const int cell)
const
264 return cell_info.
is_PS();
285 constexpr int region(
const int cell)
const
288 return cell_info.
region();
296 constexpr int get_neighbours(
const unsigned int neigh_options,
const int cell,
int * neigh_arr)
const
298 return neighbours.get_neighbours(neigh_options, cell, neigh_arr);
303 return neighbours.get_number_of_neighbours(neigh_options, cell);
313 struct DeAllocWrapper
324 CUDA_HOS_DEV DeAllocWrapper (
const DeAllocWrapper &) =
delete;
325 CUDA_HOS_DEV DeAllocWrapper (DeAllocWrapper &&) =
delete;
326 CUDA_HOS_DEV DeAllocWrapper & operator=(
const DeAllocWrapper &) =
delete;
327 CUDA_HOS_DEV DeAllocWrapper & operator=(DeAllocWrapper &&) =
delete;
335 DeAllocWrapper wrapper(
etaPhiToCell.finish_initializing_buffer_size());
337#if CALORECGPU_ETA_PHI_MAP_DEBUG
338 printf(
"CALORECGPU ETA PHI MAP DEBUG OUTPUT: Max occupied cells is %d\n",
etaPhiToCell.get_max_real_overlap());
348 const int n_cells =
etaPhiToCell.get_possible_cells_from_coords(
sampling, test_eta, test_phi, cells);
354 else if (n_cells == 1)
360 float distance = 1e38f;
363 for (
int i = 0; i < n_cells; ++i)
365 const int this_cell = cells[i];
367 const float delta_eta =
eta[this_cell] - test_eta;
372 const float this_dist = fabsf(delta_eta) + fabsf(delta_phi);
373 if (this_dist < distance || (this_dist == distance && this_cell > ret))
375 distance = this_dist;
474 constexpr float get_noise(
const int cell,
const int gain)
const
476 return noise[cell][gain];
488 const float sigma_1 = this->double_gaussian_constants[0][delta_from_tile_start][gain];
489 const float sigma_2 = this->double_gaussian_constants[1][delta_from_tile_start][gain];
490 const float ratio = this->double_gaussian_constants[2][delta_from_tile_start][gain];
492 if ((sigma_1 == 0.f && sigma_2 == 0.f) || energy == 0.f)
496 else if (sigma_1 == 0.f)
498 return energy / sigma_2;
500 else if (ratio == 0.f || sigma_2 == 0.f)
502 return energy / sigma_1;
505 const float x_1 = energy / sigma_1;
506 const float x_2 = energy / sigma_2;
507 const float x_1_abs = fabsf(x_1);
508 const float x_2_abs = fabsf(x_2);
510 const float min_abs =
min(x_1_abs, x_2_abs);
512 const float max_abs =
max(x_1_abs, x_2_abs);
527 const float z = (y_1 * sigma_1 + ratio * y_2 * sigma_2) / (sigma_1 + ratio * sigma_2);
553 const float first_factor = (sigma != 0.f ? fabsf(energy / sigma) : 0.f);
561 const float second_factor = this->double_gaussian_constants[3][cell -
TileCellStart][gain];
566 return sqrtf(first_factor * first_factor + second_factor * second_factor * this->luminosity);
568 return first_factor + second_factor * this->luminosity;
static constexpr int to_subcalo_enum(const int subcalo)
static constexpr int s_sampling_unknown_replacement
static constexpr int s_subcalo_unknown
static constexpr int s_region_unknown
static constexpr int from_region_enum(const int region)
static constexpr int to_region_enum(const int region)
static constexpr int from_subcalo_enum(const int subcalo)
static constexpr int s_sampling_unknown
static constexpr int from_intra_calorimeter_sampling_enum(const int sampling)
static constexpr int s_region_unknown_replacement
static constexpr int s_subcalo_unknown_replacement
static constexpr int to_intra_calorimeter_sampling_enum(const int sampling)
constexpr auto int_ceil_div(const T1 num, const T2 denom)
Returns the ceiling of num/denom, with proper rounding.
static CUDA_HOS_DEV float erf_inv_wrapper(const float x)
static CUDA_HOS_DEV T angular_difference(const T x, const T y)
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
constexpr int NumSamplings
constexpr int TileCellAfterEnd
constexpr int TileCellStart
constexpr int NumGainStates
float double_gaussian_constants[s_numDoubleGaussianConstants][NTileCells][NumGainStates]
CUDA_HOS_DEV float get_double_gaussian_noise(const int cell, const int gain, const float energy) const
Calculates the double gaussian noise for a Tile cell.
constexpr float get_noise(const int cell, const int gain) const
float noise[NCaloCells][NumGainStates]
CUDA_HOS_DEV float get_double_gaussian_significance(const int cell, const int gain, const float energy) const
CellNoiseProperties::carrier noise_properties
static constexpr int s_numDoubleGaussianConstants
static constexpr carrier s_invalid_double_gaussian
constexpr CellNoiseProperties(const carrier version, const carrier noise_type)
constexpr bool is_valid() const
static constexpr carrier invalid_value()
static constexpr carrier s_first_16_bit_mask
constexpr CellNoiseProperties(const carrier v)
constexpr carrier noise_type() const
constexpr bool is_invalid() const
constexpr CellNoiseProperties & operator=(const carrier v)
static constexpr carrier s_last_16_bit_mask
constexpr bool is_total_noise() const
constexpr bool is_pile_up_noise() const
constexpr carrier version() const
constexpr bool is_electronic_noise() const
static constexpr int s_max_overlap_cells
CUDA_HOS_DEV void fill_eta_phi_map()
EtaPhiToCellMap etaPhiToCell
OtherCellInfo::carrier otherCellInfo[NCaloCells]
constexpr int get_closest_cell(const int sampling, const float test_eta, const float test_phi) const
int nCellsPerSampling[NumSamplings]
static constexpr bool is_tile(const int cell)
constexpr bool is_HECIW_or_FCal(const int cell) const
constexpr int intra_calorimeter_sampling(const int cell) const
constexpr int region(const int cell) const
constexpr int sampling(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...
constexpr int subcalo(const int cell) const
constexpr bool is_PS(const int cell) const
constexpr int get_number_of_neighbours(const unsigned int neigh_options, const int cell) const
Packs the calo sampling, the intra-calorimeter sampling, the subcalo, the region and whether the cell...
static constexpr carrier s_region_offset
static constexpr carrier s_sampling_mask
static constexpr carrier s_bits_unused
static constexpr carrier s_intra_sampling_mask
constexpr carrier region() const
static constexpr carrier s_subcalo_mask
static constexpr carrier s_sampling_offset
constexpr OtherCellInfo(const carrier sampling, const carrier intra_calo_sampling, const carrier subcalo, const carrier region, const bool PS, const bool HECIW_or_FCal)
static constexpr carrier s_is_HECIW_FCal_flag
constexpr carrier subcalo() const
constexpr carrier intra_calorimeter_sampling() const
constexpr OtherCellInfo(const carrier v)
constexpr carrier sampling() const
constexpr bool is_HECIW_or_FCal() const
constexpr bool is_PS() const
static constexpr carrier s_subcalo_offset
static constexpr carrier s_intra_sampling_offset
static constexpr carrier s_is_PS_flag
static constexpr carrier s_region_mask
static constexpr carrier s_bits_used
constexpr OtherCellInfo & operator=(const carrier v)