Skip to content

Commit

Permalink
Merge pull request #45471 from fwyzard/fix_pixel_CPE_poisition_141x
Browse files Browse the repository at this point in the history
Fix pixel CPE poisition
  • Loading branch information
cmsbuild authored Jul 17, 2024
2 parents b08e6a8 + 785ff5d commit 80f86b5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
5 changes: 3 additions & 2 deletions DataFormats/TrackingRecHitSoA/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<use name="alpaka"/>
<use name="rootcore"/>
<use name="eigen"/>
<use name="DataFormats/SiPixelClusterSoA"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/TrackerCommon" source_only="1"/>
<use name="DataFormats/SiPixelClusterSoA"/>
<use name="DataFormats/SoATemplate" source_only="1"/>
<use name="DataFormats/TrackerCommon" source_only="1"/>
<use name="Geometry/CommonTopologies" source_only="1"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="!serial"/>
<export>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include "DataFormats/SoATemplate/interface/SoALayout.h"
#include "DataFormats/TrackingRecHitSoA/interface/SiPixelHitStatus.h"
#include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"
#include "HeterogeneousCore/AlpakaInterface/interface/HistoContainer.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h"

template <typename TrackerTraits>
struct TrackingRecHitSoA {
Expand Down
29 changes: 14 additions & 15 deletions RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,25 +234,24 @@ namespace pixelCPEforDevice {
if (cp.minCol[ic] == 0 || cp.maxCol[ic] == uint32_t(detParams.nCols - 1))
cp.ysize[ic] = -cp.ysize[ic];

// apply the lorentz offset correction
float xoff = 0.5f * float(detParams.nRows) * comParams.thePitchX;
float yoff = 0.5f * float(detParams.nCols) * comParams.thePitchY;

//correction for bigpixels for phase1
xoff = xoff + TrackerTraits::bigPixXCorrection * comParams.thePitchX;
yoff = yoff + TrackerTraits::bigPixYCorrection * comParams.thePitchY;

// apply the lorentz offset correction
auto xPos = detParams.shiftX + (comParams.thePitchX * 0.5f * float(mx)) - xoff;
auto yPos = detParams.shiftY + (comParams.thePitchY * 0.5f * float(my)) - yoff;
// Compute the position relative to the center of the module, taking into account the corrections for
// the Phase 1 big pixels, the module pitch, and the Lorentz shift.
// 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.shiftX);
float yPos = std::fmaf(0.5f * ((float)my - (float)detParams.nCols) - TrackerTraits::bigPixYCorrection,
comParams.thePitchY,
detParams.shiftY);

float cotalpha = 0, cotbeta = 0;

computeAnglesFromDet(detParams, xPos, yPos, cotalpha, cotbeta);

auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;

auto xcorr = correction(cp.maxRow[ic] - cp.minRow[ic],
auto xCorr = correction(cp.maxRow[ic] - cp.minRow[ic],
cp.q_f_X[ic],
cp.q_l_X[ic],
llxl,
Expand All @@ -264,7 +263,7 @@ namespace pixelCPEforDevice {
TrackerTraits::isBigPixX(cp.minRow[ic]),
TrackerTraits::isBigPixX(cp.maxRow[ic]));

auto ycorr = correction(cp.maxCol[ic] - cp.minCol[ic],
auto yCorr = correction(cp.maxCol[ic] - cp.minCol[ic],
cp.q_f_Y[ic],
cp.q_l_Y[ic],
llyl,
Expand All @@ -276,8 +275,8 @@ namespace pixelCPEforDevice {
TrackerTraits::isBigPixY(cp.minCol[ic]),
TrackerTraits::isBigPixY(cp.maxCol[ic]));

cp.xpos[ic] = xPos + xcorr;
cp.ypos[ic] = yPos + ycorr;
cp.xpos[ic] = xPos + xCorr;
cp.ypos[ic] = yPos + yCorr;
}

template <typename TrackerTraits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <alpaka/alpaka.hpp>

#include "DataFormats/Math/interface/approx_atan2.h"
#include "DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitsSoA.h"
#include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"
#include "HeterogeneousCore/AlpakaInterface/interface/VecArray.h"
Expand Down

0 comments on commit 80f86b5

Please sign in to comment.