CMS 3D CMS Logo

Classes | Functions | Variables
hcal::reconstruction Namespace Reference

Classes

struct  ConditionsProducts
 
struct  ConfigParameters
 
struct  InputDataGPU
 
struct  OutputDataGPU
 
struct  ScratchDataGPU
 

Functions

__forceinline__ __device__ float compute_coder_charge (int const qieType, uint8_t const adc, uint8_t const capid, float const *qieOffsets, float const *qieSlopes)
 
__forceinline__ __device__ float compute_diff_charge_gain (int const qieType, uint8_t adc, uint8_t const capid, float const *qieOffsets, float const *qieSlopes, bool const isqie11)
 
__forceinline__ __device__ float compute_pulse_shape_value (float const pulse_time, int const sample, int const shift, float const *acc25nsVec, float const *diff25nsItvlVec, float const *accVarLenIdxMinusOneVec, float const *diffVarItvlIdxMinusOneVec, float const *accVarLenIdxZeroVec, float const *diffVarItvlIdxZeroVec)
 
__forceinline__ __device__ float compute_reco_correction_factor (float const par1, float const par2, float const par3, float const x)
 
__forceinline__ __device__ float compute_time_slew_delay (float const fC, float const tzero, float const slope, float const tmax)
 
__forceinline__ __device__ uint32_t did2linearIndexHB (uint32_t const didraw, int const maxDepthHB, int const firstHBRing, int const lastHBRing, int const nEtaHB)
 
__forceinline__ __device__ uint32_t did2linearIndexHE (uint32_t const didraw, int const maxDepthHE, int const maxPhiHE, int const firstHERing, int const lastHERing, int const nEtaHE)
 
void entryPoint (InputDataGPU const &, OutputDataGPU &, ConditionsProducts const &, ScratchDataGPU &, ConfigParameters const &, cudaStream_t)
 
__forceinline__ __device__ uint32_t get_qiecoder_index (uint32_t const capid, uint32_t const range)
 

Variables

constexpr int32_t IPHI_MAX = 72
 
__constant__ const float qie11shape [257]
 
__constant__ const float qie8shape [129]
 

Function Documentation

◆ compute_coder_charge()

__forceinline__ __device__ float hcal::reconstruction::compute_coder_charge ( int const  qieType,
uint8_t const  adc,
uint8_t const  capid,
float const *  qieOffsets,
float const *  qieSlopes 
)

Definition at line 97 of file KernelHelpers.h.

98  {
99  auto const range = qieType == 0 ? (adc >> 5) & 0x3 : (adc >> 6) & 0x3;
100  auto const* qieShapeToUse = qieType == 0 ? qie8shape : qie11shape;
101  auto const nbins = qieType == 0 ? 32 : 64;
102  auto const center = adc % nbins == nbins - 1 ? 0.5 * (3 * qieShapeToUse[adc] - qieShapeToUse[adc - 1])
103  : 0.5 * (qieShapeToUse[adc] + qieShapeToUse[adc + 1]);
104  auto const index = get_qiecoder_index(capid, range);
105  return (center - qieOffsets[index]) / qieSlopes[index];
106  }

References gpuClustering::adc, get_qiecoder_index(), LaserClient_cfi::nbins, qie11shape, qie8shape, and FastTimerService_cff::range.

Referenced by compute_diff_charge_gain().

◆ compute_diff_charge_gain()

__forceinline__ __device__ float hcal::reconstruction::compute_diff_charge_gain ( int const  qieType,
uint8_t  adc,
uint8_t const  capid,
float const *  qieOffsets,
float const *  qieSlopes,
bool const  isqie11 
)

Definition at line 111 of file KernelHelpers.h.

116  {
117  constexpr uint32_t mantissaMaskQIE8 = 0x1fu;
118  constexpr uint32_t mantissaMaskQIE11 = 0x3f;
119  auto const mantissaMask = isqie11 ? mantissaMaskQIE11 : mantissaMaskQIE8;
120  auto const q = compute_coder_charge(qieType, adc, capid, qieOffsets, qieSlopes);
121  auto const mantissa = adc & mantissaMask;
122 
123  if (mantissa == 0u || mantissa == mantissaMask - 1u)
124  return compute_coder_charge(qieType, adc + 1u, capid, qieOffsets, qieSlopes) - q;
125  else if (mantissa == 1u || mantissa == mantissaMask)
126  return q - compute_coder_charge(qieType, adc - 1u, capid, qieOffsets, qieSlopes);
127  else {
128  auto const qup = compute_coder_charge(qieType, adc + 1u, capid, qieOffsets, qieSlopes);
129  auto const qdown = compute_coder_charge(qieType, adc - 1u, capid, qieOffsets, qieSlopes);
130  auto const upgain = qup - q;
131  auto const downgain = q - qdown;
132  auto const averagegain = (qup - qdown) / 2.f;
133  if (std::abs(upgain - downgain) < 0.01f * averagegain)
134  return averagegain;
135  else {
136  auto const q2up = compute_coder_charge(qieType, adc + 2u, capid, qieOffsets, qieSlopes);
137  auto const q2down = compute_coder_charge(qieType, adc - 2u, capid, qieOffsets, qieSlopes);
138  auto const upgain2 = q2up - qup;
139  auto const downgain2 = qdown - q2down;
140  if (std::abs(upgain2 - upgain) < std::abs(downgain2 - downgain))
141  return upgain;
142  else
143  return downgain;
144  }
145  }
146  }

References funct::abs(), gpuClustering::adc, compute_coder_charge(), f, and submitPVResolutionJobs::q.

◆ compute_pulse_shape_value()

__forceinline__ __device__ float hcal::reconstruction::compute_pulse_shape_value ( float const  pulse_time,
int const  sample,
int const  shift,
float const *  acc25nsVec,
float const *  diff25nsItvlVec,
float const *  accVarLenIdxMinusOneVec,
float const *  diffVarItvlIdxMinusOneVec,
float const *  accVarLenIdxZeroVec,
float const *  diffVarItvlIdxZeroVec 
)

Definition at line 150 of file KernelHelpers.h.

158  {
159  // constants
160  constexpr float slew = 0.f;
161  constexpr auto ns_per_bx = hcal::constants::nsPerBX;
162 
163  // FIXME: clean up all the rounding... this is coming from original cpu version
164  float const i_start_float = -hcal::constants::iniTimeShift - pulse_time - slew > 0.f
165  ? 0.f
166  : std::abs(-hcal::constants::iniTimeShift - pulse_time - slew) + 1.f;
167  int i_start = static_cast<int>(i_start_float);
168  float offset_start = static_cast<float>(i_start) - hcal::constants::iniTimeShift - pulse_time - slew;
169  // FIXME: do we need a check for nan???
170 #ifdef HCAL_MAHI_GPUDEBUG
171  if (shift == 0)
172  printf("i_start_float = %f i_start = %d offset_start = %f\n", i_start_float, i_start, offset_start);
173 #endif
174 
175  // boundary
176  if (offset_start == 1.0f) {
177  offset_start = 0.f;
178  i_start -= 1;
179  }
180 
181 #ifdef HCAL_MAHI_GPUDEBUG
182  if (shift == 0)
183  printf("i_start_float = %f i_start = %d offset_start = %f\n", i_start_float, i_start, offset_start);
184 #endif
185 
186  int const bin_start = static_cast<int>(offset_start);
187  auto const bin_start_up = static_cast<float>(bin_start) + 0.5f;
188  int const bin_0_start = offset_start < bin_start_up ? bin_start - 1 : bin_start;
189  int const its_start = i_start / ns_per_bx;
190  int const distTo25ns_start = hcal::constants::nsPerBX - 1 - i_start % ns_per_bx;
191  auto const factor = offset_start - static_cast<float>(bin_0_start) - 0.5;
192 
193 #ifdef HCAL_MAHI_GPUDEBUG
194  if (shift == 0) {
195  printf("bin_start = %d bin_0_start = %d its_start = %d distTo25ns_start = %d factor = %f\n",
196  bin_start,
197  bin_0_start,
198  its_start,
199  distTo25ns_start,
200  factor);
201  }
202 #endif
203 
204  auto const sample_over10ts = sample + shift;
205  float value = 0.0f;
206  if (sample_over10ts == its_start) {
207  value = bin_0_start == -1
208  ? accVarLenIdxMinusOneVec[distTo25ns_start] + factor * diffVarItvlIdxMinusOneVec[distTo25ns_start]
209  : accVarLenIdxZeroVec[distTo25ns_start] + factor * diffVarItvlIdxZeroVec[distTo25ns_start];
210  } else if (sample_over10ts > its_start) {
211  int const bin_idx = distTo25ns_start + 1 + (sample_over10ts - its_start - 1) * ns_per_bx + bin_0_start;
212  value = acc25nsVec[bin_idx] + factor * diff25nsItvlVec[bin_idx];
213  }
214  return value;
215  }

References funct::abs(), f, DQMScaleToClient_cfi::factor, hcal::constants::iniTimeShift, hcal::constants::nsPerBX, simplePhotonAnalyzer_cfi::sample, edm::shift, and relativeConstraints::value.

◆ compute_reco_correction_factor()

__forceinline__ __device__ float hcal::reconstruction::compute_reco_correction_factor ( float const  par1,
float const  par2,
float const  par3,
float const  x 
)

Definition at line 89 of file KernelHelpers.h.

92  {
93  return par3 * x * x + par2 * x + par1;
94  }

References pfMETCorrectionType0_cfi::par1, pfMETCorrectionType0_cfi::par2, and pfMETCorrectionType0_cfi::par3.

◆ compute_time_slew_delay()

__forceinline__ __device__ float hcal::reconstruction::compute_time_slew_delay ( float const  fC,
float const  tzero,
float const  slope,
float const  tmax 
)

Definition at line 14 of file KernelHelpers.h.

17  {
18  auto const rawDelay = tzero + slope * std::log(fC);
19  return rawDelay < 0 ? 0 : (rawDelay > tmax ? tmax : rawDelay);
20  }

References dqm-mbProfile::log, slope, tmax, and tzero.

◆ did2linearIndexHB()

__forceinline__ __device__ uint32_t hcal::reconstruction::did2linearIndexHB ( uint32_t const  didraw,
int const  maxDepthHB,
int const  firstHBRing,
int const  lastHBRing,
int const  nEtaHB 
)

Definition at line 65 of file KernelHelpers.h.

66  {
67  HcalDetId did{didraw};
68  uint32_t const value = (did.depth() - 1) + maxDepthHB * (did.iphi() - 1);
69  return did.ieta() > 0 ? value + maxDepthHB * hcal::reconstruction::IPHI_MAX * (did.ieta() - firstHBRing)
70  : value + maxDepthHB * hcal::reconstruction::IPHI_MAX * (did.ieta() + lastHBRing + nEtaHB);
71  }

References IPHI_MAX, and hcalSLHCTopologyConstants_cfi::maxDepthHB.

◆ did2linearIndexHE()

__forceinline__ __device__ uint32_t hcal::reconstruction::did2linearIndexHE ( uint32_t const  didraw,
int const  maxDepthHE,
int const  maxPhiHE,
int const  firstHERing,
int const  lastHERing,
int const  nEtaHE 
)

Definition at line 73 of file KernelHelpers.h.

78  {
79  HcalDetId did{didraw};
80  uint32_t const value = (did.depth() - 1) + maxDepthHE * (did.iphi() - 1);
81  return did.ieta() > 0 ? value + maxDepthHE * maxPhiHE * (did.ieta() - firstHERing)
82  : value + maxDepthHE * maxPhiHE * (did.ieta() + lastHERing + nEtaHE);
83  }

References hcalSLHCTopologyConstants_cfi::maxDepthHE.

◆ entryPoint()

void hcal::reconstruction::entryPoint ( InputDataGPU const &  ,
OutputDataGPU ,
ConditionsProducts const &  ,
ScratchDataGPU ,
ConfigParameters const &  ,
cudaStream_t   
)

◆ get_qiecoder_index()

__forceinline__ __device__ uint32_t hcal::reconstruction::get_qiecoder_index ( uint32_t const  capid,
uint32_t const  range 
)

Definition at line 85 of file KernelHelpers.h.

85  {
86  return capid * 4 + range;
87  }

References FastTimerService_cff::range.

Referenced by compute_coder_charge().

Variable Documentation

◆ IPHI_MAX

constexpr int32_t hcal::reconstruction::IPHI_MAX = 72
constexpr

Definition at line 63 of file KernelHelpers.h.

Referenced by did2linearIndexHB().

◆ qie11shape

__constant__ const float hcal::reconstruction::qie11shape[257]
Initial value:
= {
-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5,
11.5, 12.5, 13.5, 14.5, 15.5, 17.5, 19.5, 21.5, 23.5, 25.5, 27.5, 29.5,
31.5, 33.5, 35.5, 37.5, 39.5, 41.5, 43.5, 45.5, 47.5, 49.5, 51.5, 53.5,
55.5, 59.5, 63.5, 67.5, 71.5, 75.5, 79.5, 83.5, 87.5, 91.5, 95.5, 99.5,
103.5, 107.5, 111.5, 115.5, 119.5, 123.5, 127.5, 131.5, 135.5, 139.5, 147.5, 155.5,
163.5, 171.5, 179.5, 187.5, 171.5, 179.5, 187.5, 195.5, 203.5, 211.5, 219.5, 227.5,
235.5, 243.5, 251.5, 259.5, 267.5, 275.5, 283.5, 291.5, 299.5, 315.5, 331.5, 347.5,
363.5, 379.5, 395.5, 411.5, 427.5, 443.5, 459.5, 475.5, 491.5, 507.5, 523.5, 539.5,
555.5, 571.5, 587.5, 603.5, 619.5, 651.5, 683.5, 715.5, 747.5, 779.5, 811.5, 843.5,
875.5, 907.5, 939.5, 971.5, 1003.5, 1035.5, 1067.5, 1099.5, 1131.5, 1163.5, 1195.5, 1227.5,
1259.5, 1291.5, 1355.5, 1419.5, 1483.5, 1547.5, 1611.5, 1675.5, 1547.5, 1611.5, 1675.5, 1739.5,
1803.5, 1867.5, 1931.5, 1995.5, 2059.5, 2123.5, 2187.5, 2251.5, 2315.5, 2379.5, 2443.5, 2507.5,
2571.5, 2699.5, 2827.5, 2955.5, 3083.5, 3211.5, 3339.5, 3467.5, 3595.5, 3723.5, 3851.5, 3979.5,
4107.5, 4235.5, 4363.5, 4491.5, 4619.5, 4747.5, 4875.5, 5003.5, 5131.5, 5387.5, 5643.5, 5899.5,
6155.5, 6411.5, 6667.5, 6923.5, 7179.5, 7435.5, 7691.5, 7947.5, 8203.5, 8459.5, 8715.5, 8971.5,
9227.5, 9483.5, 9739.5, 9995.5, 10251.5, 10507.5, 11019.5, 11531.5, 12043.5, 12555.5, 13067.5, 13579.5,
12555.5, 13067.5, 13579.5, 14091.5, 14603.5, 15115.5, 15627.5, 16139.5, 16651.5, 17163.5, 17675.5, 18187.5,
18699.5, 19211.5, 19723.5, 20235.5, 20747.5, 21771.5, 22795.5, 23819.5, 24843.5, 25867.5, 26891.5, 27915.5,
28939.5, 29963.5, 30987.5, 32011.5, 33035.5, 34059.5, 35083.5, 36107.5, 37131.5, 38155.5, 39179.5, 40203.5,
41227.5, 43275.5, 45323.5, 47371.5, 49419.5, 51467.5, 53515.5, 55563.5, 57611.5, 59659.5, 61707.5, 63755.5,
65803.5, 67851.5, 69899.5, 71947.5, 73995.5, 76043.5, 78091.5, 80139.5, 82187.5, 84235.5, 88331.5, 92427.5,
96523.5, 100620, 104716, 108812, 112908}

Definition at line 34 of file KernelHelpers.h.

Referenced by compute_coder_charge().

◆ qie8shape

__constant__ const float hcal::reconstruction::qie8shape[129]
Initial value:
= {
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16,
18, 20, 22, 24, 26, 28, 31, 34, 37, 40, 44, 48, 52, 57, 62, 57, 62,
67, 72, 77, 82, 87, 92, 97, 102, 107, 112, 117, 122, 127, 132, 142, 152, 162,
172, 182, 192, 202, 217, 232, 247, 262, 282, 302, 322, 347, 372, 347, 372, 397, 422,
447, 472, 497, 522, 547, 572, 597, 622, 647, 672, 697, 722, 772, 822, 872, 922, 972,
1022, 1072, 1147, 1222, 1297, 1372, 1472, 1572, 1672, 1797, 1922, 1797, 1922, 2047, 2172, 2297, 2422,
2547, 2672, 2797, 2922, 3047, 3172, 3297, 3422, 3547, 3672, 3922, 4172, 4422, 4672, 4922, 5172, 5422,
5797, 6172, 6547, 6922, 7422, 7922, 8422, 9047, 9672, 10297}

Definition at line 24 of file KernelHelpers.h.

Referenced by compute_coder_charge().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
hcal::reconstruction::qie8shape
__constant__ const float qie8shape[129]
Definition: KernelHelpers.h:24
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
hcal::constants::nsPerBX
constexpr int nsPerBX
Definition: HcalConstants.h:8
hcalSLHCTopologyConstants_cfi.maxDepthHB
maxDepthHB
Definition: hcalSLHCTopologyConstants_cfi.py:5
pfMETCorrectionType0_cfi.par1
par1
Definition: pfMETCorrectionType0_cfi.py:48
hcal::constants::iniTimeShift
constexpr float iniTimeShift
Definition: HcalConstants.h:9
tmax
static const double tmax[3]
Definition: CastorTimeSlew.cc:7
hcal::reconstruction::qie11shape
__constant__ const float qie11shape[257]
Definition: KernelHelpers.h:34
pfMETCorrectionType0_cfi.par3
par3
Definition: pfMETCorrectionType0_cfi.py:50
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
hcal::reconstruction::IPHI_MAX
constexpr int32_t IPHI_MAX
Definition: KernelHelpers.h:63
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
tzero
static const double tzero[3]
Definition: CastorTimeSlew.cc:5
hcalSLHCTopologyConstants_cfi.maxDepthHE
maxDepthHE
Definition: hcalSLHCTopologyConstants_cfi.py:6
hcal::reconstruction::get_qiecoder_index
__forceinline__ __device__ uint32_t get_qiecoder_index(uint32_t const capid, uint32_t const range)
Definition: KernelHelpers.h:85
pfMETCorrectionType0_cfi.par2
par2
Definition: pfMETCorrectionType0_cfi.py:49
HcalDetId
Definition: HcalDetId.h:12
value
Definition: value.py:1
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
hcal::reconstruction::compute_coder_charge
__forceinline__ __device__ float compute_coder_charge(int const qieType, uint8_t const adc, uint8_t const capid, float const *qieOffsets, float const *qieSlopes)
Definition: KernelHelpers.h:97
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
relativeConstraints.value
value
Definition: relativeConstraints.py:53
genVertex_cff.x
x
Definition: genVertex_cff.py:13
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6