Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make interaction point cut optional in seedFinder #1207

Merged
merged 4 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 60 additions & 54 deletions Core/include/Acts/Seeding/Seedfinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,36 @@ void Seedfinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
// points away from the interaction point in addition to a translation
// transformation we also perform a rotation in order to keep the
// curvature of the circle tangent to the x axis
float xVal = (topSP->x() - spM->x()) * (spM->x() / rM) +
(topSP->y() - spM->y()) * (spM->y() / rM);
float yVal = (topSP->y() - spM->y()) * (spM->x() / rM) -
(topSP->x() - spM->x()) * (spM->y() / rM);
if (std::abs(rM * yVal) > m_config.impactMax * xVal) {
// conformal transformation u=x/(x²+y²) v=y/(x²+y²) transform the circle
// into straight lines in the u/v plane the line equation can be
// described in terms of aCoef and bCoef, where v = aCoef * u + bCoef
float uT = xVal / (xVal * xVal + yVal * yVal);
float vT = yVal / (xVal * xVal + yVal * yVal);
// in the rotated frame the interaction point is positioned at x = -rM
// and y ~= impactParam
float uIP = -1. / rM;
float vIP = m_config.impactMax / (rM * rM);
if (yVal > 0.)
vIP = -vIP;
// we can obtain aCoef as the slope dv/du of the linear function,
// estimated using du and dv between the two SP bCoef is obtained by
// inserting aCoef into the linear equation
float aCoef = (vT - vIP) / (uT - uIP);
float bCoef = vIP - aCoef * uIP;
// the distance of the straight line from the origin (radius of the
// circle) is related to aCoef and bCoef by d^2 = bCoef^2 / (1 +
// aCoef^2) = 1 / (radius^2) and we can apply the cut on the curvature
if ((bCoef * bCoef) >
(1 + aCoef * aCoef) / m_config.minHelixDiameter2) {
continue;
if (m_config.interactionPointCut) {
float xVal = (topSP->x() - spM->x()) * (spM->x() / rM) +
(topSP->y() - spM->y()) * (spM->y() / rM);
float yVal = (topSP->y() - spM->y()) * (spM->x() / rM) -
(topSP->x() - spM->x()) * (spM->y() / rM);
if (std::abs(rM * yVal) > m_config.impactMax * xVal) {
// conformal transformation u=x/(x²+y²) v=y/(x²+y²) transform the
// circle into straight lines in the u/v plane the line equation can
// be described in terms of aCoef and bCoef, where v = aCoef * u +
// bCoef
float uT = xVal / (xVal * xVal + yVal * yVal);
float vT = yVal / (xVal * xVal + yVal * yVal);
// in the rotated frame the interaction point is positioned at x = -rM
// and y ~= impactParam
float uIP = -1. / rM;
float vIP = m_config.impactMax / (rM * rM);
if (yVal > 0.)
vIP = -vIP;
// we can obtain aCoef as the slope dv/du of the linear function,
// estimated using du and dv between the two SP bCoef is obtained by
// inserting aCoef into the linear equation
float aCoef = (vT - vIP) / (uT - uIP);
float bCoef = vIP - aCoef * uIP;
// the distance of the straight line from the origin (radius of the
// circle) is related to aCoef and bCoef by d^2 = bCoef^2 / (1 +
// aCoef^2) = 1 / (radius^2) and we can apply the cut on the curvature
if ((bCoef * bCoef) >
(1 + aCoef * aCoef) / m_config.minHelixDiameter2) {
continue;
}
}
}
state.compatTopSP.push_back(topSP);
Expand Down Expand Up @@ -185,33 +188,36 @@ void Seedfinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
// points away from the interaction point in addition to a translation
// transformation we also perform a rotation in order to keep the
// curvature of the circle tangent to the x axis
float xVal = (bottomSP->x() - spM->x()) * (spM->x() / rM) +
(bottomSP->y() - spM->y()) * (spM->y() / rM);
float yVal = (bottomSP->y() - spM->y()) * (spM->x() / rM) -
(bottomSP->x() - spM->x()) * (spM->y() / rM);
if (std::abs(rM * yVal) > -m_config.impactMax * xVal) {
// conformal transformation u=x/(x²+y²) v=y/(x²+y²) transform the circle
// into straight lines in the u/v plane the line equation can be
// described in terms of aCoef and bCoef, where v = aCoef * u + bCoef
float uB = xVal / (xVal * xVal + yVal * yVal);
float vB = yVal / (xVal * xVal + yVal * yVal);
// in the rotated frame the interaction point is positioned at x = -rM
// and y ~= impactParam
float uIP = -1. / rM;
float vIP = m_config.impactMax / (rM * rM);
if (yVal < 0.)
vIP = -vIP;
// we can obtain aCoef as the slope dv/du of the linear function,
// estimated using du and dv between the two SP bCoef is obtained by
// inserting aCoef into the linear equation
float aCoef = (vB - vIP) / (uB - uIP);
float bCoef = vIP - aCoef * uIP;
// the distance of the straight line from the origin (radius of the
// circle) is related to aCoef and bCoef by d^2 = bCoef^2 / (1 +
// aCoef^2) = 1 / (radius^2) and we can apply the cut on the curvature
if ((bCoef * bCoef) >
(1 + aCoef * aCoef) / m_config.minHelixDiameter2) {
continue;
if (m_config.interactionPointCut) {
float xVal = (bottomSP->x() - spM->x()) * (spM->x() / rM) +
(bottomSP->y() - spM->y()) * (spM->y() / rM);
float yVal = (bottomSP->y() - spM->y()) * (spM->x() / rM) -
(bottomSP->x() - spM->x()) * (spM->y() / rM);
if (std::abs(rM * yVal) > -m_config.impactMax * xVal) {
// conformal transformation u=x/(x²+y²) v=y/(x²+y²) transform the
// circle into straight lines in the u/v plane the line equation can
// be
// described in terms of aCoef and bCoef, where v = aCoef * u + bCoef
float uB = xVal / (xVal * xVal + yVal * yVal);
float vB = yVal / (xVal * xVal + yVal * yVal);
// in the rotated frame the interaction point is positioned at x = -rM
// and y ~= impactParam
float uIP = -1. / rM;
float vIP = m_config.impactMax / (rM * rM);
if (yVal < 0.)
vIP = -vIP;
// we can obtain aCoef as the slope dv/du of the linear function,
// estimated using du and dv between the two SP bCoef is obtained by
// inserting aCoef into the linear equation
float aCoef = (vB - vIP) / (uB - uIP);
float bCoef = vIP - aCoef * uIP;
// the distance of the straight line from the origin (radius of the
// circle) is related to aCoef and bCoef by d^2 = bCoef^2 / (1 +
// aCoef^2) = 1 / (radius^2) and we can apply the cut on the curvature
if ((bCoef * bCoef) >
(1 + aCoef * aCoef) / m_config.minHelixDiameter2) {
continue;
}
}
}
state.compatBottomSP.push_back(bottomSP);
Expand Down
3 changes: 3 additions & 0 deletions Core/include/Acts/Seeding/SeedfinderConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ struct SeedfinderConfig {
// parameters for forward seed confirmation
SeedConfirmationRange forwardSeedConfirmationRange;

// enable cut on the compatibility between interaction point and SPs
bool interactionPointCut = false;

// non equidistant binning in z
std::vector<float> zBinEdges;

Expand Down
1 change: 1 addition & 0 deletions Examples/Python/src/TrackFinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void addTrackFinding(Context& ctx) {
ACTS_PYTHON_MEMBER(impactMax);
ACTS_PYTHON_MEMBER(zBinEdges);
ACTS_PYTHON_MEMBER(enableCutsForSortedSP);
ACTS_PYTHON_MEMBER(interactionPointCut);
ACTS_PYTHON_MEMBER(zBinEdges);
ACTS_PYTHON_MEMBER(rRangeMiddleSP);
ACTS_PYTHON_MEMBER(useVariableMiddleSPRange);
Expand Down
1 change: 1 addition & 0 deletions Examples/Scripts/Python/itk_seeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def runITkSeeding(field, csvInputDir, outputDir, s=None):
beamPos=acts.Vector2(0 * u.mm, 0 * u.mm),
impactMax=gridConfig.impactMax,
maxPtScattering=float("inf") * u.GeV,
interactionPointCut=True,
zBinEdges=gridConfig.zBinEdges,
enableCutsForSortedSP=True, # enable cotTheta sorting in SeedFinder
rRangeMiddleSP=[
Expand Down