Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef CUDADataFormats_TrackingRecHit_interface_SiPixelStatus_H
#define CUDADataFormats_TrackingRecHit_interface_SiPixelStatus_H

struct SiPixelStatus {
uint8_t isBigX : 1;
uint8_t isOneX : 1;
uint8_t isBigY : 1;
uint8_t isOneY : 1;
uint8_t qBin : 3;
};

#endif
63 changes: 48 additions & 15 deletions RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#ifndef RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h
#define RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h

Expand All @@ -12,8 +13,11 @@
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCompat.h"
#include "HeterogeneousCore/CUDAUtilities/interface/cuda_cxx17.h"

#include "CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h"

namespace pixelCPEforGPU {

using Status = SiPixelStatus;
using Frame = SOAFrame<float>;
using Rotation = SOARotation<float>;

Expand All @@ -40,7 +44,11 @@ namespace pixelCPEforGPU {

float x0, y0, z0; // the vertex in the local coord of the detector

float sx[3], sy[3]; // the errors...
// float apeX, apexY; // ape^2
uint8_t sx2, sy1, sy2;
uint8_t sigmax[16], sigmax1[16], sigmay[16]; // in micron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is 16 here ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the number of "bins"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it obvious to people familiar with the CPE why 16 ?
I clearly have no idea :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely not. It is just my decision to use 16 bins. I use GenError as a black box.

float xfact[5], yfact[5];
int minCh[5];

Frame frame;
};
Expand Down Expand Up @@ -95,8 +103,10 @@ namespace pixelCPEforGPU {
float xerr[N];
float yerr[N];

int16_t xsize[N]; // clipped at 127 if negative is edge....
int16_t xsize[N]; // (*8) clipped at 127 if negative is edge....
int16_t ysize[N];

Status status;
};

constexpr int32_t MaxHitsInIter = gpuClustering::maxHitsInIter();
Expand Down Expand Up @@ -206,8 +216,8 @@ namespace pixelCPEforGPU {
if (phase1PixelTopology::isBigPixY(cp.maxCol[ic]))
++ysize;

int unbalanceX = 8. * std::abs(float(cp.Q_f_X[ic] - cp.Q_l_X[ic])) / float(cp.Q_f_X[ic] + cp.Q_l_X[ic]);
int unbalanceY = 8. * std::abs(float(cp.Q_f_Y[ic] - cp.Q_l_Y[ic])) / float(cp.Q_f_Y[ic] + cp.Q_l_Y[ic]);
int unbalanceX = 8.f * std::abs(float(cp.Q_f_X[ic] - cp.Q_l_X[ic])) / float(cp.Q_f_X[ic] + cp.Q_l_X[ic]);
int unbalanceY = 8.f * std::abs(float(cp.Q_f_Y[ic] - cp.Q_l_Y[ic])) / float(cp.Q_f_Y[ic] + cp.Q_l_Y[ic]);
xsize = 8 * xsize - unbalanceX;
ysize = 8 * ysize - unbalanceY;

Expand Down Expand Up @@ -285,8 +295,8 @@ namespace pixelCPEforGPU {
auto sy = cp.maxCol[ic] - cp.minCol[ic];

// is edgy ?
bool isEdgeX = cp.minRow[ic] == 0 or cp.maxRow[ic] == phase1PixelTopology::lastRowInModule;
bool isEdgeY = cp.minCol[ic] == 0 or cp.maxCol[ic] == phase1PixelTopology::lastColInModule;
bool isEdgeX = cp.xsize[ic] < 1;
bool isEdgeY = cp.ysize[ic] < 1;
// is one and big?
bool isBig1X = (0 == sx) && phase1PixelTopology::isBigPixX(cp.minRow[ic]);
bool isBig1Y = (0 == sy) && phase1PixelTopology::isBigPixY(cp.minCol[ic]);
Expand Down Expand Up @@ -323,19 +333,42 @@ namespace pixelCPEforGPU {
auto sx = cp.maxRow[ic] - cp.minRow[ic];
auto sy = cp.maxCol[ic] - cp.minCol[ic];

// is edgy ?
bool isEdgeX = cp.minRow[ic] == 0 or cp.maxRow[ic] == phase1PixelTopology::lastRowInModule;
bool isEdgeY = cp.minCol[ic] == 0 or cp.maxCol[ic] == phase1PixelTopology::lastColInModule;
// is edgy ? (size is set negative: see above)
bool isEdgeX = cp.xsize[ic] < 1;
bool isEdgeY = cp.ysize[ic] < 1;

// is one and big?
uint32_t ix = (0 == sx);
uint32_t iy = (0 == sy);
ix += (0 == sx) && phase1PixelTopology::isBigPixX(cp.minRow[ic]);
iy += (0 == sy) && phase1PixelTopology::isBigPixY(cp.minCol[ic]);
bool isOneX = (0 == sx);
bool isOneY = (0 == sy);
bool isBigX = phase1PixelTopology::isBigPixX(cp.minRow[ic]);
bool isBigY = phase1PixelTopology::isBigPixY(cp.minCol[ic]);

auto ch = cp.charge[ic];
auto bin = 0;
for (; bin < 4; ++bin)
if (ch < detParams.minCh[bin + 1])
break;
assert(bin < 5);

cp.status.qBin = 4 - bin;
cp.status.isOneX = isOneX;
cp.status.isBigX = (isOneX & isBigX) | isEdgeX;
cp.status.isOneY = isOneY;
cp.status.isBigY = (isOneY & isBigY) | isEdgeY;

auto xoff = 81.f * comParams.thePitchX;
int jx = std::min(15, std::max(0, int(16.f * (cp.xpos[ic] + xoff) / (162.f * comParams.thePitchX))));

auto toCM = [](uint8_t x) { return float(x) * 1.e-4; };

if (not isEdgeX)
cp.xerr[ic] = detParams.sx[ix];
cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
: detParams.xfact[bin] * toCM(detParams.sigmax[jx]);

auto ey = cp.ysize[ic] > 8 ? detParams.sigmay[std::min(cp.ysize[ic] - 9, 15)] : detParams.sy1;

if (not isEdgeY)
cp.yerr[ic] = detParams.sy[iy];
cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[bin] * toCM(ey);
}

} // namespace pixelCPEforGPU
Expand Down
3 changes: 2 additions & 1 deletion RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ namespace gpuPixelRecHits {
assert(cl < MaxHitsInIter);
auto x = digis.xx(i);
auto y = digis.yy(i);
auto ch = std::min(digis.adc(i), pixmx);
auto ch = digis.adc(i);
atomicAdd(&clusParams.charge[cl], ch);
ch = std::min(ch, pixmx);
if (clusParams.minRow[cl] == x)
atomicAdd(&clusParams.Q_f_X[cl], ch);
if (clusParams.maxRow[cl] == x)
Expand Down
Loading