CMS 3D CMS Logo

SiPixelGainCalibrationForHLTUtilities.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h
2 #define CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h
3 
4 #include <cstdint>
5 #include <alpaka/alpaka.hpp>
7 
9  ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC ALPAKA_FN_INLINE static std::pair<float, float> getPedAndGain(
11  uint32_t moduleInd,
12  int col,
13  int row,
14  bool& isDeadColumn,
15  bool& isNoisyColumn) {
16  auto start = view.modStarts()[moduleInd];
17  auto end = view.modEnds()[moduleInd];
18  auto nCols = view.modCols()[moduleInd];
19  // determine what averaged data block we are in (there should be 1 or 2 of these depending on if plaquette is 1 by X or 2 by X
20  unsigned int lengthOfColumnData = (end - start) / nCols;
21  unsigned int lengthOfAveragedDataInEachColumn = 2; // we always only have two values per column averaged block
22  unsigned int numberOfDataBlocksToSkip = row / view.numberOfRowsAveragedOver();
23 
24  auto offset = start + col * lengthOfColumnData + lengthOfAveragedDataInEachColumn * numberOfDataBlocksToSkip;
25  assert(offset < end);
26  assert(offset < 3088384);
27  assert(0 == offset % 2);
28 
29  auto lp = view.v_pedestals();
30  auto s = lp[offset / 2];
31 
32  isDeadColumn = (s.ped & 0xFF) == view.deadFlag();
33  isNoisyColumn = (s.ped & 0xFF) == view.noisyFlag();
34  float decodeGain = float(s.gain & 0xFF) * view.gainPrecision() + view.minGain();
35  float decodePed = float(s.ped & 0xFF) * view.pedPrecision() + view.minPed();
36 
37  return std::make_pair(decodePed, decodeGain);
38  };
39 };
40 
41 #endif //CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h
Definition: start.py:1
assert(be >=bs)
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