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

#include <ConstantInfoDefinitions.h>

Collaboration diagram for CaloRecGPU::CellNoiseArr:

Public Member Functions

constexpr float get_noise (const int cell, const int gain) const
 
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. More...
 

Public Attributes

float noise [NCaloCells][NumGainStates]
 
float double_gaussian_constants [s_numDoubleGaussianConstants][NTileCells][NumGainStates]
 
CellNoiseProperties::carrier noise_properties
 
float luminosity
 

Static Public Attributes

static constexpr int s_numDoubleGaussianConstants = 4
 

Protected Member Functions

CUDA_HOS_DEV float get_double_gaussian_significance (const int cell, const int gain, const float energy) const
 

Detailed Description

Definition at line 452 of file ConstantInfoDefinitions.h.

Member Function Documentation

◆ get_double_gaussian_noise()

CUDA_HOS_DEV float CaloRecGPU::CellNoiseArr::get_double_gaussian_noise ( const int  cell,
const int  gain,
const float  energy 
) const
inline

Calculates the double gaussian noise for a Tile cell.

Does not check explicitly for a cell being from Tile.

Definition at line 532 of file ConstantInfoDefinitions.h.

533  {
534  using namespace std;
535 
536  CellNoiseProperties props(this->noise_properties);
537  if (!props.is_valid())
538  {
539  return get_noise(cell, gain);
540  }
541 
543 
544  const float first_factor = (sigma != 0.f ? fabsf(energy / sigma) : 0.f);
545 
546  if (props.is_electronic_noise())
547  {
548  return first_factor;
549  }
550  else
551  {
552  const float second_factor = this->double_gaussian_constants[3][cell - TileCellStart][gain];
553 
554  switch (props.version())
555  {
556  case 1:
557  return sqrtf(first_factor * first_factor + second_factor * second_factor * this->luminosity);
558  case 2:
559  return first_factor + second_factor * this->luminosity;
560  default:
561  return 0.f / 0.f;
562  }
563  }
564  }

◆ get_double_gaussian_significance()

CUDA_HOS_DEV float CaloRecGPU::CellNoiseArr::get_double_gaussian_significance ( const int  cell,
const int  gain,
const float  energy 
) const
inlineprotected

Definition at line 472 of file ConstantInfoDefinitions.h.

473  {
474 
475  using namespace std;
476 
477  const int delta_from_tile_start = cell - TileCellStart;
478 
479  const float sigma_1 = this->double_gaussian_constants[0][delta_from_tile_start][gain];
480  const float sigma_2 = this->double_gaussian_constants[1][delta_from_tile_start][gain];
481  const float ratio = this->double_gaussian_constants[2][delta_from_tile_start][gain];
482 
483  if ((sigma_1 == 0.f && sigma_2 == 0.f) || energy == 0.f)
484  {
485  return 0.f;
486  }
487  else if (sigma_1 == 0.f)
488  {
489  return energy / sigma_2;
490  }
491  else if (ratio == 0.f || sigma_2 == 0.f)
492  {
493  return energy / sigma_1;
494  }
495 
496  const float x_1 = energy / sigma_1;
497  const float x_2 = energy / sigma_2;
498  const float x_1_abs = fabsf(x_1);
499  const float x_2_abs = fabsf(x_2);
500 
501  const float min_abs = min(x_1_abs, x_2_abs);
502 
503  const float max_abs = max(x_1_abs, x_2_abs);
504 
505  if (min_abs > 7.4f)
506  {
507  return min_abs;
508  }
509  if (max_abs < 0.9f)
510  {
511  return max_abs;
512  }
513 
514  const float y_1 = erff(Helpers::Constants::inv_sqrt2<float> * x_1);
515  const float y_2 = erff(Helpers::Constants::inv_sqrt2<float> * x_2);
516 
517 
518  const float z = (y_1 * sigma_1 + ratio * y_2 * sigma_2) / (sigma_1 + ratio * sigma_2);
519 
520  const float ret = Helpers::Constants::sqrt2<float> * Helpers::erf_inv_wrapper(z);
521 
522  //printf("GPU %d %f %f %f %f %f %f\n", delta_from_tile_start, min_abs, max_abs, y_1, y_2, z, ret);
523 
524  return ret;
525 
526  }

◆ get_noise()

constexpr float CaloRecGPU::CellNoiseArr::get_noise ( const int  cell,
const int  gain 
) const
inlineconstexpr

Definition at line 465 of file ConstantInfoDefinitions.h.

466  {
467  return noise[cell][gain];
468  }

Member Data Documentation

◆ double_gaussian_constants

float CaloRecGPU::CellNoiseArr::double_gaussian_constants[s_numDoubleGaussianConstants][NTileCells][NumGainStates]

Definition at line 459 of file ConstantInfoDefinitions.h.

◆ luminosity

float CaloRecGPU::CellNoiseArr::luminosity

Definition at line 463 of file ConstantInfoDefinitions.h.

◆ noise

float CaloRecGPU::CellNoiseArr::noise[NCaloCells][NumGainStates]

Definition at line 456 of file ConstantInfoDefinitions.h.

◆ noise_properties

CellNoiseProperties::carrier CaloRecGPU::CellNoiseArr::noise_properties

Definition at line 461 of file ConstantInfoDefinitions.h.

◆ s_numDoubleGaussianConstants

constexpr int CaloRecGPU::CellNoiseArr::s_numDoubleGaussianConstants = 4
staticconstexpr

Definition at line 454 of file ConstantInfoDefinitions.h.


The documentation for this struct was generated from the following file:
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloRecGPU::CellNoiseArr::noise_properties
CellNoiseProperties::carrier noise_properties
Definition: ConstantInfoDefinitions.h:461
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
z
#define z
hist_file_dump.f
f
Definition: hist_file_dump.py:135
CaloRecGPU::CellNoiseArr::noise
float noise[NCaloCells][NumGainStates]
Definition: ConstantInfoDefinitions.h:456
CaloRecGPU::CellNoiseArr::luminosity
float luminosity
Definition: ConstantInfoDefinitions.h:463
CaloRecGPU::CellNoiseArr::double_gaussian_constants
float double_gaussian_constants[s_numDoubleGaussianConstants][NTileCells][NumGainStates]
Definition: ConstantInfoDefinitions.h:459
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
CaloRecGPU::CellNoiseArr::get_noise
constexpr float get_noise(const int cell, const int gain) const
Definition: ConstantInfoDefinitions.h:465
CaloRecGPU::CellNoiseArr::get_double_gaussian_significance
CUDA_HOS_DEV float get_double_gaussian_significance(const int cell, const int gain, const float energy) const
Definition: ConstantInfoDefinitions.h:472
CaloRecGPU::TileCellStart
constexpr int TileCellStart
Definition: BaseDefinitions.h:17