Skip to content

Commit

Permalink
Merge branch 'main' into Hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
CouthuresJeremy authored Jul 9, 2024
2 parents e9e626a + 57c632e commit 80af81b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Core/include/Acts/Seeding/SeedFinderConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,19 @@ struct SeedFinderConfig {
Delegate<Acts::Vector3(const SpacePoint&)> getStripCenterDistance;
/// Returns position of the center of the top strip.
Delegate<Acts::Vector3(const SpacePoint&)> getTopStripCenterPosition;
/// Delegate for specifying experiment specific cuts on space points
/// before filling the grid. Currently accepts three parameters
Delegate<bool(const SpacePoint&)> spacePointSelector{
DelegateFuncTag<voidSpacePointSelector>{}};

static bool voidSpacePointSelector(const SpacePoint& /*sp*/) { return true; }

/// Tolerance parameter used to check the compatibility of space-point
/// coordinates in xyz. This is only used in a detector specific check for
/// strip modules
float toleranceParam = 1.1 * Acts::UnitConstants::mm;

// Delegate to apply experiment specific cuts
// Delegate to apply experiment specific cuts during doublet finding
Delegate<bool(float /*bottomRadius*/, float /*cotTheta*/)> experimentCuts{
DelegateFuncTag<&noopExperimentCuts>{}};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid(
// store x,y,z values in extent
rRangeSPExtent.extend({spX, spY, spZ});

// remove SPs according to experiment specific cuts
if (!config.spacePointSelector(sp)) {
continue;
}

// remove SPs outside z and phi region
if (spZ > config.zMax || spZ < config.zMin) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class SeedingAlgorithm final : public IAlgorithm {
// number of phiBin neighbors at each side of the current bin that will be
// used to search for SPs
int numPhiNeighbors = 1;

// Connect custom selections on the space points or to the doublet
// compatibility
bool useExtraCuts = false;
};

/// Construct the seeding algorithm.
Expand Down Expand Up @@ -94,6 +98,34 @@ class SeedingAlgorithm final : public IAlgorithm {
m_inputSpacePoints{};

WriteDataHandle<SimSeedContainer> m_outputSeeds{this, "OutputSeeds"};

static inline bool itkFastTrackingCuts(float bottomRadius, float cotTheta) {
float RMin = 50.;
float CotThetaMax = 1.5;

if (bottomRadius < RMin &&
(cotTheta > CotThetaMax || cotTheta < -CotThetaMax)) {
return false;
}
return true;
}

static inline bool itkFastTrackingSPselect(const SimSpacePoint& sp) {
// At small r we remove points beyond |z| > 200.
float r = sp.r();
float zabs = std::abs(sp.z());
if (zabs > 200. && r < 50.) {
return false;
}

/// Remove space points beyond eta=4 if their z is
/// larger than the max seed z0 (150.)
float cotTheta = 27.2899; // corresponds to eta=4
if ((zabs - 150.) > cotTheta * r) {
return false;
}
return true;
}
};

} // namespace ActsExamples
9 changes: 9 additions & 0 deletions Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ ActsExamples::SeedingAlgorithm::SeedingAlgorithm(
});
}

if (m_cfg.useExtraCuts) {
// This function will be applied to select space points during grid filling
m_cfg.seedFinderConfig.spacePointSelector
.connect<itkFastTrackingSPselect>();

// This function will be applied to the doublet compatibility selection
m_cfg.seedFinderConfig.experimentCuts.connect<itkFastTrackingCuts>();
}

m_bottomBinFinder = std::make_unique<const Acts::GridBinFinder<2ul>>(
m_cfg.numPhiNeighbors, m_cfg.zBinNeighborsBottom);
m_topBinFinder = std::make_unique<const Acts::GridBinFinder<2ul>>(
Expand Down
6 changes: 4 additions & 2 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@
"zBinNeighborsTop",
"zBinNeighborsBottom",
"numPhiNeighbors",
"useExtraCuts",
],
defaults=[None] * 4,
defaults=[None] * 5,
)

TruthEstimatedSeedingAlgorithmConfigArg = namedtuple(
Expand Down Expand Up @@ -286,7 +287,7 @@ def addSeeding(
spacePointGridConfigArg : SpacePointGridConfigArg(rMax, zBinEdges, phiBinDeflectionCoverage, phi, maxPhiBins, impactMax)
SpacePointGridConfigArg settings. phi is specified as a tuple of (min,max).
Defaults specified in Core/include/Acts/Seeding/SpacePointGrid.hpp
seedingAlgorithmConfigArg : SeedingAlgorithmConfigArg(allowSeparateRMax, zBinNeighborsTop, zBinNeighborsBottom, numPhiNeighbors)
seedingAlgorithmConfigArg : SeedingAlgorithmConfigArg(allowSeparateRMax, zBinNeighborsTop, zBinNeighborsBottom, numPhiNeighbors, useExtraCuts)
Defaults specified in Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/SeedingAlgorithm.hpp
hashingTrainingConfigArg : HashingTrainingConfigArg(AnnoySeed, f)
Defaults specified in Core/include/Acts/Seeding/Hashing/HashingTrainingConfig.hpp
Expand Down Expand Up @@ -758,6 +759,7 @@ def addStandardSeeding(
zBinNeighborsTop=seedingAlgorithmConfigArg.zBinNeighborsTop,
zBinNeighborsBottom=seedingAlgorithmConfigArg.zBinNeighborsBottom,
numPhiNeighbors=seedingAlgorithmConfigArg.numPhiNeighbors,
useExtraCuts=seedingAlgorithmConfigArg.useExtraCuts,
),
gridConfig=gridConfig,
gridOptions=gridOptions,
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/src/TrackFinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void addTrackFinding(Context& ctx) {
ActsExamples::SeedingAlgorithm, mex, "SeedingAlgorithm", inputSpacePoints,
outputSeeds, seedFilterConfig, seedFinderConfig, seedFinderOptions,
gridConfig, gridOptions, allowSeparateRMax, zBinNeighborsTop,
zBinNeighborsBottom, numPhiNeighbors);
zBinNeighborsBottom, numPhiNeighbors, useExtraCuts);

ACTS_PYTHON_DECLARE_ALGORITHM(
ActsExamples::SeedingAlgorithmHashing, mex, "SeedingAlgorithmHashing",
Expand Down

0 comments on commit 80af81b

Please sign in to comment.