Skip to content

Commit

Permalink
feat: Adding a few changes to test seeding algorithm (#4075)
Browse files Browse the repository at this point in the history
This PR includes a few changes to facilitate performance studies for the seeding algorithm

@pbutti, @benjaminhuth 


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**  
  - Enhanced seeding capability with new configuration options for additional filtering and customizable seed naming.  
  - Introduced a demonstration script that simplifies data reading and seeding, now featuring improved debug logging.

- **Chores**  
  - Optimized tracking criteria by refining selection thresholds and updating filtering parameters for improved performance.  
  - Added debug logging to track space point creation for better visibility during processing.  
  - Introduced a new parameter for occupancy configuration in the seeding algorithm.  
  - Updated filtering criteria in the reader to focus on space points.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
noemina authored Feb 24, 2025
1 parent 3e3eb67 commit d15f9a3
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SeedingAlgorithm final : public IAlgorithm {
WriteDataHandle<SimSeedContainer> m_outputSeeds{this, "OutputSeeds"};

static inline bool itkFastTrackingCuts(float bottomRadius, float cotTheta) {
static float rMin = 50.;
static float rMin = 45.;
static float cotThetaMax = 1.5;

if (bottomRadius < rMin &&
Expand All @@ -125,7 +125,7 @@ class SeedingAlgorithm final : public IAlgorithm {
// At small r we remove points beyond |z| > 200.
float r = sp.radius();
float zabs = std::abs(sp.z());
if (zabs > 200. && r < 50.) {
if (zabs > 200. && r < 45.) {
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions Examples/Io/Root/src/RootAthenaDumpReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ RootAthenaDumpReader::readSpacepoints(
ACTS_DEBUG("Created " << spacePoints.size() << " overall space points");
ACTS_DEBUG("Created " << pixelSpacePoints.size() << " "
<< " pixel space points");
ACTS_DEBUG("Created " << stripSpacePoints.size() << " "
<< " strip space points");

return {spacePoints, pixelSpacePoints, stripSpacePoints};
}
Expand Down
1 change: 1 addition & 0 deletions Examples/Python/python/acts/examples/itk.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def itkSeedingAlgConfig(
zBinNeighborsTop=zBinNeighborsTop,
zBinNeighborsBottom=zBinNeighborsBottom,
numPhiNeighbors=numPhiNeighbors,
useExtraCuts=highOccupancyConfig,
)

return (
Expand Down
3 changes: 2 additions & 1 deletion Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ def addStandardSeeding(
seedFilterConfigArg: SeedFilterConfigArg,
spacePointGridConfigArg: SpacePointGridConfigArg,
logLevel: acts.logging.Level = None,
outputSeeds: str = "seeds",
):
"""adds standard seeding
For parameters description see addSeeding
Expand Down Expand Up @@ -762,7 +763,7 @@ def addStandardSeeding(
seedingAlg = acts.examples.SeedingAlgorithm(
level=logLevel,
inputSpacePoints=[spacePoints],
outputSeeds="seeds",
outputSeeds=outputSeeds,
**acts.examples.defaultKWArgs(
allowSeparateRMax=seedingAlgorithmConfigArg.allowSeparateRMax,
zBinNeighborsTop=seedingAlgorithmConfigArg.zBinNeighborsTop,
Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/src/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ void addInput(Context& ctx) {
ActsExamples::RootAthenaDumpReader, mex, "RootAthenaDumpReader", treename,
inputfile, outputMeasurements, outputPixelSpacePoints,
outputStripSpacePoints, outputSpacePoints, outputClusters,
outputMeasurementParticlesMap, outputParticles, onlyPassedParticles,
skipOverlapSPsPhi, skipOverlapSPsEta, geometryIdMap, trackingGeometry,
absBoundaryTolerance);
outputMeasurementParticlesMap, outputParticles, onlySpacepoints,
onlyPassedParticles, skipOverlapSPsPhi, skipOverlapSPsEta, geometryIdMap,
trackingGeometry, absBoundaryTolerance);

#ifdef WITH_GEOMODEL_PLUGIN
ACTS_PYTHON_DECLARE_READER(ActsExamples::RootAthenaDumpGeoIdCollector, mex,
Expand Down
59 changes: 59 additions & 0 deletions Examples/Scripts/Python/reader_and_seeding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import sys
from pathlib import Path

import acts.examples
import acts

from acts.examples import (
CsvSpacePointReader,
TrackParamsEstimationAlgorithm,
SeedingPerformanceWriter,
)
from acts.examples.reconstruction import (
addStandardSeeding,
)

from acts.examples.itk import itkSeedingAlgConfig, InputSpacePointsType


s = acts.examples.Sequencer(events=1, numThreads=1, outputDir="output")

# loggingLevel = acts.logging.INFO
loggingLevel = acts.logging.DEBUG

s.addReader(
acts.examples.RootAthenaDumpReader(
level=loggingLevel,
treename="GNN4ITk",
inputfile="Dump_GNN4Itk.root",
onlySpacepoints=True,
outputPixelSpacePoints="pixel_spacepoints",
outputStripSpacePoints="strip_spacepoints",
outputSpacePoints="spacepoints",
)
)


# run pixel seeding
seeding_pixel = addStandardSeeding(
s,
"pixel_spacepoints",
*acts.examples.itk.itkSeedingAlgConfig(
InputSpacePointsType.PixelSpacePoints, highOccupancyConfig=True
),
logLevel=loggingLevel,
outputSeeds="pixel_seeds"
)


# run strip seeding
seeding_strip = addStandardSeeding(
s,
"strip_spacepoints",
*acts.examples.itk.itkSeedingAlgConfig(InputSpacePointsType.StripSpacePoints),
logLevel=acts.logging.DEBUG,
outputSeeds="strip_seeds"
)


s.run()

0 comments on commit d15f9a3

Please sign in to comment.