CMS 3D CMS Logo

List of all members | Public Member Functions
calibPixel::CalibDigis< debug > Struct Template 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

template<bool debug = false>
struct calibPixel::CalibDigis< debug >

Definition at line 26 of file CalibPixel.h.

Member Function Documentation

◆ operator()()

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

Definition at line 28 of file CalibPixel.h.

References cuy::col, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), debug, PedestalClient_cfi::gain, ecalph2::gains, SiPixelGainUtilities::getPedAndGain(), mps_fire::i, gpuClustering::invalidModuleId, SiStripPI::max, phase1PixelTopology::numberOfModules, gpuClustering::numElements, hltrates_dqm_sourceclient-live_cfg::offset, cms::alpakatools::once_per_grid(), EcalCondDBWriter_cfi::pedestal, runTheMatrix::ret, cms::alpakatools::uniform_elements(), SiPixelClusterThresholds::vCaltoElectronGain, HLT_2024v14_cff::VCaltoElectronGain, SiPixelClusterThresholds::vCaltoElectronGain_L1, HLT_2024v14_cff::VCaltoElectronGain_L1, SiPixelClusterThresholds::vCaltoElectronOffset, HLT_2024v14_cff::VCaltoElectronOffset, SiPixelClusterThresholds::vCaltoElectronOffset_L1, and HLT_2024v14_cff::VCaltoElectronOffset_L1.

33  {
34  const float VCaltoElectronGain = clusterThresholds.vCaltoElectronGain;
35  const float VCaltoElectronGain_L1 = clusterThresholds.vCaltoElectronGain_L1;
36  const float VCaltoElectronOffset = clusterThresholds.vCaltoElectronOffset;
37  const float VCaltoElectronOffset_L1 = clusterThresholds.vCaltoElectronOffset_L1;
38 
39  // zero for next kernels...
41  clus_view[0].clusModuleStart() = 0;
42  clus_view[0].moduleStart() = 0;
43  }
45  clus_view[i].clusInModule() = 0;
46  }
47 
49  auto dvgi = view[i];
50  if (dvgi.moduleId() == ::pixelClustering::invalidModuleId)
51  continue;
52 
53  bool isDeadColumn = false, isNoisyColumn = false;
54  int row = dvgi.xx();
55  int col = dvgi.yy();
56  auto ret = SiPixelGainUtilities::getPedAndGain(gains, dvgi.moduleId(), col, row, isDeadColumn, isNoisyColumn);
57  float pedestal = ret.first;
58  float gain = ret.second;
59  if (isDeadColumn | isNoisyColumn) {
60  if constexpr (debug)
61  printf("bad pixel at %d in %d\n", i, dvgi.moduleId());
62  dvgi.moduleId() = ::pixelClustering::invalidModuleId;
63  dvgi.adc() = 0;
64  } else {
65  float vcal = dvgi.adc() * gain - pedestal * gain;
66 
67  float conversionFactor = dvgi.moduleId() < 96 ? VCaltoElectronGain_L1 : VCaltoElectronGain;
68  float offset = dvgi.moduleId() < 96 ? VCaltoElectronOffset_L1 : VCaltoElectronOffset;
69 #ifdef GPU_DEBUG
70  auto old_adc = dvgi.adc();
71 #endif
72  dvgi.adc() = std::max(100, int(vcal * conversionFactor + offset));
73 #ifdef GPU_DEBUG
75  printf(
76  "module %d pixel %d -> old_adc = %d; vcal = %.2f; conversionFactor = %.2f; offset = %.2f; new_adc = "
77  "%d \n",
78  dvgi.moduleId(),
79  i,
80  old_adc,
81  vcal,
82  conversionFactor,
83  offset,
84  dvgi.adc());
85  }
86 #endif
87  }
88  }
89  }
ALPAKA_FN_ACC auto uniform_elements(TAcc const &acc, TArgs... args)
Definition: workdivision.h:311
ret
prodAgent to be discontinued
constexpr uint16_t numberOfModules
constexpr uint16_t invalidModuleId
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
#define debug
Definition: HDRShower.cc:19
ALPAKA_FN_ACC constexpr bool once_per_grid(TAcc const &acc)
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