7#ifndef CALORECGPU_EVENTINFODEFINITIONS_H
8#define CALORECGPU_EVENTINFODEFINITIONS_H
18#include "CaloGeoHelpers/CaloSampling.h"
72 inline static constexpr bool is_valid(
const T & gain)
157 constexpr QualityProvenance(
const uint8_t q1,
const uint8_t q2,
const uint8_t q3,
const uint8_t q4):
227 constexpr int get_hash_ID(
const int cell,
const bool is_complete =
false)
const
261 const unsigned int mask = 0x08U;
285 const unsigned int provenance = qp.
provenance();
286 ret = provenance & 0x0800U;
289 if (treat_L1_predicted_as_good && (provenance & 0x0200U))
301 constexpr bool is_bad(
const int cell,
const bool treat_L1_predicted_as_good =
false,
const bool is_complete =
false)
const
309 const bool use_crosstalk,
const float crosstalk_delta,
const bool is_complete =
false)
const
311 const int real_cell =
get_hash_ID(cell, is_complete);
312 const int sampling = geom.sampling(real_cell);
313 if (sampling == CaloSampling::PreSamplerB ||
314 sampling == CaloSampling::PreSamplerE ||
315 sampling == CaloSampling::Unknown )
322 const unsigned int mask = geom.is_tile(real_cell) ? 0x8080U : 0x2000U;
325 const float this_time =
time[cell];
330 const float this_energy =
energy[cell];
331 const bool eligible = (sampling == CaloSampling::EMB2 || (sampling == CaloSampling::EME2 && fabsf(geom.eta[real_cell]) < 2.5));
332 if (this_energy > 0 && eligible)
338 const int num_neighs = geom.get_neighbours(neigh_options, real_cell, neighbours);
340 for (
int i = 0; i < num_neighs; ++i)
343 if (neigh_index >= 0 &&
energy[neigh_index] > 4 * this_energy)
364 constexpr bool is_valid(
const int hash_ID,
const bool is_complete =
false,
const bool all_cells_are_valid =
false)
const
366 if (all_cells_are_valid)
370 else if (is_complete)
614#define CALORECGPU_FORALLMOMENTS_INSTANTIATE(MACRO, ...) \
615 MACRO(energyPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
616 MACRO(maxEPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
617 MACRO(maxPhiPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
618 MACRO(maxEtaPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
619 MACRO(etaPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
620 MACRO(phiPerSample , 0, 0, 1, NONE , __VA_ARGS__) \
621 MACRO(time , 0, 0, 1, NONE , __VA_ARGS__) \
622 MACRO(firstPhi , 1, 1, 1, FIRST_PHI , __VA_ARGS__) \
623 MACRO(firstEta , 1, 1, 1, FIRST_ETA , __VA_ARGS__) \
624 MACRO(secondR , 1, 1, 1, SECOND_R , __VA_ARGS__) \
625 MACRO(secondLambda , 1, 1, 1, SECOND_LAMBDA , __VA_ARGS__) \
626 MACRO(deltaPhi , 1, 1, 1, DELTA_PHI , __VA_ARGS__) \
627 MACRO(deltaTheta , 1, 1, 1, DELTA_THETA , __VA_ARGS__) \
628 MACRO(deltaAlpha , 1, 1, 1, DELTA_ALPHA , __VA_ARGS__) \
629 MACRO(centerX , 1, 1, 1, CENTER_X , __VA_ARGS__) \
630 MACRO(centerY , 1, 1, 1, CENTER_Y , __VA_ARGS__) \
631 MACRO(centerZ , 1, 1, 1, CENTER_Z , __VA_ARGS__) \
632 MACRO(centerMag , 1, 1, 1, CENTER_MAG , __VA_ARGS__) \
633 MACRO(centerLambda , 1, 1, 1, CENTER_LAMBDA , __VA_ARGS__) \
634 MACRO(lateral , 1, 1, 1, LATERAL , __VA_ARGS__) \
635 MACRO(longitudinal , 1, 1, 1, LONGITUDINAL , __VA_ARGS__) \
636 MACRO(engFracEM , 1, 1, 1, ENG_FRAC_EM , __VA_ARGS__) \
637 MACRO(engFracMax , 1, 1, 1, ENG_FRAC_MAX , __VA_ARGS__) \
638 MACRO(engFracCore , 1, 1, 1, ENG_FRAC_CORE , __VA_ARGS__) \
639 MACRO(firstEngDens , 1, 1, 1, FIRST_ENG_DENS , __VA_ARGS__) \
640 MACRO(secondEngDens , 1, 1, 1, SECOND_ENG_DENS , __VA_ARGS__) \
641 MACRO(isolation , 1, 1, 1, ISOLATION , __VA_ARGS__) \
642 MACRO(engBadCells , 1, 1, 1, ENG_BAD_CELLS , __VA_ARGS__) \
643 MACRO(nBadCells , 1, 1, 1, N_BAD_CELLS , __VA_ARGS__) \
644 MACRO(nBadCellsCorr , 1, 1, 1, N_BAD_CELLS_CORR , __VA_ARGS__) \
645 MACRO(badCellsCorrE , 1, 1, 1, BAD_CELLS_CORR_E , __VA_ARGS__) \
646 MACRO(badLArQFrac , 1, 1, 1, BADLARQ_FRAC , __VA_ARGS__) \
647 MACRO(engPos , 1, 1, 1, ENG_POS , __VA_ARGS__) \
648 MACRO(significance , 1, 1, 1, SIGNIFICANCE , __VA_ARGS__) \
649 MACRO(cellSignificance , 1, 1, 1, CELL_SIGNIFICANCE , __VA_ARGS__) \
650 MACRO(cellSigSampling , 1, 1, 1, CELL_SIG_SAMPLING , __VA_ARGS__) \
651 MACRO(avgLArQ , 1, 1, 1, AVG_LAR_Q , __VA_ARGS__) \
652 MACRO(avgTileQ , 1, 1, 1, AVG_TILE_Q , __VA_ARGS__) \
653 MACRO(engBadHVCells , 1, 1, 0, ENG_BAD_HV_CELLS , __VA_ARGS__) \
654 MACRO(nBadHVCells , 1, 1, 0, N_BAD_HV_CELLS , __VA_ARGS__) \
655 MACRO(PTD , 1, 1, 1, PTD , __VA_ARGS__) \
656 MACRO(mass , 1, 1, 1, MASS , __VA_ARGS__) \
657 MACRO(EMProbability , 1, 1, 1, EM_PROBABILITY , __VA_ARGS__) \
658 MACRO(hadWeight , 1, 1, 1, HAD_WEIGHT , __VA_ARGS__) \
659 MACRO(OOCweight , 1, 1, 1, OOC_WEIGHT , __VA_ARGS__) \
660 MACRO(DMweight , 1, 1, 1, DM_WEIGHT , __VA_ARGS__) \
661 MACRO(tileConfidenceLevel , 1, 1, 1, TILE_CONFIDENCE_LEVEL , __VA_ARGS__) \
662 MACRO(secondTime , 1, 0, 1, SECOND_TIME , __VA_ARGS__) \
663 MACRO(nCellSampling , 1, 0, 1, NCELL_SAMPLING , __VA_ARGS__) \
664 MACRO(nExtraCellSampling , 0, 0, 1, NCELL_SAMPLING , __VA_ARGS__) \
665 MACRO(vertexFraction , 1, 1, 0, VERTEX_FRACTION , __VA_ARGS__) \
666 MACRO(nVertexFraction , 1, 1, 0, NVERTEX_FRACTION , __VA_ARGS__) \
667 MACRO(etaCaloFrame , 1, 1, 0, ETACALOFRAME , __VA_ARGS__) \
668 MACRO(phiCaloFrame , 1, 1, 0, PHICALOFRAME , __VA_ARGS__) \
669 MACRO(eta1CaloFrame , 1, 1, 0, ETA1CALOFRAME , __VA_ARGS__) \
670 MACRO(phi1CaloFrame , 1, 1, 0, PHI1CALOFRAME , __VA_ARGS__) \
671 MACRO(eta2CaloFrame , 1, 1, 0, ETA2CALOFRAME , __VA_ARGS__) \
672 MACRO(phi2CaloFrame , 1, 1, 0, PHI2CALOFRAME , __VA_ARGS__) \
673 MACRO(engCalibTot , 1, 1, 0, ENG_CALIB_TOT , __VA_ARGS__) \
674 MACRO(engCalibOutL , 1, 1, 0, ENG_CALIB_OUT_L , __VA_ARGS__) \
675 MACRO(engCalibOutM , 1, 1, 0, ENG_CALIB_OUT_M , __VA_ARGS__) \
676 MACRO(engCalibOutT , 1, 1, 0, ENG_CALIB_OUT_T , __VA_ARGS__) \
677 MACRO(engCalibDeadL , 1, 1, 0, ENG_CALIB_DEAD_L , __VA_ARGS__) \
678 MACRO(engCalibDeadM , 1, 1, 0, ENG_CALIB_DEAD_M , __VA_ARGS__) \
679 MACRO(engCalibDeadT , 1, 1, 0, ENG_CALIB_DEAD_T , __VA_ARGS__) \
680 MACRO(engCalibEMB0 , 1, 1, 0, ENG_CALIB_EMB0 , __VA_ARGS__) \
681 MACRO(engCalibEME0 , 1, 1, 0, ENG_CALIB_EME0 , __VA_ARGS__) \
682 MACRO(engCalibTileG3 , 1, 1, 0, ENG_CALIB_TILEG3 , __VA_ARGS__) \
683 MACRO(engCalibDeadTot , 1, 1, 0, ENG_CALIB_DEAD_TOT , __VA_ARGS__) \
684 MACRO(engCalibDeadEMB0 , 1, 1, 0, ENG_CALIB_DEAD_EMB0 , __VA_ARGS__) \
685 MACRO(engCalibDeadTile0 , 1, 1, 0, ENG_CALIB_DEAD_TILE0 , __VA_ARGS__) \
686 MACRO(engCalibDeadTileG3 , 1, 1, 0, ENG_CALIB_DEAD_TILEG3 , __VA_ARGS__) \
687 MACRO(engCalibDeadEME0 , 1, 1, 0, ENG_CALIB_DEAD_EME0 , __VA_ARGS__) \
688 MACRO(engCalibDeadHEC0 , 1, 1, 0, ENG_CALIB_DEAD_HEC0 , __VA_ARGS__) \
689 MACRO(engCalibDeadFCAL , 1, 1, 0, ENG_CALIB_DEAD_FCAL , __VA_ARGS__) \
690 MACRO(engCalibDeadLeakage , 1, 1, 0, ENG_CALIB_DEAD_LEAKAGE , __VA_ARGS__) \
691 MACRO(engCalibDeadUnclass , 1, 1, 0, ENG_CALIB_DEAD_UNCLASS , __VA_ARGS__) \
692 MACRO(engCalibFracEM , 1, 1, 0, ENG_CALIB_FRAC_EM , __VA_ARGS__) \
693 MACRO(engCalibFracHad , 1, 1, 0, ENG_CALIB_FRAC_HAD , __VA_ARGS__) \
694 MACRO(engCalibFracRest , 1, 1, 0, ENG_CALIB_FRAC_REST , __VA_ARGS__)
699#define CALORECGPU_FORALLMOMENTS_HELPER(MOMENTNAME, ...) \
700 std::forward<F>(f)(this->moments. MOMENTNAME, std::forward<Args>(args)...);
706 template <
class F,
class ...
Args>
716 template <
class F,
class ...
Args>
732 const int outer_idx = idx / max_size;
733 const int inner_idx = idx % max_size;
739 return std::launder(
static_cast<PtrType
>(
static_cast<const void *
>(ptr)));
749 return *(arr[outer_idx] + inner_idx);
756 const int outer_idx = idx / max_size;
757 const int inner_idx = idx % max_size;
763 return std::launder(
static_cast<PtrType
>(
static_cast<void *
>(ptr)));
773 return *(arr[outer_idx] + inner_idx);
776 template <
class NewT = tag_type>
779 return std::launder(
static_cast<const NewT *
>(
static_cast<const void *
>(this->
cellWeights)));
781 template <
class NewT = tag_type>
784 return std::launder(
static_cast<NewT *
>(
static_cast<void *
>(this->
cellWeights)));
786 template <
class NewT = tag_type>
791 template <
class NewT = tag_type>
797 template <
class NewT = tag_type>
800 return std::launder(
static_cast<const NewT *
>(
static_cast<const void *
>(this->
clusterIndices)));
802 template <
class NewT = tag_type>
805 return std::launder(
static_cast<NewT *
>(
static_cast<void *
>(this->
clusterIndices)));
807 template <
class NewT = tag_type>
812 template <
class NewT = tag_type>
#define CALORECGPU_FORALLMOMENTS_HELPER(MOMENTNAME,...)
#define CALORECGPU_FORALLMOMENTS_INSTANTIATE(MACRO,...)
Provides utility functions to handle the gain conversion.
static constexpr GainType s_TileLowLow
static constexpr GainType from_standard_gain(const int gain)
static constexpr GainType max_gain_value()
static constexpr GainType s_TileHighHigh
static constexpr GainType s_TileHighLow
static constexpr GainType s_LArMedium
static constexpr GainType invalid_gain()
static constexpr GainType s_InvalidCell
static constexpr GainType s_gain_values_maximum
static constexpr GainType min_gain_value()
static constexpr GainType num_gain_values()
static constexpr GainType s_TileOneLow
static constexpr GainType s_gain_values_minimum
static constexpr GainType s_TileLowHigh
static constexpr GainType s_TileOneHigh
static constexpr GainType s_LArLow
static constexpr bool is_valid(const T &gain)
static constexpr GainType s_LArHigh
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
constexpr int NumSamplings
TagBase::carrier tag_type
constexpr int NMaxNeighbours
__host__ __device__ T * get_laundered_pointer(unsigned int idx, PtrLikes &&... p)
constexpr int NMaxClusters
Contains the fundamental information that allows interacting with CellInfoArr so that it is easier to...
constexpr int get_number_of_cells(const bool is_complete=false) const
Contains the per-event cell information: energy, timing, gain, quality and provenance.
QualityProvenance::carrier qualityProvenance[NCaloCells]
constexpr int get_hash_ID(const int cell, const bool is_complete=false) const
constexpr bool passes_time_cut(const GeometryArr &geom, const int cell, const float threshold, const bool use_crosstalk, const float crosstalk_delta, const bool is_complete=false) const
GPU equivalent of CaloTopoClusterMaker::passCellTimeCut.
constexpr int get_cell_with_hash_ID(const int index, const bool is_complete=false) const
constexpr bool is_bad(const int cell, const bool treat_L1_predicted_as_good=false, const bool is_complete=false) const
GPU version of CaloBadCellHelper::isBad.
int hashIDToCollection[NCaloCells]
static constexpr bool is_bad_general(const bool is_tile, const QualityProvenance qp, const bool treat_L1_predicted_as_good=false)
GPU version of CaloBadCellHelper::isBad.
unsigned char gain[NCaloCells]
constexpr bool is_valid(const int hash_ID, const bool is_complete=false, const bool all_cells_are_valid=false) const
Contains the fundamental information that allows interacting with ClusterInfoArr so that it is easier...
constexpr bool has_basic_info() const
constexpr bool has_cells_per_cluster() const
constexpr bool has_basic_info(const ClusterInformationState this_state) const
ClusterInformationState state
constexpr bool has_moments() const
bool has_deleted_clusters
static constexpr bool has_cells_per_cluster(const ClusterInformationState this_state)
static constexpr bool has_moments(const ClusterInformationState this_state)
float etaPerSample[NumSamplings][NMaxClusters]
float DMweight[NMaxClusters]
float centerX[NMaxClusters]
float phi2CaloFrame[NMaxClusters]
float engCalibFracHad[NMaxClusters]
float centerZ[NMaxClusters]
float engCalibEMB0[NMaxClusters]
float engCalibDeadEMB0[NMaxClusters]
float EMProbability[NMaxClusters]
float isolation[NMaxClusters]
int cellSigSampling[NMaxClusters]
float lateral[NMaxClusters]
float deltaAlpha[NMaxClusters]
float engFracMax[NMaxClusters]
float tileConfidenceLevel[NMaxClusters]
float maxEtaPerSample[NumSamplings][NMaxClusters]
float phi1CaloFrame[NMaxClusters]
int nExtraCellSampling[NMaxClusters]
float engCalibDeadEME0[NMaxClusters]
float engCalibDeadM[NMaxClusters]
float centerLambda[NMaxClusters]
int nBadCellsCorr[NMaxClusters]
float secondLambda[NMaxClusters]
float firstEta[NMaxClusters]
float significance[NMaxClusters]
float OOCweight[NMaxClusters]
float maxPhiPerSample[NumSamplings][NMaxClusters]
float vertexFraction[NMaxClusters]
float engCalibDeadTile0[NMaxClusters]
float phiCaloFrame[NMaxClusters]
float engCalibOutL[NMaxClusters]
float deltaPhi[NMaxClusters]
float eta1CaloFrame[NMaxClusters]
float engCalibOutT[NMaxClusters]
float engCalibDeadUnclass[NMaxClusters]
int nCellSampling[NumSamplings][NMaxClusters]
float etaCaloFrame[NMaxClusters]
float engBadHVCells[NMaxClusters]
float longitudinal[NMaxClusters]
float centerMag[NMaxClusters]
float avgLArQ[NMaxClusters]
float engCalibEME0[NMaxClusters]
float engPos[NMaxClusters]
float engCalibTot[NMaxClusters]
float secondEngDens[NMaxClusters]
float engCalibDeadTot[NMaxClusters]
float cellSignificance[NMaxClusters]
float badLArQFrac[NMaxClusters]
float secondTime[NMaxClusters]
int nVertexFraction[NMaxClusters]
float firstEngDens[NMaxClusters]
float badCellsCorrE[NMaxClusters]
float deltaTheta[NMaxClusters]
int nBadCells[NMaxClusters]
float engCalibDeadLeakage[NMaxClusters]
float engCalibFracEM[NMaxClusters]
float engCalibFracRest[NMaxClusters]
float centerY[NMaxClusters]
float energyPerSample[NumSamplings][NMaxClusters]
float nBadHVCells[NMaxClusters]
float firstPhi[NMaxClusters]
float hadWeight[NMaxClusters]
float engCalibDeadFCAL[NMaxClusters]
float engFracEM[NMaxClusters]
float engCalibDeadL[NMaxClusters]
float secondR[NMaxClusters]
float maxEPerSample[NumSamplings][NMaxClusters]
float phiPerSample[NumSamplings][NMaxClusters]
float engCalibDeadHEC0[NMaxClusters]
float engCalibTileG3[NMaxClusters]
float engCalibDeadT[NMaxClusters]
float eta2CaloFrame[NMaxClusters]
float engFracCore[NMaxClusters]
float engCalibDeadTileG3[NMaxClusters]
float avgTileQ[NMaxClusters]
float engCalibOutM[NMaxClusters]
float engBadCells[NMaxClusters]
constexpr const NewT & tertiary_tag_array(const int idx) const
constexpr void for_all_moments(F &&f, Args &&... args) const
F receives the array associated with the moment and any additional arguments.
constexpr NewT & tertiary_tag_array(const int idx)
int clusterIndices[2 *NCaloCells]
int indices[2 *NCaloCells]
struct CaloRecGPU::ClusterInfoArr::ClusterMomentsArr moments
float clusterPhi[NMaxClusters]
float clusterEt[NMaxClusters]
float clusterEta[NMaxClusters]
constexpr tag_type & get_extra_cell_info(const int idx)
constexpr NewT * secondary_tag_array()
tag_type tags[NCaloCells]
float clusterEnergy[NMaxClusters]
constexpr const NewT * secondary_tag_array() const
int seedCellIndex[NMaxClusters]
Invalid(ated) clusters have seedCellIndex < 0.
constexpr NewT & secondary_tag_array(const int idx)
constexpr const tag_type & get_extra_cell_info(const int idx) const
Extra representation for the cell tags, to save time for calculating the isolation moment after build...
float cellWeights[2 *NCaloCells]
union CaloRecGPU::ClusterInfoArr::@223264020040143137243361055037275307306030322160 cells
constexpr const NewT * tertiary_tag_array() const
int cellsPrefixSum[NMaxClusters+1]
constexpr const NewT & secondary_tag_array(const int idx) const
constexpr NewT * tertiary_tag_array()
constexpr void for_all_moments(F &&f, Args &&... args)
F receives the array associated with the moment and any additional arguments.
static constexpr bool is_tile(const int cell)
Just two uint16_t bit-packed onto a uint32_t.
static constexpr carrier s_8_bit_mask
constexpr QualityProvenance(const uint16_t quality, const uint16_t provenance)
constexpr unsigned int provenance() const
constexpr unsigned int tile_qual2() const
constexpr QualityProvenance(const uint8_t q1, const uint8_t q2, const uint8_t q3, const uint8_t q4)
constexpr unsigned int tile_qbit1() const
constexpr QualityProvenance & operator=(const carrier v)
constexpr QualityProvenance(const carrier v)
constexpr unsigned int tile_qual1() const
constexpr unsigned int quality() const
constexpr unsigned int tile_qbit2() const
static constexpr carrier s_16_bit_mask