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

fix: full chain vertexing #1299

Merged
merged 87 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
9322d1b
fix full chain vertexing
andiwand Jun 29, 2022
bbed83a
tmp
andiwand Jun 30, 2022
30f82d5
fix formatting
andiwand Jul 5, 2022
6ed8661
check input for VertexFitterAlgorithm
andiwand Jul 5, 2022
f313d74
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 5, 2022
935200b
fix
andiwand Jul 6, 2022
25398c8
Merge branch 'fix-full-chain-vertexing' of github.com:andiwand/acts i…
andiwand Jul 6, 2022
86c6528
fix fix
andiwand Jul 6, 2022
7de8269
Update __init__.py
andiwand Jul 6, 2022
339a130
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 6, 2022
abaf725
fix
andiwand Jul 6, 2022
6ab4778
Merge branch 'fix-full-chain-vertexing' of github.com:andiwand/acts i…
andiwand Jul 6, 2022
a873491
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 6, 2022
0c13d44
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 6, 2022
e3eef98
fix vertex finder
andiwand Jul 6, 2022
7cd3d3b
Merge branch 'fix-full-chain-vertexing' of github.com:andiwand/acts i…
andiwand Jul 6, 2022
743d92b
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 6, 2022
1628f16
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 7, 2022
158f52c
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 7, 2022
3c1e8fb
raise failure threshold for full chain
andiwand Jul 7, 2022
d83409d
doc failure threshold
andiwand Jul 7, 2022
2c21e5e
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 7, 2022
e2403ae
Update Examples/Framework/src/Framework/Sequencer.cpp
andiwand Jul 8, 2022
26eaa6e
use AMVF; cleanup
andiwand Jul 8, 2022
3640f59
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 8, 2022
368c028
make vertexing error level configurable
andiwand Jul 11, 2022
98b6fd7
Merge branch 'fix-full-chain-vertexing' of github.com:andiwand/acts i…
andiwand Jul 11, 2022
b22e204
fix formatting
andiwand Jul 11, 2022
c75a645
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 11, 2022
87f5858
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 11, 2022
1365cbd
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 14, 2022
b1d3e77
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 21, 2022
8c3fb4d
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 22, 2022
57f5649
debugging
andiwand Jul 27, 2022
0a7073d
tmp
andiwand Jul 27, 2022
b8c9bf7
refactor ConstrainedStep
andiwand Jul 27, 2022
ec6f776
refactor ConstrainedStep
andiwand Jul 27, 2022
281b987
Merge branch 'main' of github.com:acts-project/acts into fix-full-cha…
andiwand Jul 28, 2022
82ca5b8
clean up and fix python examples
andiwand Jul 28, 2022
2bd5e34
fix AbortListTests
andiwand Jul 28, 2022
29d8e64
remove direction
andiwand Jul 28, 2022
2760362
remove direction
andiwand Jul 28, 2022
0ad2d08
fix ConstrainedStepTests
andiwand Jul 28, 2022
47108e5
fix unit tests; fix formatting
andiwand Jul 28, 2022
360f3e9
fix formatting
andiwand Jul 28, 2022
6b21af3
remove debug prints
andiwand Jul 28, 2022
a1fd353
fix
andiwand Jul 28, 2022
c3d162d
revert vertexing error level
andiwand Jul 28, 2022
4c8626b
doc; fix; stream operator
andiwand Jul 29, 2022
55c3acf
Merge branch 'main' into fix-full-chain-vertexing
andiwand Jul 29, 2022
446ef50
fix
andiwand Jul 29, 2022
060810b
fix
andiwand Jul 29, 2022
e2bfe16
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Jul 29, 2022
3fb3817
fix ConstrainedStepTests
andiwand Jul 29, 2022
48f30ea
clang tidy fix
andiwand Jul 29, 2022
d037b8a
remove failing unit test checks
andiwand Jul 29, 2022
78a5658
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Jul 29, 2022
5799ab9
fix
andiwand Jul 29, 2022
4867381
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Jul 29, 2022
a3f053a
fix
andiwand Jul 29, 2022
80e780a
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Jul 29, 2022
655529e
add full chain to physmon
andiwand Jul 29, 2022
4880cb4
fix
andiwand Jul 29, 2022
f224e43
Merge branch 'fix-full-chain-vertexing' of github.com:andiwand/acts i…
andiwand Jul 29, 2022
a9ac1f2
fix
andiwand Jul 29, 2022
36655d0
remove logging
andiwand Jul 29, 2022
80be3e9
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Jul 29, 2022
0e71e18
revert breaking changes
andiwand Jul 30, 2022
82fc88d
fix formatting
andiwand Jul 30, 2022
a3d9d26
fix atlas stepper
andiwand Jul 30, 2022
cf41eef
Merge branch 'main' into refactor-constrained-step
andiwand Jul 30, 2022
37b87da
Merge branch 'refactor-constrained-step' of github.com:andiwand/acts …
andiwand Aug 1, 2022
50aaa3b
use iterative vertexing
andiwand Aug 2, 2022
90dd714
remove cout
andiwand Aug 2, 2022
3ef905a
Merge branch 'main' into fix-full-chain-vertexing
andiwand Aug 2, 2022
e553db2
revert changes
andiwand Aug 2, 2022
5754ed7
Merge branch 'main' into fix-full-chain-vertexing
andiwand Aug 2, 2022
eac8667
work around helical track linearizer
andiwand Aug 2, 2022
3ed9332
increase particle count
andiwand Aug 3, 2022
77aa058
remove info logging
andiwand Aug 3, 2022
43c811d
revert helical track linearizer changes
andiwand Aug 3, 2022
8d22d9e
Merge branch 'main' into fix-full-chain-vertexing
andiwand Aug 4, 2022
edcafc0
reduce to 2 muons
andiwand Aug 5, 2022
58632a1
Update Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp
andiwand Aug 5, 2022
4aae4f4
fix formatting
andiwand Aug 5, 2022
6aeddfe
Merge branch 'main' into fix-full-chain-vertexing
kodiakhq[bot] Aug 9, 2022
a684ad4
Merge branch 'main' into fix-full-chain-vertexing
andiwand Aug 9, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class TrackFindingAlgorithm final : public BareAlgorithm {
std::string inputInitialTrackParameters;
/// Output find trajectories collection.
std::string outputTrajectories;
/// Output track parameters collection.
std::string outputTrackParameters;
/// Type erased track finder function.
std::shared_ptr<TrackFinderFunction> findTracks;
/// CKF measurement selector config
Expand Down
12 changes: 12 additions & 0 deletions Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
TrajectoriesContainer trajectories;
trajectories.reserve(initialParameters.size());

// Prepare the output data with TrackParameters
TrackParametersContainer trackParametersContainer;

// Construct a perigee surface as the target surface
auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
Acts::Vector3{0., 0., 0.});
Expand Down Expand Up @@ -104,6 +107,13 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
std::move(trackFindingOutput.fittedStates),
std::move(trackFindingOutput.lastMeasurementIndices),
std::move(trackFindingOutput.fittedParameters));

const auto& traj = trajectories.back();
for (const auto tip : traj.tips()) {
if (traj.hasTrackParameters(tip)) {
trackParametersContainer.push_back(traj.trackParameters(tip));
}
}
} else {
ACTS_WARNING("Track finding failed for seed " << iseed << " with error"
<< result.error());
Expand All @@ -117,5 +127,7 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
<< " track candidates.");

ctx.eventStore.add(m_cfg.outputTrajectories, std::move(trajectories));
ctx.eventStore.add(m_cfg.outputTrackParameters,
std::move(trackParametersContainer));
return ActsExamples::ProcessCode::SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ ActsExamples::AdaptiveMultiVertexFinderAlgorithm::execute(
// find vertices and measure elapsed time
auto result = finder.find(inputTrackPointers, finderOpts, state);

if (not result.ok()) {
if (result.ok()) {
vertices = std::move(result.value());
} else {
ACTS_ERROR("Error in vertex finder: " << result.error().message());
return ProcessCode::ABORT;
}
vertices = *result;
}
andiwand marked this conversation as resolved.
Show resolved Hide resolved

auto t2 = std::chrono::high_resolution_clock::now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ ActsExamples::ProcessCode ActsExamples::IterativeVertexFinderAlgorithm::execute(
auto result = finder.find(inputTrackPointers, finderOpts, state);
auto t2 = std::chrono::high_resolution_clock::now();

if (not result.ok()) {
std::vector<Acts::Vertex<Acts::BoundTrackParameters>> vertices;
if (result.ok()) {
vertices = std::move(result.value());
} else {
ACTS_ERROR("Error in vertex finder: " << result.error().message());
return ProcessCode::ABORT;
}
auto vertices = *result;

// show some debug output
ACTS_INFO("Found " << vertices.size() << " vertices in event");
Expand Down
17 changes: 13 additions & 4 deletions Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ ActsExamples::ProcessCode ActsExamples::VertexFitterAlgorithm::execute(
inputTrackPtrCollection.clear();
inputTrackPtrCollection.reserve(protoVertex.size());
for (const auto& trackIdx : protoVertex) {
if (trackIdx >= trackParameters.size()) {
ACTS_ERROR("track parameters " << trackIdx << " does not exist");
continue;
}

inputTrackPtrCollection.push_back(&trackParameters[trackIdx]);
}

Expand Down Expand Up @@ -123,10 +128,14 @@ ActsExamples::ProcessCode ActsExamples::VertexFitterAlgorithm::execute(
}
}

ACTS_DEBUG("Fitted Vertex "
<< fittedVertices.back().fullPosition().transpose());
ACTS_DEBUG(
"Tracks at fitted Vertex: " << fittedVertices.back().tracks().size());
if (fittedVertices.size() > 0) {
ACTS_DEBUG("Fitted Vertex "
<< fittedVertices.back().fullPosition().transpose());
ACTS_DEBUG(
"Tracks at fitted Vertex: " << fittedVertices.back().tracks().size());
} else {
ACTS_DEBUG("No fitted vertex");
}
}

ctx.eventStore.add(m_cfg.outputVertices, std::move(fittedVertices));
Expand Down
1 change: 1 addition & 0 deletions Examples/Framework/src/Framework/Sequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ int ActsExamples::Sequencer::run() {
StopWatch sw(localClocksAlgorithms[ialgo++]);
ACTS_VERBOSE("Execute algorithm: " << alg->name());
if (alg->execute(++context) != ProcessCode::SUCCESS) {
ACTS_ERROR("Failed to execute algorithm: " << alg->name());
andiwand marked this conversation as resolved.
Show resolved Hide resolved
throw std::runtime_error("Failed to process event data");
}
}
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 @@ -314,6 +314,7 @@ void addTrackFinding(Context& ctx) {
ACTS_PYTHON_MEMBER(inputSourceLinks);
ACTS_PYTHON_MEMBER(inputInitialTrackParameters);
ACTS_PYTHON_MEMBER(outputTrajectories);
ACTS_PYTHON_MEMBER(outputTrackParameters);
ACTS_PYTHON_MEMBER(findTracks);
ACTS_PYTHON_MEMBER(measurementSelectorCfg);
ACTS_PYTHON_STRUCT_END();
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,5 +1021,5 @@ def test_full_chain_odd_example(tmp_path):
assert script.exists()
env = os.environ.copy()
env["NEVENTS"] = "1"
env["ACTS_LOG_FAILURE_THRESHOLD"] = "WARNING"
env["ACTS_LOG_FAILURE_THRESHOLD"] = "FATAL"
subprocess.check_call([str(script)], cwd=tmp_path, env=env)
1 change: 1 addition & 0 deletions Examples/Scripts/Python/ckf_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def addCKFTracks(
inputSourceLinks="sourcelinks",
inputInitialTrackParameters="estimatedparameters",
outputTrajectories="trajectories",
outputTrackParameters="fittedTrackParameters",
findTracks=acts.examples.TrackFindingAlgorithm.makeTrackFinderFunction(
trackingGeometry, field
),
Expand Down
17 changes: 15 additions & 2 deletions Examples/Scripts/Python/full_chain_odd.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
s,
MomentumConfig(1.0 * u.GeV, 10.0 * u.GeV, True),
EtaConfig(-3.0, 3.0, True),
ParticleConfig(1, acts.PdgParticle.eMuon, True),
ParticleConfig(2, acts.PdgParticle.eMuon, True),
rnd=rnd,
)
s = addFatras(
Expand Down Expand Up @@ -67,11 +67,24 @@
CKFPerformanceConfig(ptMin=400.0 * u.MeV, nMeasurementsMin=6),
outputDirRoot=outputDir,
)
s.addAlgorithm(
acts.examples.TrackSelector(
level=acts.logging.INFO,
inputTrackParameters="fittedTrackParameters",
outputTrackParameters="trackparameters",
outputTrackIndices="outputTrackIndices",
removeNeutral=True,
absEtaMax=2.5,
loc0Max=4.0 * u.mm, # rho max
ptMin=500 * u.MeV,
)
)
s = addVertexFitting(
s,
field,
vertexFinder=VertexFinder.Truth,
vertexFinder=VertexFinder.Iterative,
andiwand marked this conversation as resolved.
Show resolved Hide resolved
outputDirRoot=outputDir,
logLevel=acts.logging.VERBOSE,
andiwand marked this conversation as resolved.
Show resolved Hide resolved
)

s.run()
4 changes: 1 addition & 3 deletions Examples/Scripts/Python/vertex_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def addVertexFitting(
field,
outputDirRoot: Optional[Union[Path, str]] = None,
associatedParticles: str = "particles_input",
trackParameters: str = "estimatedparameters",
trackParameters: str = "trackparameters",
vertexFinder: VertexFinder = VertexFinder.Truth,
logLevel: Optional[acts.logging.Level] = None,
):
Expand Down Expand Up @@ -88,7 +88,6 @@ def customLogLevel(custom: acts.logging.Level = acts.logging.INFO):
outputVertices=outputVertices,
)
s.addAlgorithm(fitVertices)

elif vertexFinder == VertexFinder.Iterative:
findVertices = IterativeVertexFinderAlgorithm(
level=customLogLevel(),
Expand All @@ -108,7 +107,6 @@ def customLogLevel(custom: acts.logging.Level = acts.logging.INFO):
outputVertices=outputVertices,
outputTime=outputTime,
)

s.addAlgorithm(findVertices)
else:
raise RuntimeError("Invalid finder argument")
Expand Down