Skip to content

Commit

Permalink
Merge pull request #33453 from fabiocos/fc-inpixel
Browse files Browse the repository at this point in the history
MTD geometry and digitization: move check for pixel active area into RectangularMTDTopology, make it usable for BTL as well
  • Loading branch information
cmsbuild authored Apr 20, 2021
2 parents f1ecbb0 + de3e5d1 commit 0da9e23
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
<Vector name="vPars" type="numeric" nEntries="4">
4, 4, 4, 24
</Vector>
<!--BTL inter-crystal gaps approximated to nearest integer value in microns-->
<!--in y preserve total free space, move 0.5 microns for each inter-crystal to borders-->
<Vector name="BTL" type="numeric" nEntries="12">
0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 3, 1
3733, 1867, 112, 60, 0, 0, 0, 0, 1, 16, 3, 1
</Vector>
<Vector name="ETL" type="numeric" nEntries="12">
50, 50, 50, 50, 0, 0, 0, 0, 16, 16, 2, 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class RectangularMTDTopology final : public PixelTopology {
// PixelTopology interface.
std::pair<float, float> pixel(const LocalPoint& p) const override;

//check whether LocalPoint is inside the pixel active area
bool isInPixel(const LocalPoint& p) const;

// Errors
// Error in local (cm) from the masurement errors
LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
Expand Down
19 changes: 19 additions & 0 deletions Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ std::pair<float, float> RectangularMTDTopology::pixel(const LocalPoint& p) const
return std::pair<float, float>(newxbin, newybin);
}

//The following lines check whether the point is actually out of the active pixel area.
bool RectangularMTDTopology::isInPixel(const LocalPoint& p) const {
bool isInside = true;
const auto& thepixel = pixel(p);
const int ixbin = static_cast<int>(thepixel.first);
const int iybin = static_cast<int>(thepixel.second);
const float fractionX = thepixel.first - ixbin;
const float fractionY = thepixel.second - iybin;
if ((fractionX > 1.0 - m_GAPxInterpadFrac || fractionX < m_GAPxInterpadFrac) ||
(ixbin == 0 && fractionX < m_GAPxBorderFrac) || (ixbin == m_nrows - 1 && fractionX > 1.0 - m_GAPxBorderFrac)) {
isInside = false;
}
if ((fractionY > 1.0 - m_GAPyInterpadFrac || fractionY < m_GAPyInterpadFrac) ||
(iybin == 0 && fractionY < m_GAPyBorderFrac) || (iybin == m_ncols - 1 && fractionY > 1.0 - m_GAPyBorderFrac)) {
isInside = false;
}
return isInside;
}

//----------------------------------------------------------------------
// Topology interface, go from Measurement to Local corrdinates
// pixel coordinates (mp) -> cm (LocalPoint)
Expand Down
15 changes: 3 additions & 12 deletions SimFastTiming/FastTimingCommon/src/ETLDeviceSim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,12 @@ void ETLDeviceSim::getHitsResponse(const std::vector<std::tuple<int, uint32_t, f
const auto& pentry = hit.entryPoint();
// ETL is already in module-local coordinates so just scale to cm from mm
Local3DPoint simscaled(convertMmToCm(pentry.x()), convertMmToCm(pentry.y()), convertMmToCm(pentry.z()));
const auto& thepixel = topo.pixel(simscaled);
//The following lines check whether the pixel point is actually out of the active area.
//If that is the case it simply ignores the point but in the future some more sophisticated function could be applied.
const int ixbin = int(thepixel.first);
const int iybin = int(thepixel.second);
const float fractionX = thepixel.first - ixbin;
const float fractionY = thepixel.second - iybin;
if ((fractionX > 1.0 - topo.gapxInterpadFrac() || fractionX < topo.gapxInterpadFrac()) ||
(ixbin == 0 && fractionX < topo.gapxBorderFrac()) ||
(ixbin == topo.nrows() - 1 && fractionX > 1.0 - topo.gapxBorderFrac()))
continue;
if ((fractionY > 1.0 - topo.gapyInterpadFrac() || fractionY < topo.gapyInterpadFrac()) ||
(iybin == 0 && fractionY < topo.gapyBorderFrac()) ||
(iybin == topo.ncolumns() - 1 && fractionY > 1.0 - topo.gapyBorderFrac()))
if (!topo.isInPixel(simscaled)) {
continue;
}
const auto& thepixel = topo.pixel(simscaled);
const uint8_t row(thepixel.first), col(thepixel.second);

auto simHitIt =
Expand Down

0 comments on commit 0da9e23

Please sign in to comment.