From 2ac98ffbc0e4d7877906df1692a0428384fda024 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Mon, 20 Jul 2020 19:39:34 +0200 Subject: [PATCH 1/4] make CPEFast to better reproduce Generic --- .../TrackingRecHit/interface/SiPixelStatus.h | 12 + .../SiPixelRecHits/interface/pixelCPEforGPU.h | 65 +++- .../SiPixelRecHits/src/PixelCPEFast.cc | 306 ++++++++---------- .../CAHitNtupletGeneratorKernelsImpl.h | 15 +- .../plugins/CAHitNtupletGeneratorOnGPU.cc | 6 +- 5 files changed, 208 insertions(+), 196 deletions(-) create mode 100644 CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h diff --git a/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h b/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h new file mode 100644 index 0000000000000..5f1da641938b6 --- /dev/null +++ b/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h @@ -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 diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h index c9d2df58dfeb0..00f57db60db3f 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h @@ -1,3 +1,4 @@ + #ifndef RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h #define RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h @@ -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; using Rotation = SOARotation; @@ -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 + float xfact[5], yfact[5]; + int minCh[5]; Frame frame; }; @@ -95,8 +103,11 @@ 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(); @@ -206,8 +217,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; @@ -285,8 +296,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]); @@ -323,19 +334,43 @@ 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 diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 5a2b8f41bb988..88a1431e1d2e0 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -112,7 +112,8 @@ void PixelCPEFast::fillParamsForGpu() { m_commonParamsGPU.thePitchX = m_DetParams[0].thePitchX; m_commonParamsGPU.thePitchY = m_DetParams[0].thePitchY; - // std::cout << "pitch & thickness " << m_commonParamsGPU.thePitchX << ' ' << m_commonParamsGPU.thePitchY << " " << m_commonParamsGPU.theThicknessB << ' ' << m_commonParamsGPU.theThicknessE << std::endl; + // std::cout << "pitch & thickness " << m_commonParamsGPU.thePitchX << ' ' << m_commonParamsGPU.thePitchY << " " + // << m_commonParamsGPU.theThicknessB << ' ' << m_commonParamsGPU.theThicknessE << std::endl; // zero average geometry memset(&m_averageGeometry, 0, sizeof(pixelCPEforGPU::AverageGeometry)); @@ -184,77 +185,143 @@ void PixelCPEFast::fillParamsForGpu() { pl += vv.phi(); // (not obvious) // errors ..... - ClusterParamGeneric cp; - auto gvx = p.theOrigin.x() + 40.f * m_commonParamsGPU.thePitchX; - auto gvy = p.theOrigin.y(); - auto gvz = 1.f / p.theOrigin.z(); - //--- Note that the normalization is not required as only the ratio used - // calculate angles - cp.cotalpha = gvx * gvz; - cp.cotbeta = gvy * gvz; + ClusterParamGeneric cp; cp.with_track_angle = false; auto lape = p.theDet->localAlignmentError(); if (lape.invalid()) lape = LocalError(); // zero.... - + auto apeX = lape.xx(); + auto apeY = lape.yy(); + + auto toMicronX = [&](float x) { + x = std::sqrt(x * x + apeX); + return std::min(511, int(x * 1.e4f + 0.5f)); + }; + auto toMicronY = [&](float x) { + x = std::sqrt(x * x + apeY); + return std::min(511, int(x * 1.e4f + 0.5f)); + }; + + { + // average angle + auto gvx = p.theOrigin.x() + 40.f * m_commonParamsGPU.thePitchX; + auto gvy = p.theOrigin.y(); + auto gvz = 1.f / p.theOrigin.z(); + cp.cotalpha = gvx * gvz; + cp.cotbeta = gvy * gvz; + errorFromTemplates(p, cp, 20000.); + } #ifdef DUMP_ERRORS auto m = 10000.f; - for (float qclus = 15000; qclus < 35000; qclus += 15000) { - errorFromTemplates(p, cp, qclus); + std::cout << i << ' ' << (g.isBarrel ? 'B' : 'E') << " ape " << m * std::sqrt(lape.xx()) << ' ' + << m * std::sqrt(lape.yy()) << std::endl; + std::cout << i << ' ' << g.rawId << ' ' << cp.cotalpha << ' ' << 20000 << ' ' << cp.qBin_ << ' ' << cp.pixmx << ' ' + << m * cp.sigmax << ' ' << m * cp.sx1 << ' ' << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' << m * cp.sy1 + << ' ' << m * cp.sy2 << std::endl; +#endif + + g.pixmx = std::max(0, cp.pixmx); + g.sx2 = toMicronX(cp.sx2); + g.sy1 = toMicronY(cp.sy1); + g.sy2 = std::max(55,toMicronY(cp.sy2)); + + // sample xerr as function of position + auto xoff = -81.f * m_commonParamsGPU.thePitchX; + + for (int ix = 0; ix < 16; ++ix) { + auto x = xoff + (0.5f + float(ix)) * 162.f * m_commonParamsGPU.thePitchX / 16.f; + auto gvx = p.theOrigin.x() - x; + auto gvy = p.theOrigin.y(); + auto gvz = 1.f / p.theOrigin.z(); + cp.cotbeta = gvy * gvz; + cp.cotalpha = gvx * gvz; + errorFromTemplates(p, cp, 20000.f); + g.sigmax[ix] = toMicronX(cp.sigmax); + g.sigmax1[ix] = toMicronX(cp.sx1); +#ifdef DUMP_ERRORS + std::cout << "sigmax vs x " << i << ' ' << x << ' ' << cp.cotalpha << ' ' << int(g.sigmax[ix]) << ' ' + << int(g.sigmax1[ix]) << ' ' << 10000.f * cp.sigmay << std::endl; +#endif + } - std::cout << i << ' ' << qclus << ' ' << cp.pixmx << ' ' << m * cp.sigmax << ' ' << m * cp.sx1 << ' ' - << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2 << std::endl; +#ifdef DUMP_ERRORS + // sample yerr as function of position + auto yoff = -54 * 4.f * m_commonParamsGPU.thePitchY; + for (int ix = 0; ix < 16; ++ix) { + auto y = yoff + (0.5f + float(ix)) * 432.f * m_commonParamsGPU.thePitchY / 16.f; + auto gvx = p.theOrigin.x() + 40.f * m_commonParamsGPU.thePitchY; + auto gvy = p.theOrigin.y() - y; + auto gvz = 1.f / p.theOrigin.z(); + cp.cotbeta = gvy * gvz; + cp.cotalpha = gvx * gvz; + errorFromTemplates(p, cp, 20000.f); + std::cout << "sigmay vs y " << i << ' ' << y << ' ' << cp.cotbeta << ' ' << 10000.f * cp.sigmay << std::endl; } - std::cout << i << ' ' << m * std::sqrt(lape.xx()) << ' ' << m * std::sqrt(lape.yy()) << std::endl; #endif - errorFromTemplates(p, cp, 20000.f); - g.pixmx = std::max(0, cp.pixmx); - g.sx[0] = cp.sigmax; - g.sx[1] = cp.sx1; - g.sx[2] = cp.sx2; - - g.sy[0] = cp.sigmay; - g.sy[1] = cp.sy1; - g.sy[2] = cp.sy2; - - /* - // from run1?? - if (i<96) { - g.sx[0] = 0.00120; - g.sx[1] = 0.00115; - g.sx[2] = 0.0050; - - g.sy[0] = 0.00210; - g.sy[1] = 0.00375; - g.sy[2] = 0.0085; - } else if (g.isBarrel) { - g.sx[0] = 0.00120; - g.sx[1] = 0.00115; - g.sx[2] = 0.0050; - - g.sy[0] = 0.00210; - g.sy[1] = 0.00375; - g.sy[2] = 0.0085; - } else { - g.sx[0] = 0.0020; - g.sx[1] = 0.0020; - g.sx[2] = 0.0050; - - g.sy[0] = 0.0021; - g.sy[1] = 0.0021; - g.sy[2] = 0.0085; - } - */ - - for (int i = 0; i < 3; ++i) { - g.sx[i] = std::sqrt(g.sx[i] * g.sx[i] + lape.xx()); - g.sy[i] = std::sqrt(g.sy[i] * g.sy[i] + lape.yy()); + // average angle + auto gvx = p.theOrigin.x() + 40.f * m_commonParamsGPU.thePitchX; + auto gvy = p.theOrigin.y(); + auto gvz = 1.f / p.theOrigin.z(); + //--- Note that the normalization is not required as only the ratio used + + // calculate angles + cp.cotalpha = gvx * gvz; + cp.cotbeta = gvy * gvz; + auto aveCB = cp.cotbeta; + + // sample x by charge + int qbin = 5; // low charge + int k = 0; + for (int qclus = 1000; qclus < 200000; qclus += 1000) { + errorFromTemplates(p, cp, qclus); + if (cp.qBin_ == qbin) + continue; + qbin = cp.qBin_; + g.xfact[k] = cp.sigmax; + g.yfact[k] = cp.sigmay; + g.minCh[k++] = qclus; +#ifdef DUMP_ERRORS + std::cout << i << ' ' << g.rawId << ' ' << cp.cotalpha << ' ' << qclus << ' ' << cp.qBin_ << ' ' << cp.pixmx + << ' ' << m * cp.sigmax << ' ' << m * cp.sx1 << ' ' << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' + << m * cp.sy1 << ' ' << m * cp.sy2 << std::endl; +#endif + } + assert(k <= 5); + // fill the rest (sometimes bin 4 is missing) + for (int kk = k; kk < 5; ++kk) { + g.xfact[kk] = g.xfact[k - 1]; + g.yfact[kk] = g.yfact[k - 1]; + g.minCh[kk] = g.minCh[k - 1]; + } + auto detx = 1.f / g.xfact[0]; + auto dety = 1.f / g.yfact[0]; + for (int kk = 0; kk < 5; ++kk) { + g.xfact[kk] *= detx; + g.yfact[kk] *= dety; } - } + + // sample y in angle + float ys = 8.f - 4.f; // apperent bias of half pixel (see plot) + // sample yerr as function of "size" + for (int iy = 0; iy < 16; ++iy) { + ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3) + if (15 == iy) + ys += 8.f; // last bin for "overflow" + // cp.cotalpha = ys*100.f/(8.f*285.f); + cp.cotbeta = std::copysign(ys * 150.f / (8.f * 285.f), aveCB); + errorFromTemplates(p, cp, 20000.f); + g.sigmay[iy] = toMicronY(cp.sigmay); +#ifdef DUMP_ERRORS + std::cout << "sigmax/sigmay " << i << ' ' << (ys + 4.f) / 8.f << ' ' << cp.cotalpha << '/' << cp.cotbeta << ' ' + << 10000.f * cp.sigmax << '/' << int(g.sigmay[iy]) << std::endl; +#endif + } + + } // loop over det // compute ladder baricenter (only in global z) for the barrel auto& aveGeom = m_averageGeometry; @@ -405,13 +472,20 @@ LocalPoint PixelCPEFast::localPosition(DetParam const& theDetParam, ClusterParam cp.Q_f_Y[0] = Q_f_Y; cp.Q_l_Y[0] = Q_l_Y; + cp.charge[0] = theClusterParam.theCluster->charge(); + auto ind = theDetParam.theDet->index(); pixelCPEforGPU::position(m_commonParamsGPU, m_detParamsGPU[ind], cp, 0); auto xPos = cp.xpos[0]; auto yPos = cp.ypos[0]; - // std::cout<<" in PixelCPEFast:localPosition - pos = "<(theClusterParamBase); - // Default errors are the maximum error used for edge clusters. - // These are determined by looking at residuals for edge clusters - float xerr = EdgeClusterErrorX_ * micronsToCm; - float yerr = EdgeClusterErrorY_ * micronsToCm; - - // Find if cluster is at the module edge. - int maxPixelCol = theClusterParam.theCluster->maxPixelCol(); - int maxPixelRow = theClusterParam.theCluster->maxPixelRow(); - int minPixelCol = theClusterParam.theCluster->minPixelCol(); - int minPixelRow = theClusterParam.theCluster->minPixelRow(); - - bool edgex = phase1PixelTopology::isEdgeX(minPixelRow) | phase1PixelTopology::isEdgeX(maxPixelRow); - bool edgey = phase1PixelTopology::isEdgeY(minPixelCol) | phase1PixelTopology::isEdgeY(maxPixelCol); - - unsigned int sizex = theClusterParam.theCluster->sizeX(); - unsigned int sizey = theClusterParam.theCluster->sizeY(); - - // Find if cluster contains double (big) pixels. - bool bigInX = theDetParam.theRecTopol->containsBigPixelInX(minPixelRow, maxPixelRow); - bool bigInY = theDetParam.theRecTopol->containsBigPixelInY(minPixelCol, maxPixelCol); - - if (UseErrorsFromTemplates_) { - // - // Use template errors - - if (!edgex) { // Only use this for non-edge clusters - if (sizex == 1) { - if (!bigInX) { - xerr = theClusterParam.sx1; - } else { - xerr = theClusterParam.sx2; - } - } else { - xerr = theClusterParam.sigmax; - } - } - - if (!edgey) { // Only use for non-edge clusters - if (sizey == 1) { - if (!bigInY) { - yerr = theClusterParam.sy1; - } else { - yerr = theClusterParam.sy2; - } - } else { - yerr = theClusterParam.sigmay; - } - } - - } else { // simple errors - - // This are the simple errors, hardcoded in the code - //cout << "Track angles are not known " << endl; - //cout << "Default angle estimation which assumes track from PV (0,0,0) does not work." << endl; - - if (GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) { - if (GeomDetEnumerators::isBarrel(theDetParam.thePart)) { - DetId id = (theDetParam.theDet->geographicalId()); - int layer = ttopo_.layer(id); - if (layer == 1) { - if (!edgex) { - if (sizex <= xerr_barrel_l1_.size()) - xerr = xerr_barrel_l1_[sizex - 1]; - else - xerr = xerr_barrel_l1_def_; - } - - if (!edgey) { - if (sizey <= yerr_barrel_l1_.size()) - yerr = yerr_barrel_l1_[sizey - 1]; - else - yerr = yerr_barrel_l1_def_; - } - } else { // layer 2,3 - if (!edgex) { - if (sizex <= xerr_barrel_ln_.size()) - xerr = xerr_barrel_ln_[sizex - 1]; - else - xerr = xerr_barrel_ln_def_; - } - - if (!edgey) { - if (sizey <= yerr_barrel_ln_.size()) - yerr = yerr_barrel_ln_[sizey - 1]; - else - yerr = yerr_barrel_ln_def_; - } - } - - } else { // EndCap - - if (!edgex) { - if (sizex <= xerr_endcap_.size()) - xerr = xerr_endcap_[sizex - 1]; - else - xerr = xerr_endcap_def_; - } - - if (!edgey) { - if (sizey <= yerr_endcap_.size()) - yerr = yerr_endcap_[sizey - 1]; - else - yerr = yerr_endcap_def_; - } - } // end endcap - } - - } // end + auto xerr = theClusterParam.sigmax; + auto yerr = theClusterParam.sigmay; - // std::cout<<" errors "<(tracks->pt(it), cuts.chi2MaxPt); - float chi2Cut = cuts.chi2Scale * - (cuts.chi2Coeff[0] + pt * (cuts.chi2Coeff[1] + pt * (cuts.chi2Coeff[2] + pt * cuts.chi2Coeff[3]))); - // above number were for Quads not normalized so for the time being just multiple by ndof for Quads (triplets to be understood) - if (3.f * tracks->chi2(it) >= chi2Cut) { + // float pt = std::min(tracks->pt(it), cuts.chi2MaxPt); + // float chi2Cut = cuts.chi2Scale * + // (cuts.chi2Coeff[0] + pt * (cuts.chi2Coeff[1] + pt * (cuts.chi2Coeff[2] + pt * cuts.chi2Coeff[3]))); + float chi2Cut = cuts.chi2Scale; + if (tracks->chi2(it) >= chi2Cut) { #ifdef NTUPLE_DEBUG printf("Bad fit %d size %d pt %f eta %f chi2 %f\n", it, diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc index 3e16728a002dd..ebb1f9056377d 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc @@ -141,11 +141,11 @@ void CAHitNtupletGeneratorOnGPU::fillDescriptions(edm::ParameterSetDescription& edm::ParameterSetDescription trackQualityCuts; trackQualityCuts.add("chi2MaxPt", 10.)->setComment("max pT used to determine the pT-dependent chi2 cut"); - trackQualityCuts.add>("chi2Coeff", {0.68177776, 0.74609577, -0.08035491, 0.00315399}) + trackQualityCuts.add>("chi2Coeff", {1., 0., 0., 0.}) ->setComment("Polynomial coefficients to derive the pT-dependent chi2 cut"); - trackQualityCuts.add("chi2Scale", 30.) + trackQualityCuts.add("chi2Scale", 16.) ->setComment( - "Factor to multiply the pT-dependent chi2 cut (currently: 30 for the broken line fit, 45 for the Riemann " + "Factor to multiply the pT-dependent chi2 cut (currently: 16 for the broken line fit, ?? for the Riemann " "fit)"); trackQualityCuts.add("tripletMinPt", 0.5)->setComment("Min pT for triplets, in GeV"); trackQualityCuts.add("tripletMaxTip", 0.3)->setComment("Max |Tip| for triplets, in cm"); From d9c676b3a4b1696216bd09200aa6fdc8bde485ec Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Mon, 20 Jul 2020 19:42:48 +0200 Subject: [PATCH 2/4] keep total charge as original one --- RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h b/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h index fd1cd8c0cdd91..f932abfeabdfb 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h +++ b/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h @@ -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) From 1d574c7dd40730492655449663cb7389ef374f2f Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Mon, 20 Jul 2020 19:44:42 +0200 Subject: [PATCH 3/4] code format --- .../TrackingRecHit/interface/SiPixelStatus.h | 14 +++++++------- .../SiPixelRecHits/interface/pixelCPEforGPU.h | 8 +++----- .../SiPixelRecHits/src/PixelCPEFast.cc | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h b/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h index 5f1da641938b6..75e4468a811b6 100644 --- a/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h +++ b/CUDADataFormats/TrackingRecHit/interface/SiPixelStatus.h @@ -1,12 +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; - }; +struct SiPixelStatus { + uint8_t isBigX : 1; + uint8_t isOneX : 1; + uint8_t isBigY : 1; + uint8_t isOneY : 1; + uint8_t qBin : 3; +}; #endif diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h index 00f57db60db3f..2202fdfa44679 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h @@ -107,7 +107,6 @@ namespace pixelCPEforGPU { int16_t ysize[N]; Status status; - }; constexpr int32_t MaxHitsInIter = gpuClustering::maxHitsInIter(); @@ -351,12 +350,11 @@ namespace pixelCPEforGPU { break; assert(bin < 5); - cp.status.qBin = 4-bin; + cp.status.qBin = 4 - bin; cp.status.isOneX = isOneX; - cp.status.isBigX = (isOneX&isBigX) | isEdgeX; + cp.status.isBigX = (isOneX & isBigX) | isEdgeX; cp.status.isOneY = isOneY; - cp.status.isBigY = (isOneY&isBigY) | isEdgeY; - + 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)))); diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 88a1431e1d2e0..ccc516fc69048 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -226,7 +226,7 @@ void PixelCPEFast::fillParamsForGpu() { g.pixmx = std::max(0, cp.pixmx); g.sx2 = toMicronX(cp.sx2); g.sy1 = toMicronY(cp.sy1); - g.sy2 = std::max(55,toMicronY(cp.sy2)); + g.sy2 = std::max(55, toMicronY(cp.sy2)); // sample xerr as function of position auto xoff = -81.f * m_commonParamsGPU.thePitchX; From 55f87f81731bde6e509f60c3f8d34a6855bf6d45 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Tue, 21 Jul 2020 08:09:53 +0200 Subject: [PATCH 4/4] move default to 25 --- .../PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc index ebb1f9056377d..3791a743bb2c7 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc @@ -143,7 +143,7 @@ void CAHitNtupletGeneratorOnGPU::fillDescriptions(edm::ParameterSetDescription& trackQualityCuts.add("chi2MaxPt", 10.)->setComment("max pT used to determine the pT-dependent chi2 cut"); trackQualityCuts.add>("chi2Coeff", {1., 0., 0., 0.}) ->setComment("Polynomial coefficients to derive the pT-dependent chi2 cut"); - trackQualityCuts.add("chi2Scale", 16.) + trackQualityCuts.add("chi2Scale", 25.) ->setComment( "Factor to multiply the pT-dependent chi2 cut (currently: 16 for the broken line fit, ?? for the Riemann " "fit)");