Skip to content

Commit f7a2d08

Browse files
committed
Reading module starts from geometry and variable pitch
1 parent 98c5815 commit f7a2d08

File tree

4 files changed

+33
-30
lines changed

4 files changed

+33
-30
lines changed

DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace pixelClustering {
2323
constexpr uint16_t clusterThresholdPhase2OtherLayers = 4000;
2424

2525
constexpr uint32_t maxNumDigis = 3 * 256 * 1024; // @PU=200 µ=530k σ=50k this is >4σ away
26-
constexpr uint16_t maxNumModules = 4000;
26+
constexpr uint16_t maxNumModules = 5000; // This is an upperlimit taking into account D110 has 4000 modules
2727

2828
constexpr int32_t maxNumClustersPerModules = maxHitsInModule();
2929
constexpr uint16_t invalidModuleId = std::numeric_limits<uint16_t>::max() - 1;

Geometry/CommonTopologies/interface/SimplePixelTopology.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ namespace phase2PixelTopology {
208208

209209
constexpr uint32_t numberOfLayers = 28;
210210
constexpr int nPairs = 23 + 6 + 14 + 8 + 4; // include far forward layer pairs
211-
constexpr uint16_t numberOfModules = 3892;
211+
constexpr uint16_t numberOfModules = 4000;
212212

213213
constexpr uint32_t maxNumClustersPerModules = 1024;
214214

@@ -378,7 +378,7 @@ namespace pixelTopology {
378378
static constexpr int maxDYsize = 10;
379379
static constexpr int maxDYPred = 20;
380380

381-
static constexpr uint16_t numberOfModules = 3892;
381+
static constexpr uint16_t numberOfModules = phase2PixelTopology::numberOfModules;
382382

383383
// 1000 bins < 1024 bins (10 bits) must be:
384384
// - < 32*32 (warpSize*warpSize for block prefix scan for CUDA)
@@ -475,7 +475,7 @@ namespace pixelTopology {
475475
static constexpr int maxDYsize = 20;
476476
static constexpr int maxDYPred = 20;
477477

478-
static constexpr uint16_t numberOfModules = 1856;
478+
static constexpr uint16_t numberOfModules = phase1PixelTopology::numberOfModules;
479479

480480
static constexpr uint16_t numRowsInRoc = 80;
481481
static constexpr uint16_t numColsInRoc = 52;

RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforDevice.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ namespace pixelCPEforDevice {
6161
struct CommonParams {
6262
float theThicknessB;
6363
float theThicknessE;
64-
float thePitchX;
65-
float thePitchY;
6664

6765
uint16_t maxModuleStride;
6866
uint8_t numberOfLaddersInBarrel;
@@ -77,6 +75,8 @@ namespace pixelCPEforDevice {
7775

7876
float shiftX;
7977
float shiftY;
78+
float thePitchX;
79+
float thePitchY;
8080
float chargeWidthX;
8181
float chargeWidthY;
8282
uint16_t pixmx; // max pix charge
@@ -239,10 +239,10 @@ namespace pixelCPEforDevice {
239239
// Use an explicit FMA instruction instead of simply (position * pitch + shift) to make sure that
240240
// different compiler optimizations do not produce different code on different architectures.
241241
float xPos = std::fmaf(0.5f * ((float)mx - (float)detParams.nRows) - TrackerTraits::bigPixXCorrection,
242-
comParams.thePitchX,
242+
detParams.thePitchX,
243243
detParams.shiftX);
244244
float yPos = std::fmaf(0.5f * ((float)my - (float)detParams.nCols) - TrackerTraits::bigPixYCorrection,
245-
comParams.thePitchY,
245+
detParams.thePitchY,
246246
detParams.shiftY);
247247

248248
float cotalpha = 0, cotbeta = 0;
@@ -259,7 +259,7 @@ namespace pixelCPEforDevice {
259259
detParams.chargeWidthX, // lorentz shift in cm
260260
thickness,
261261
cotalpha,
262-
comParams.thePitchX,
262+
detParams.thePitchX,
263263
TrackerTraits::isBigPixX(cp.minRow[ic]),
264264
TrackerTraits::isBigPixX(cp.maxRow[ic]));
265265

@@ -271,7 +271,7 @@ namespace pixelCPEforDevice {
271271
detParams.chargeWidthY, // lorentz shift in cm
272272
thickness,
273273
cotbeta,
274-
comParams.thePitchY,
274+
detParams.thePitchY,
275275
TrackerTraits::isBigPixY(cp.minCol[ic]),
276276
TrackerTraits::isBigPixY(cp.maxCol[ic]));
277277

@@ -374,7 +374,7 @@ namespace pixelCPEforDevice {
374374
cp.status[ic].isOneY = isOneY;
375375
cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
376376

377-
auto xoff = -float(TrackerTraits::xOffset) * comParams.thePitchX;
377+
auto xoff = -float(TrackerTraits::xOffset) * detParams.thePitchX;
378378
int low_value = 0;
379379
int high_value = kNumErrorBins - 1;
380380
int bin_value = float(kNumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff);

RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,17 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
4242

4343
buffer_->commonParams().theThicknessB = m_DetParams.front().theThickness;
4444
buffer_->commonParams().theThicknessE = m_DetParams.back().theThickness;
45-
buffer_->commonParams().thePitchX = m_DetParams[0].thePitchX;
46-
buffer_->commonParams().thePitchY = m_DetParams[0].thePitchY;
47-
4845
buffer_->commonParams().numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
4946

50-
LogDebug("PixelCPEFastParamsHost") << "pitch & thickness " << buffer_->commonParams().thePitchX << ' '
51-
<< buffer_->commonParams().thePitchY << " "
52-
<< buffer_->commonParams().theThicknessB << ' '
47+
LogDebug("PixelCPEFastParamsHost") << "thickness " << buffer_->commonParams().theThicknessB << ' '
5348
<< buffer_->commonParams().theThicknessE;
5449

5550
// zero average geometry
5651
memset(&buffer_->averageGeometry(), 0, sizeof(pixelTopology::AverageGeometryT<TrackerTraits>));
52+
// zero layer geometry
53+
memset(&buffer_->layerGeometry(), 0, sizeof(pixelCPEforDevice::LayerGeometryT<TrackerTraits>));
5754

55+
uint32_t nLayers = 0;
5856
uint32_t oldLayer = 0;
5957
uint32_t oldLadder = 0;
6058
float rl = 0;
@@ -64,6 +62,7 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
6462
int nl = 0;
6563

6664
assert(m_DetParams.size() <= TrackerTraits::numberOfModules);
65+
6766
for (auto i = 0U; i < m_DetParams.size(); ++i) {
6867
auto& p = m_DetParams[i];
6968
auto& g = buffer_->detParams(i);
@@ -76,8 +75,6 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
7675
g.numPixsInModule = g.nRows * g.nCols;
7776

7877
assert(p.theDet->index() == int(i));
79-
assert(buffer_->commonParams().thePitchY == p.thePitchY);
80-
assert(buffer_->commonParams().thePitchX == p.thePitchX);
8178

8279
g.isBarrel = GeomDetEnumerators::isBarrel(p.thePart);
8380
g.isPosZ = p.theDet->surface().position().z() > 0;
@@ -94,6 +91,10 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
9491
<< g.layer << " starting at " << g.rawId << '\n'
9592
<< "old layer had " << nl << " ladders";
9693
nl = 0;
94+
95+
assert(nLayers <= TrackerTraits::numberOfLayers);
96+
buffer_->layerGeometry().layerStart[nLayers] = i;
97+
++nLayers;
9798
}
9899
if (oldLadder != ladder) {
99100
oldLadder = ladder;
@@ -119,6 +120,9 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
119120
g.y0 = p.theOrigin.y();
120121
g.z0 = p.theOrigin.z();
121122

123+
g.thePitchX = p.thePitchX;
124+
g.thePitchY = p.thePitchY;
125+
122126
auto vv = p.theDet->surface().position();
123127
auto rr = pixelCPEforDevice::Rotation(p.theDet->surface().rotation());
124128
g.frame = pixelCPEforDevice::Frame(vv.x(), vv.y(), vv.z(), rr);
@@ -144,7 +148,7 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
144148
auto toMicron = [&](float x) { return std::min(511, int(x * 1.e4f + 0.5f)); };
145149

146150
// average angle
147-
auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchX;
151+
auto gvx = p.theOrigin.x() + 40.f * p.thePitchX;
148152
auto gvy = p.theOrigin.y();
149153
auto gvz = 1.f / p.theOrigin.z();
150154
//--- Note that the normalization is not required as only the ratio used
@@ -177,7 +181,7 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
177181
// moduleOffsetX is the definition of TrackerTraits::xOffset,
178182
// needs to be calculated because for Phase2 the modules are not uniform
179183
float moduleOffsetX = -(0.5f * float(g.nRows) + TrackerTraits::bigPixXCorrection);
180-
auto const xoff = moduleOffsetX * buffer_->commonParams().thePitchX;
184+
auto const xoff = moduleOffsetX * g.thePitchX;
181185

182186
for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) {
183187
auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f);
@@ -197,11 +201,11 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
197201
// sample yerr as function of position
198202
// moduleOffsetY is the definition of TrackerTraits::yOffset (removed)
199203
float moduleOffsetY = 0.5f * float(g.nCols) + TrackerTraits::bigPixYCorrection;
200-
auto const yoff = -moduleOffsetY * buffer_->commonParams().thePitchY;
204+
auto const yoff = -moduleOffsetY * p.thePitchY;
201205

202206
for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) {
203207
auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f);
204-
auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchY;
208+
auto gvx = p.theOrigin.x() + 40.f * p.thePitchY;
205209
auto gvy = p.theOrigin.y() - y;
206210
auto gvz = 1.f / p.theOrigin.z();
207211
cp.cotbeta = gvy * gvz;
@@ -267,8 +271,8 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
267271
ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3)
268272
if (pixelCPEforDevice::kNumErrorBins - 1 == iy)
269273
ys += 8.f; // last bin for "overflow"
270-
// cp.cotalpha = ys*(buffer_->commonParams().thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below)
271-
cp.cotbeta = std::copysign(ys * (buffer_->commonParams().thePitchY / (8.f * thickness)), aveCB);
274+
// cp.cotalpha = ys*(g.thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below)
275+
cp.cotbeta = std::copysign(ys * (g.thePitchY / (8.f * thickness)), aveCB);
272276
errorFromTemplates(p, cp, 20000.f);
273277
g.sigmay[iy] = toMicron(cp.sigmay);
274278
LogDebug("PixelCPEFastParamsHost") << "sigmax/sigmay " << i << ' ' << (ys + 4.f) / 8.f << ' ' << cp.cotalpha
@@ -277,6 +281,9 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
277281
}
278282
} // loop over det
279283

284+
// store last module
285+
buffer_->layerGeometry().layerStart[nLayers] = m_DetParams.size();
286+
280287
constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
281288
constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
282289
constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
@@ -334,11 +341,7 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
334341
LogDebug("PixelCPEFastParamsHost") << aveGeom.endCapZ[0] << ' ' << aveGeom.endCapZ[1];
335342
#endif // EDM_ML_DEBUG
336343

337-
// fill Layer and ladders geometry
338-
memset(&buffer_->layerGeometry(), 0, sizeof(pixelCPEforDevice::LayerGeometryT<TrackerTraits>));
339-
memcpy(buffer_->layerGeometry().layerStart,
340-
TrackerTraits::layerStart,
341-
sizeof(pixelCPEforDevice::LayerGeometryT<TrackerTraits>::layerStart));
344+
// fill ladders geometry
342345
memcpy(buffer_->layerGeometry().layer,
343346
pixelTopology::layer<TrackerTraits>.data(),
344347
pixelTopology::layer<TrackerTraits>.size());

0 commit comments

Comments
 (0)