diff --git a/DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h b/DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h index 6726c1d29d5c9..810b58042557f 100644 --- a/DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h +++ b/DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h @@ -23,7 +23,7 @@ namespace pixelClustering { constexpr uint16_t clusterThresholdPhase2OtherLayers = 4000; constexpr uint32_t maxNumDigis = 3 * 256 * 1024; // @PU=200 µ=530k σ=50k this is >4σ away - constexpr uint16_t maxNumModules = 4000; + constexpr uint16_t maxNumModules = 5000; // This is an upperlimit taking into account D110 has 4000 modules constexpr int32_t maxNumClustersPerModules = maxHitsInModule(); constexpr uint16_t invalidModuleId = std::numeric_limits::max() - 1; diff --git a/Geometry/CommonTopologies/interface/SimplePixelTopology.h b/Geometry/CommonTopologies/interface/SimplePixelTopology.h index 59f3f4e0fa66f..98ea51c18ed01 100644 --- a/Geometry/CommonTopologies/interface/SimplePixelTopology.h +++ b/Geometry/CommonTopologies/interface/SimplePixelTopology.h @@ -208,7 +208,7 @@ namespace phase2PixelTopology { constexpr uint32_t numberOfLayers = 28; constexpr int nPairs = 23 + 6 + 14 + 8 + 4; // include far forward layer pairs - constexpr uint16_t numberOfModules = 3892; + constexpr uint16_t numberOfModules = 4000; constexpr uint32_t maxNumClustersPerModules = 1024; @@ -378,7 +378,7 @@ namespace pixelTopology { static constexpr int maxDYsize = 10; static constexpr int maxDYPred = 20; - static constexpr uint16_t numberOfModules = 3892; + static constexpr uint16_t numberOfModules = phase2PixelTopology::numberOfModules; // 1000 bins < 1024 bins (10 bits) must be: // - < 32*32 (warpSize*warpSize for block prefix scan for CUDA) @@ -475,7 +475,7 @@ namespace pixelTopology { static constexpr int maxDYsize = 20; static constexpr int maxDYPred = 20; - static constexpr uint16_t numberOfModules = 1856; + static constexpr uint16_t numberOfModules = phase1PixelTopology::numberOfModules; static constexpr uint16_t numRowsInRoc = 80; static constexpr uint16_t numColsInRoc = 52; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h index 5ea84e396aa31..e6156009e019f 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h @@ -61,8 +61,6 @@ namespace pixelCPEforDevice { struct CommonParams { float theThicknessB; float theThicknessE; - float thePitchX; - float thePitchY; uint16_t maxModuleStride; uint8_t numberOfLaddersInBarrel; @@ -77,6 +75,8 @@ namespace pixelCPEforDevice { float shiftX; float shiftY; + float thePitchX; + float thePitchY; float chargeWidthX; float chargeWidthY; uint16_t pixmx; // max pix charge @@ -239,10 +239,10 @@ namespace pixelCPEforDevice { // Use an explicit FMA instruction instead of simply (position * pitch + shift) to make sure that // different compiler optimizations do not produce different code on different architectures. float xPos = std::fmaf(0.5f * ((float)mx - (float)detParams.nRows) - TrackerTraits::bigPixXCorrection, - comParams.thePitchX, + detParams.thePitchX, detParams.shiftX); float yPos = std::fmaf(0.5f * ((float)my - (float)detParams.nCols) - TrackerTraits::bigPixYCorrection, - comParams.thePitchY, + detParams.thePitchY, detParams.shiftY); float cotalpha = 0, cotbeta = 0; @@ -259,7 +259,7 @@ namespace pixelCPEforDevice { detParams.chargeWidthX, // lorentz shift in cm thickness, cotalpha, - comParams.thePitchX, + detParams.thePitchX, TrackerTraits::isBigPixX(cp.minRow[ic]), TrackerTraits::isBigPixX(cp.maxRow[ic])); @@ -271,7 +271,7 @@ namespace pixelCPEforDevice { detParams.chargeWidthY, // lorentz shift in cm thickness, cotbeta, - comParams.thePitchY, + detParams.thePitchY, TrackerTraits::isBigPixY(cp.minCol[ic]), TrackerTraits::isBigPixY(cp.maxCol[ic])); @@ -374,7 +374,7 @@ namespace pixelCPEforDevice { cp.status[ic].isOneY = isOneY; cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY; - auto xoff = -float(TrackerTraits::xOffset) * comParams.thePitchX; + auto xoff = -float(TrackerTraits::xOffset) * detParams.thePitchX; int low_value = 0; int high_value = kNumErrorBins - 1; int bin_value = float(kNumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff); diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc index 0ff1cae5028e7..f93fafe98d876 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc @@ -42,19 +42,17 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { buffer_->commonParams().theThicknessB = m_DetParams.front().theThickness; buffer_->commonParams().theThicknessE = m_DetParams.back().theThickness; - buffer_->commonParams().thePitchX = m_DetParams[0].thePitchX; - buffer_->commonParams().thePitchY = m_DetParams[0].thePitchY; - buffer_->commonParams().numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel; - LogDebug("PixelCPEFastParamsHost") << "pitch & thickness " << buffer_->commonParams().thePitchX << ' ' - << buffer_->commonParams().thePitchY << " " - << buffer_->commonParams().theThicknessB << ' ' + LogDebug("PixelCPEFastParamsHost") << "thickness " << buffer_->commonParams().theThicknessB << ' ' << buffer_->commonParams().theThicknessE; // zero average geometry memset(&buffer_->averageGeometry(), 0, sizeof(pixelTopology::AverageGeometryT)); + // zero layer geometry + memset(&buffer_->layerGeometry(), 0, sizeof(pixelCPEforDevice::LayerGeometryT)); + uint32_t nLayers = 0; uint32_t oldLayer = 0; uint32_t oldLadder = 0; float rl = 0; @@ -64,6 +62,7 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { int nl = 0; assert(m_DetParams.size() <= TrackerTraits::numberOfModules); + for (auto i = 0U; i < m_DetParams.size(); ++i) { auto& p = m_DetParams[i]; auto& g = buffer_->detParams(i); @@ -76,8 +75,6 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { g.numPixsInModule = g.nRows * g.nCols; assert(p.theDet->index() == int(i)); - assert(buffer_->commonParams().thePitchY == p.thePitchY); - assert(buffer_->commonParams().thePitchX == p.thePitchX); g.isBarrel = GeomDetEnumerators::isBarrel(p.thePart); g.isPosZ = p.theDet->surface().position().z() > 0; @@ -94,6 +91,10 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { << g.layer << " starting at " << g.rawId << '\n' << "old layer had " << nl << " ladders"; nl = 0; + + assert(nLayers <= TrackerTraits::numberOfLayers); + buffer_->layerGeometry().layerStart[nLayers] = i; + ++nLayers; } if (oldLadder != ladder) { oldLadder = ladder; @@ -119,6 +120,9 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { g.y0 = p.theOrigin.y(); g.z0 = p.theOrigin.z(); + g.thePitchX = p.thePitchX; + g.thePitchY = p.thePitchY; + auto vv = p.theDet->surface().position(); auto rr = pixelCPEforDevice::Rotation(p.theDet->surface().rotation()); g.frame = pixelCPEforDevice::Frame(vv.x(), vv.y(), vv.z(), rr); @@ -144,7 +148,7 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { auto toMicron = [&](float x) { return std::min(511, int(x * 1.e4f + 0.5f)); }; // average angle - auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchX; + auto gvx = p.theOrigin.x() + 40.f * p.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 @@ -177,7 +181,7 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { // moduleOffsetX is the definition of TrackerTraits::xOffset, // needs to be calculated because for Phase2 the modules are not uniform float moduleOffsetX = -(0.5f * float(g.nRows) + TrackerTraits::bigPixXCorrection); - auto const xoff = moduleOffsetX * buffer_->commonParams().thePitchX; + auto const xoff = moduleOffsetX * g.thePitchX; for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) { auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f); @@ -197,11 +201,11 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { // sample yerr as function of position // moduleOffsetY is the definition of TrackerTraits::yOffset (removed) float moduleOffsetY = 0.5f * float(g.nCols) + TrackerTraits::bigPixYCorrection; - auto const yoff = -moduleOffsetY * buffer_->commonParams().thePitchY; + auto const yoff = -moduleOffsetY * p.thePitchY; for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) { auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f); - auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchY; + auto gvx = p.theOrigin.x() + 40.f * p.thePitchY; auto gvy = p.theOrigin.y() - y; auto gvz = 1.f / p.theOrigin.z(); cp.cotbeta = gvy * gvz; @@ -267,8 +271,8 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3) if (pixelCPEforDevice::kNumErrorBins - 1 == iy) ys += 8.f; // last bin for "overflow" - // cp.cotalpha = ys*(buffer_->commonParams().thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below) - cp.cotbeta = std::copysign(ys * (buffer_->commonParams().thePitchY / (8.f * thickness)), aveCB); + // cp.cotalpha = ys*(g.thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below) + cp.cotbeta = std::copysign(ys * (g.thePitchY / (8.f * thickness)), aveCB); errorFromTemplates(p, cp, 20000.f); g.sigmay[iy] = toMicron(cp.sigmay); LogDebug("PixelCPEFastParamsHost") << "sigmax/sigmay " << i << ' ' << (ys + 4.f) / 8.f << ' ' << cp.cotalpha @@ -277,6 +281,9 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { } } // loop over det + // store last module + buffer_->layerGeometry().layerStart[nLayers] = m_DetParams.size(); + constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder; constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel; constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel; @@ -334,11 +341,7 @@ void PixelCPEFastParamsHost::fillParamsForDevice() { LogDebug("PixelCPEFastParamsHost") << aveGeom.endCapZ[0] << ' ' << aveGeom.endCapZ[1]; #endif // EDM_ML_DEBUG - // fill Layer and ladders geometry - memset(&buffer_->layerGeometry(), 0, sizeof(pixelCPEforDevice::LayerGeometryT)); - memcpy(buffer_->layerGeometry().layerStart, - TrackerTraits::layerStart, - sizeof(pixelCPEforDevice::LayerGeometryT::layerStart)); + // fill ladders geometry memcpy(buffer_->layerGeometry().layer, pixelTopology::layer.data(), pixelTopology::layer.size());