CMS 3D CMS Logo

PixelCPEFast.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 
11 
12 // Services
13 // this is needed to get errors from templates
14 
15 namespace {
16  constexpr float micronsToCm = 1.0e-4;
17 }
18 
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
22 template <typename TrackerTraits>
24  const MagneticField* mag,
25  const TrackerGeometry& geom,
26  const TrackerTopology& ttopo,
27  const SiPixelLorentzAngle* lorentzAngle,
28  const SiPixelGenErrorDBObject* genErrorDBObject,
29  const SiPixelLorentzAngle* lorentzAngleWidth)
30  : PixelCPEGenericBase(conf, mag, geom, ttopo, lorentzAngle, genErrorDBObject, lorentzAngleWidth) {
31  // Use errors from templates or from GenError
34  throw cms::Exception("InvalidCalibrationLoaded")
35  << "ERROR: GenErrors not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
36  << (*genErrorDBObject_).version();
37  }
38 
40 
41  cpuData_ = {
43  detParamsGPU_.data(),
46  };
47 }
48 
49 template <typename TrackerTraits>
51  cudaStream_t cudaStream) const {
55 
56  const auto& data = gpuData_.dataForCurrentDeviceAsync(cudaStream, [this](GPUData& data, cudaStream_t stream) {
57  // and now copy to device...
58 
59  cudaCheck(cudaMalloc((void**)&data.paramsOnGPU_h.m_commonParams, sizeof(pixelCPEforGPU::CommonParams)));
60  cudaCheck(cudaMalloc((void**)&data.paramsOnGPU_h.m_detParams,
61  this->detParamsGPU_.size() * sizeof(pixelCPEforGPU::DetParams)));
62  cudaCheck(cudaMalloc((void**)&data.paramsOnGPU_h.m_averageGeometry, sizeof(AverageGeometry)));
63  cudaCheck(cudaMalloc((void**)&data.paramsOnGPU_h.m_layerGeometry, sizeof(LayerGeometry)));
64  cudaCheck(cudaMalloc((void**)&data.paramsOnGPU_d, sizeof(ParamsOnGPU)));
65  cudaCheck(cudaMemcpyAsync(data.paramsOnGPU_d, &data.paramsOnGPU_h, sizeof(ParamsOnGPU), cudaMemcpyDefault, stream));
66  cudaCheck(cudaMemcpyAsync((void*)data.paramsOnGPU_h.m_commonParams,
67  &this->commonParamsGPU_,
69  cudaMemcpyDefault,
70  stream));
71  cudaCheck(cudaMemcpyAsync((void*)data.paramsOnGPU_h.m_averageGeometry,
72  &this->averageGeometry_,
73  sizeof(AverageGeometry),
74  cudaMemcpyDefault,
75  stream));
76  cudaCheck(cudaMemcpyAsync((void*)data.paramsOnGPU_h.m_layerGeometry,
77  &this->layerGeometry_,
78  sizeof(LayerGeometry),
79  cudaMemcpyDefault,
80  stream));
81  cudaCheck(cudaMemcpyAsync((void*)data.paramsOnGPU_h.m_detParams,
82  this->detParamsGPU_.data(),
83  this->detParamsGPU_.size() * sizeof(pixelCPEforGPU::DetParams),
84  cudaMemcpyDefault,
85  stream));
86  });
87  return data.paramsOnGPU_d;
88 }
89 
90 template <typename TrackerTraits>
92  //
93  // this code executes only once per job, computation inefficiency is not an issue
94  // many code blocks are repeated: better keep the computation local and self oconsistent as blocks may in future move around, be deleted ...
95  // It is valid only for Phase1 and the version of GenError in DB used in late 2018 and in 2021
96 
97  commonParamsGPU_.theThicknessB = m_DetParams.front().theThickness;
98  commonParamsGPU_.theThicknessE = m_DetParams.back().theThickness;
99  commonParamsGPU_.thePitchX = m_DetParams[0].thePitchX;
100  commonParamsGPU_.thePitchY = m_DetParams[0].thePitchY;
101 
102  commonParamsGPU_.numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
103 
104  LogDebug("PixelCPEFast") << "pitch & thickness " << commonParamsGPU_.thePitchX << ' ' << commonParamsGPU_.thePitchY
105  << " " << commonParamsGPU_.theThicknessB << ' ' << commonParamsGPU_.theThicknessE;
106 
107  // zero average geometry
108  memset(&averageGeometry_, 0, sizeof(pixelTopology::AverageGeometryT<TrackerTraits>));
109 
110  uint32_t oldLayer = 0;
111  uint32_t oldLadder = 0;
112  float rl = 0;
113  float zl = 0;
114  float miz = 500, mxz = 0;
115  float pl = 0;
116  int nl = 0;
117  detParamsGPU_.resize(m_DetParams.size());
118 
119  for (auto i = 0U; i < m_DetParams.size(); ++i) {
120  auto& p = m_DetParams[i];
121  auto& g = detParamsGPU_[i];
122 
123  g.nRowsRoc = p.theDet->specificTopology().rowsperroc();
124  g.nColsRoc = p.theDet->specificTopology().colsperroc();
125  g.nRows = p.theDet->specificTopology().rocsX() * g.nRowsRoc;
126  g.nCols = p.theDet->specificTopology().rocsY() * g.nColsRoc;
127 
128  g.numPixsInModule = g.nRows * g.nCols;
129 
130  assert(p.theDet->index() == int(i));
131  assert(commonParamsGPU_.thePitchY == p.thePitchY);
132  assert(commonParamsGPU_.thePitchX == p.thePitchX);
133 
134  g.isBarrel = GeomDetEnumerators::isBarrel(p.thePart);
135  g.isPosZ = p.theDet->surface().position().z() > 0;
136  g.layer = ttopo_.layer(p.theDet->geographicalId());
137  g.index = i; // better be!
138  g.rawId = p.theDet->geographicalId();
139  auto thickness = g.isBarrel ? commonParamsGPU_.theThicknessB : commonParamsGPU_.theThicknessE;
140  assert(thickness == p.theThickness);
141 
142  auto ladder = ttopo_.pxbLadder(p.theDet->geographicalId());
143  if (oldLayer != g.layer) {
144  oldLayer = g.layer;
145  LogDebug("PixelCPEFast") << "new layer at " << i << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- "))
146  << g.layer << " starting at " << g.rawId << '\n'
147  << "old layer had " << nl << " ladders";
148  nl = 0;
149  }
150  if (oldLadder != ladder) {
151  oldLadder = ladder;
152  LogDebug("PixelCPEFast") << "new ladder at " << i << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- "))
153  << ladder << " starting at " << g.rawId << '\n'
154  << "old ladder ave z,r,p mz " << zl / 8.f << " " << rl / 8.f << " " << pl / 8.f << ' '
155  << miz << ' ' << mxz;
156  rl = 0;
157  zl = 0;
158  pl = 0;
159  miz = 500;
160  mxz = 0;
161  nl++;
162  }
163 
164  g.shiftX = 0.5f * p.lorentzShiftInCmX;
165  g.shiftY = 0.5f * p.lorentzShiftInCmY;
166  g.chargeWidthX = p.lorentzShiftInCmX * p.widthLAFractionX;
167  g.chargeWidthY = p.lorentzShiftInCmY * p.widthLAFractionY;
168 
169  g.x0 = p.theOrigin.x();
170  g.y0 = p.theOrigin.y();
171  g.z0 = p.theOrigin.z();
172 
173  auto vv = p.theDet->surface().position();
174  auto rr = pixelCPEforGPU::Rotation(p.theDet->surface().rotation());
175  g.frame = pixelCPEforGPU::Frame(vv.x(), vv.y(), vv.z(), rr);
176 
177  zl += vv.z();
178  miz = std::min(miz, std::abs(vv.z()));
179  mxz = std::max(mxz, std::abs(vv.z()));
180  rl += vv.perp();
181  pl += vv.phi(); // (not obvious)
182 
183  // errors .....
185 
186  cp.with_track_angle = false;
187 
188  auto lape = p.theDet->localAlignmentError();
189  if (lape.invalid())
190  lape = LocalError(); // zero....
191 
192  g.apeXX = lape.xx();
193  g.apeYY = lape.yy();
194 
195  auto toMicron = [&](float x) { return std::min(511, int(x * 1.e4f + 0.5f)); };
196 
197  // average angle
198  auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchX;
199  auto gvy = p.theOrigin.y();
200  auto gvz = 1.f / p.theOrigin.z();
201  //--- Note that the normalization is not required as only the ratio used
202 
203  {
204  // calculate angles (fed into errorFromTemplates)
205  cp.cotalpha = gvx * gvz;
206  cp.cotbeta = gvy * gvz;
207 
208  errorFromTemplates(p, cp, 20000.);
209  }
210 
211 #ifdef EDM_ML_DEBUG
212  auto m = 10000.f;
213  for (float qclus = 15000; qclus < 35000; qclus += 15000) {
214  errorFromTemplates(p, cp, qclus);
215  LogDebug("PixelCPEFast") << i << ' ' << qclus << ' ' << cp.pixmx << ' ' << m * cp.sigmax << ' ' << m * cp.sx1
216  << ' ' << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2;
217  }
218  LogDebug("PixelCPEFast") << i << ' ' << m * std::sqrt(lape.xx()) << ' ' << m * std::sqrt(lape.yy());
219 #endif // EDM_ML_DEBUG
220 
221  g.pixmx = std::max(0, cp.pixmx);
222  g.sx2 = toMicron(cp.sx2);
223  g.sy1 = std::max(21, toMicron(cp.sy1)); // for some angles sy1 is very small
224  g.sy2 = std::max(55, toMicron(cp.sy2)); // sometimes sy2 is smaller than others (due to angle?)
225 
226  //sample xerr as function of position
227  // moduleOffsetX is the definition of TrackerTraits::xOffset,
228  // needs to be calculated because for Phase2 the modules are not uniform
229  float moduleOffsetX = -(0.5f * float(g.nRows) + TrackerTraits::bigPixXCorrection);
230  auto const xoff = moduleOffsetX * commonParamsGPU_.thePitchX;
231 
232  for (int ix = 0; ix < CPEFastParametrisation::kNumErrorBins; ++ix) {
233  auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f);
234  auto gvx = p.theOrigin.x() - x;
235  auto gvy = p.theOrigin.y();
236  auto gvz = 1.f / p.theOrigin.z();
237  cp.cotbeta = gvy * gvz;
238  cp.cotalpha = gvx * gvz;
239  errorFromTemplates(p, cp, 20000.f);
240  g.sigmax[ix] = toMicron(cp.sigmax);
241  g.sigmax1[ix] = toMicron(cp.sx1);
242  LogDebug("PixelCPEFast") << "sigmax vs x " << i << ' ' << x << ' ' << cp.cotalpha << ' ' << int(g.sigmax[ix])
243  << ' ' << int(g.sigmax1[ix]) << ' ' << 10000.f * cp.sigmay << std::endl;
244  }
245 #ifdef EDM_ML_DEBUG
246  // sample yerr as function of position
247  // moduleOffsetY is the definition of TrackerTraits::yOffset (removed)
248  float moduleOffsetY = 0.5f * float(g.nCols) + TrackerTraits::bigPixYCorrection;
249  auto const yoff = -moduleOffsetY * commonParamsGPU_.thePitchY;
250 
251  for (int ix = 0; ix < CPEFastParametrisation::kNumErrorBins; ++ix) {
252  auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f);
253  auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchY;
254  auto gvy = p.theOrigin.y() - y;
255  auto gvz = 1.f / p.theOrigin.z();
256  cp.cotbeta = gvy * gvz;
257  cp.cotalpha = gvx * gvz;
258  errorFromTemplates(p, cp, 20000.f);
259  LogDebug("PixelCPEFast") << "sigmay vs y " << i << ' ' << y << ' ' << cp.cotbeta << ' ' << 10000.f * cp.sigmay
260  << std::endl;
261  }
262 #endif // EDM_ML_DEBUG
263 
264  // calculate angles (repeated)
265  cp.cotalpha = gvx * gvz;
266  cp.cotbeta = gvy * gvz;
267  auto aveCB = cp.cotbeta;
268 
269  // sample x by charge
270  int qbin = CPEFastParametrisation::kGenErrorQBins; // low charge
271  int k = 0;
272  for (int qclus = 1000; qclus < 200000; qclus += 1000) {
273  errorFromTemplates(p, cp, qclus);
274  if (cp.qBin_ == qbin)
275  continue;
276  qbin = cp.qBin_;
277  g.xfact[k] = cp.sigmax;
278  g.yfact[k] = cp.sigmay;
279  g.minCh[k++] = qclus;
280 #ifdef EDM_ML_DEBUG
281  LogDebug("PixelCPEFast") << i << ' ' << g.rawId << ' ' << cp.cotalpha << ' ' << qclus << ' ' << cp.qBin_ << ' '
282  << cp.pixmx << ' ' << m * cp.sigmax << ' ' << m * cp.sx1 << ' ' << m * cp.sx2 << ' '
283  << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2 << std::endl;
284 #endif // EDM_ML_DEBUG
285  }
286 
288 
289  // fill the rest (sometimes bin 4 is missing)
290  for (int kk = k; kk < CPEFastParametrisation::kGenErrorQBins; ++kk) {
291  g.xfact[kk] = g.xfact[k - 1];
292  g.yfact[kk] = g.yfact[k - 1];
293  g.minCh[kk] = g.minCh[k - 1];
294  }
295  auto detx = 1.f / g.xfact[0];
296  auto dety = 1.f / g.yfact[0];
297  for (int kk = 0; kk < CPEFastParametrisation::kGenErrorQBins; ++kk) {
298  g.xfact[kk] *= detx;
299  g.yfact[kk] *= dety;
300  }
301  // sample y in "angle" (estimated from cluster size)
302  float ys = 8.f - 4.f; // apperent bias of half pixel (see plot)
303  // plot: https://indico.cern.ch/event/934821/contributions/3974619/attachments/2091853/3515041/DigilessReco.pdf page 25
304  // sample yerr as function of "size"
305  for (int iy = 0; iy < CPEFastParametrisation::kNumErrorBins; ++iy) {
306  ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3)
308  ys += 8.f; // last bin for "overflow"
309  // cp.cotalpha = ys*(commonParamsGPU_.thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below)
310  cp.cotbeta = std::copysign(ys * (commonParamsGPU_.thePitchY / (8.f * thickness)), aveCB);
311  errorFromTemplates(p, cp, 20000.f);
312  g.sigmay[iy] = toMicron(cp.sigmay);
313  LogDebug("PixelCPEFast") << "sigmax/sigmay " << i << ' ' << (ys + 4.f) / 8.f << ' ' << cp.cotalpha << '/'
314  << cp.cotbeta << ' ' << 10000.f * cp.sigmax << '/' << int(g.sigmay[iy]) << std::endl;
315  }
316  } // loop over det
317 
318  constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
319  constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
320  constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
321 
322  constexpr float ladderFactor = 1.f / float(numberOfModulesInLadder);
323 
324  constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
325  constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
326 
327  // compute ladder baricenter (only in global z) for the barrel
328  //
329  auto& aveGeom = averageGeometry_;
330  int il = 0;
331  for (int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
332  auto const& g = detParamsGPU_[im];
333  il = im / numberOfModulesInLadder;
334  assert(il < int(numberOfLaddersInBarrel));
335  auto z = g.frame.z();
336  aveGeom.ladderZ[il] += ladderFactor * z;
337  aveGeom.ladderMinZ[il] = std::min(aveGeom.ladderMinZ[il], z);
338  aveGeom.ladderMaxZ[il] = std::max(aveGeom.ladderMaxZ[il], z);
339  aveGeom.ladderX[il] += ladderFactor * g.frame.x();
340  aveGeom.ladderY[il] += ladderFactor * g.frame.y();
341  aveGeom.ladderR[il] += ladderFactor * sqrt(g.frame.x() * g.frame.x() + g.frame.y() * g.frame.y());
342  }
343  assert(il + 1 == int(numberOfLaddersInBarrel));
344  // add half_module and tollerance
345  constexpr float moduleLength = TrackerTraits::moduleLength;
346  constexpr float module_tolerance = 0.2f;
347  for (int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
348  aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
349  aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
350  }
351 
352  // compute "max z" for first layer in endcap (should we restrict to the outermost ring?)
353  for (auto im = TrackerTraits::layerStart[firstEndcapPos]; im < TrackerTraits::layerStart[firstEndcapPos + 1]; ++im) {
354  auto const& g = detParamsGPU_[im];
355  aveGeom.endCapZ[0] = std::max(aveGeom.endCapZ[0], g.frame.z());
356  }
357  for (auto im = TrackerTraits::layerStart[firstEndcapNeg]; im < TrackerTraits::layerStart[firstEndcapNeg + 1]; ++im) {
358  auto const& g = detParamsGPU_[im];
359  aveGeom.endCapZ[1] = std::min(aveGeom.endCapZ[1], g.frame.z());
360  }
361  // correct for outer ring being closer
362  aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
363  aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
364 #ifdef EDM_ML_DEBUG
365  for (int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
366  LogDebug("PixelCPEFast") << jl << ':' << aveGeom.ladderR[jl] << '/'
367  << std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
368  aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
369  << ',' << aveGeom.ladderZ[jl] << ',' << aveGeom.ladderMinZ[jl] << ','
370  << aveGeom.ladderMaxZ[jl] << '\n';
371  }
372  LogDebug("PixelCPEFast") << aveGeom.endCapZ[0] << ' ' << aveGeom.endCapZ[1];
373 #endif // EDM_ML_DEBUG
374 
375  // fill Layer and ladders geometry
376  memset(&layerGeometry_, 0, sizeof(pixelCPEforGPU::LayerGeometryT<TrackerTraits>));
377  memcpy(layerGeometry_.layerStart,
380  memcpy(layerGeometry_.layer, pixelTopology::layer<TrackerTraits>.data(), pixelTopology::layer<TrackerTraits>.size());
381  layerGeometry_.maxModuleStride = pixelTopology::maxModuleStride<TrackerTraits>;
382 }
383 
384 template <typename TrackerTraits>
386  if (paramsOnGPU_d != nullptr) {
387  cudaFree((void*)paramsOnGPU_h.m_commonParams);
388  cudaFree((void*)paramsOnGPU_h.m_detParams);
389  cudaFree((void*)paramsOnGPU_h.m_averageGeometry);
390  cudaFree((void*)paramsOnGPU_h.m_layerGeometry);
391  cudaFree(paramsOnGPU_d);
392  }
393 }
394 
395 template <typename TrackerTraits>
397  ClusterParamGeneric& theClusterParam,
398  float qclus) const {
399  float locBz = theDetParam.bz;
400  float locBx = theDetParam.bx;
401  LogDebug("PixelCPEFast") << "PixelCPEFast::localPosition(...) : locBz = " << locBz;
402 
403  theClusterParam.pixmx = std::numeric_limits<int>::max(); // max pixel charge for truncation of 2-D cluster
404 
405  theClusterParam.sigmay = -999.9; // CPE Generic y-error for multi-pixel cluster
406  theClusterParam.sigmax = -999.9; // CPE Generic x-error for multi-pixel cluster
407  theClusterParam.sy1 = -999.9; // CPE Generic y-error for single single-pixel
408  theClusterParam.sy2 = -999.9; // CPE Generic y-error for single double-pixel cluster
409  theClusterParam.sx1 = -999.9; // CPE Generic x-error for single single-pixel cluster
410  theClusterParam.sx2 = -999.9; // CPE Generic x-error for single double-pixel cluster
411 
412  float dummy;
413 
415  int gtemplID = theDetParam.detTemplateId;
416 
417  theClusterParam.qBin_ = gtempl.qbin(gtemplID,
418  theClusterParam.cotalpha,
419  theClusterParam.cotbeta,
420  locBz,
421  locBx,
422  qclus,
423  false,
424  theClusterParam.pixmx,
425  theClusterParam.sigmay,
426  dummy,
427  theClusterParam.sigmax,
428  dummy,
429  theClusterParam.sy1,
430  dummy,
431  theClusterParam.sy2,
432  dummy,
433  theClusterParam.sx1,
434  dummy,
435  theClusterParam.sx2,
436  dummy);
437 
438  theClusterParam.sigmax = theClusterParam.sigmax * micronsToCm;
439  theClusterParam.sx1 = theClusterParam.sx1 * micronsToCm;
440  theClusterParam.sx2 = theClusterParam.sx2 * micronsToCm;
441 
442  theClusterParam.sigmay = theClusterParam.sigmay * micronsToCm;
443  theClusterParam.sy1 = theClusterParam.sy1 * micronsToCm;
444  theClusterParam.sy2 = theClusterParam.sy2 * micronsToCm;
445 }
446 
447 //-----------------------------------------------------------------------------
451 //-----------------------------------------------------------------------------
452 template <typename TrackerTraits>
454  ClusterParam& theClusterParamBase) const {
455  ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
456 
458  errorFromTemplates(theDetParam, theClusterParam, theClusterParam.theCluster->charge());
459  } else {
460  theClusterParam.qBin_ = 0;
461  }
462 
463  int q_f_X;
464  int q_l_X;
465  int q_f_Y;
466  int q_l_Y;
467  collect_edge_charges(theClusterParam, q_f_X, q_l_X, q_f_Y, q_l_Y, useErrorsFromTemplates_ && truncatePixelCharge_);
468 
469  // do GPU like ...
471 
472  cp.minRow[0] = theClusterParam.theCluster->minPixelRow();
473  cp.maxRow[0] = theClusterParam.theCluster->maxPixelRow();
474  cp.minCol[0] = theClusterParam.theCluster->minPixelCol();
475  cp.maxCol[0] = theClusterParam.theCluster->maxPixelCol();
476 
477  cp.q_f_X[0] = q_f_X;
478  cp.q_l_X[0] = q_l_X;
479  cp.q_f_Y[0] = q_f_Y;
480  cp.q_l_Y[0] = q_l_Y;
481 
482  cp.charge[0] = theClusterParam.theCluster->charge();
483 
484  auto ind = theDetParam.theDet->index();
485  pixelCPEforGPU::position<TrackerTraits>(commonParamsGPU_, detParamsGPU_[ind], cp, 0);
486  auto xPos = cp.xpos[0];
487  auto yPos = cp.ypos[0];
488 
489  // set the error (mind ape....)
490  pixelCPEforGPU::errorFromDB<TrackerTraits>(commonParamsGPU_, detParamsGPU_[ind], cp, 0);
491  theClusterParam.sigmax = cp.xerr[0];
492  theClusterParam.sigmay = cp.yerr[0];
493 
494  LogDebug("PixelCPEFast") << " in PixelCPEFast:localPosition - pos = " << xPos << " " << yPos << " size "
495  << cp.maxRow[0] - cp.minRow[0] << ' ' << cp.maxCol[0] - cp.minCol[0];
496 
497  //--- Now put the two together
498  LocalPoint pos_in_local(xPos, yPos);
499  return pos_in_local;
500 }
501 
502 //============== INFLATED ERROR AND ERRORS FROM DB BELOW ================
503 
504 //-------------------------------------------------------------------------
505 // Hit error in the local frame
506 //-------------------------------------------------------------------------
507 template <typename TrackerTraits>
509  ClusterParam& theClusterParamBase) const {
510  ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
511 
512  auto xerr = theClusterParam.sigmax;
513  auto yerr = theClusterParam.sigmay;
514 
515  LogDebug("PixelCPEFast") << " errors " << xerr << " " << yerr;
516 
517  auto xerr_sq = xerr * xerr;
518  auto yerr_sq = yerr * yerr;
519 
520  return LocalError(xerr_sq, 0, yerr_sq);
521 }
522 
523 template <typename TrackerTraits>
525  // call PixelCPEGenericBase fillPSetDescription to add common rechit errors
527 }
528 
static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
ParamsOnGPU * paramsOnGPU_d
Definition: PixelCPEFast.h:60
SOAFrame< float > Frame
int index() const
Definition: GeomDet.h:83
const SiPixelCluster * theCluster
Definition: PixelCPEBase.h:74
AverageGeometry const * m_averageGeometry
int maxPixelRow() const
bool isBarrel(GeomDetEnumerators::SubDetector m)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
static void collect_edge_charges(ClusterParam &theClusterParam, int &q_f_X, int &q_l_X, int &q_f_Y, int &q_l_Y, bool truncate)
DetParams const * m_detParams
constexpr int kGenErrorQBins
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
assert(be >=bs)
const PixelGeomDetUnit * theDet
Definition: PixelCPEBase.h:46
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
int minPixelRow() const
int charge() const
constexpr float micronsToCm
std::vector< SiPixelGenErrorStore > thePixelGenError_
Definition: PixelCPEFast.h:47
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
PixelCPEFast(edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const SiPixelGenErrorDBObject *, const SiPixelLorentzAngle *)
The constructor.
Definition: PixelCPEFast.cc:23
CommonParams const * m_commonParams
std::vector< pixelCPEforGPU::DetParams > detParamsGPU_
Definition: PixelCPEFast.h:50
LayerGeometry const * m_layerGeometry
int minPixelCol() const
ParamsOnGPU cpuData_
Definition: PixelCPEFast.h:54
T sqrt(T t)
Definition: SSEVec.h:23
int maxPixelCol() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr T z() const
Definition: SOARotation.h:133
LayerGeometry layerGeometry_
Definition: PixelCPEFast.h:52
double f[11][100]
void fillParamsForGpu()
Definition: PixelCPEFast.cc:91
static void fillPSetDescription(edm::ParameterSetDescription &desc)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
SOARotation< float > Rotation
ParamsOnGPU paramsOnGPU_h
Definition: PixelCPEFast.h:59
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:234
AverageGeometry averageGeometry_
Definition: PixelCPEFast.h:53
const ParamsOnGPU * getGPUProductAsync(cudaStream_t cudaStream) const
Definition: PixelCPEFast.cc:50
pixelCPEforGPU::CommonParams commonParamsGPU_
Definition: PixelCPEFast.h:51
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static constexpr uint32_t layerStart[numberOfLayers+1]
float x
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
constexpr int kNumErrorBins
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
#define LogDebug(id)