CMS 3D CMS Logo

List of all members | Public Member Functions
calibPixel::CalibDigis Struct Reference

#include <CalibPixel.h>

Public Member Functions

template<typename TAcc >
ALPAKA_FN_ACC void operator() (const TAcc &acc, SiPixelClusterThresholds clusterThresholds, SiPixelDigisSoAView view, SiPixelClustersSoAView clus_view, const SiPixelGainCalibrationForHLTSoAConstView gains, int numElements) const
 

Detailed Description

Definition at line 29 of file CalibPixel.h.

Member Function Documentation

◆ operator()()

template<typename TAcc >
ALPAKA_FN_ACC void calibPixel::CalibDigis::operator() ( const TAcc &  acc,
SiPixelClusterThresholds  clusterThresholds,
SiPixelDigisSoAView  view,
SiPixelClustersSoAView  clus_view,
const SiPixelGainCalibrationForHLTSoAConstView  gains,
int  numElements 
) const
inline

Definition at line 31 of file CalibPixel.h.

References cuy::col, cms::alpakatools::for_each_element_in_grid_strided(), PedestalClient_cfi::gain, ecalph2::gains, SiPixelGainUtilities::getPedAndGain(), mps_fire::i, calibPixel::InvId, SiStripPI::max, phase1PixelTopology::numberOfModules, gpuClustering::numElements, hltrates_dqm_sourceclient-live_cfg::offset, cms::alpakatools::once_per_grid(), EcalCondDBWriter_cfi::pedestal, runTheMatrix::ret, SiPixelClusterThresholds::vCaltoElectronGain, HLT_2023v12_cff::VCaltoElectronGain, SiPixelClusterThresholds::vCaltoElectronGain_L1, HLT_2023v12_cff::VCaltoElectronGain_L1, SiPixelClusterThresholds::vCaltoElectronOffset, HLT_2023v12_cff::VCaltoElectronOffset, SiPixelClusterThresholds::vCaltoElectronOffset_L1, and HLT_2023v12_cff::VCaltoElectronOffset_L1.

36  {
37  const float VCaltoElectronGain = clusterThresholds.vCaltoElectronGain;
38  const float VCaltoElectronGain_L1 = clusterThresholds.vCaltoElectronGain_L1;
39  const float VCaltoElectronOffset = clusterThresholds.vCaltoElectronOffset;
40  const float VCaltoElectronOffset_L1 = clusterThresholds.vCaltoElectronOffset_L1;
41 
42  // zero for next kernels...
44  clus_view[0].clusModuleStart() = clus_view[0].moduleStart() = 0;
45  }
46 
48  acc, phase1PixelTopology::numberOfModules, [&](uint32_t i) { clus_view[i].clusInModule() = 0; });
50  auto dvgi = view[i];
51  if (dvgi.moduleId() != InvId) {
52  bool isDeadColumn = false, isNoisyColumn = false;
53  int row = dvgi.xx();
54  int col = dvgi.yy();
55  auto ret = SiPixelGainUtilities::getPedAndGain(gains, dvgi.moduleId(), col, row, isDeadColumn, isNoisyColumn);
56  float pedestal = ret.first;
57  float gain = ret.second;
58  if (isDeadColumn | isNoisyColumn) {
59  dvgi.moduleId() = InvId;
60  dvgi.adc() = 0;
61  printf("bad pixel at %d in %d\n", i, dvgi.moduleId());
62  } else {
63  float vcal = dvgi.adc() * gain - pedestal * gain;
64 
65  float conversionFactor = dvgi.moduleId() < 96 ? VCaltoElectronGain_L1 : VCaltoElectronGain;
66  float offset = dvgi.moduleId() < 96 ? VCaltoElectronOffset_L1 : VCaltoElectronOffset;
67 #ifdef GPU_DEBUG
68  auto old_adc = dvgi.adc();
69 #endif
70  dvgi.adc() = std::max(100, int(vcal * conversionFactor + offset));
71 #ifdef GPU_DEBUG
73  printf(
74  "module %d pixel %d -> old_adc = %d; vcal = %.2f; conversionFactor = %.2f; offset = %.2f; new_adc = "
75  "%d \n",
76  dvgi.moduleId(),
77  i,
78  old_adc,
79  vcal,
80  conversionFactor,
81  offset,
82  dvgi.adc());
83  }
84 #endif
85  }
86  }
87  });
88  }
ret
prodAgent to be discontinued
constexpr uint16_t numberOfModules
ALPAKA_FN_ACC void for_each_element_in_grid_strided(const TAcc &acc, const Idx maxNumberOfElements, const Idx elementIdxShift, const Func func, const unsigned int dimIndex=0)
Definition: workdivision.h:975
constexpr float gains[NGAINS]
Definition: EcalConstants.h:20
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
constexpr uint16_t InvId
Definition: CalibPixel.h:26
ALPAKA_FN_ACC constexpr bool once_per_grid(TAcc const &acc)
Definition: workdivision.h:793
ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC static ALPAKA_FN_INLINE std::pair< float, float > getPedAndGain(const SiPixelGainCalibrationForHLTSoAConstView &view, uint32_t moduleInd, int col, int row, bool &isDeadColumn, bool &isNoisyColumn)
col
Definition: cuy.py:1009