forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
estimateTrackParamCovariance
to Core (acts-project#3683)
Add a `estimateTrackParamCovariance` function to Core to estimate the initial covariance of track parameters after seeding. blocked by - acts-project#3665 --- This pull request introduces a new function for estimating track parameter covariance and refactors existing code to utilize this new function. The changes improve code modularity and maintainability by centralizing the covariance estimation logic. ### New Functionality: * [`Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp`](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0R292-R335): Added `EstimateTrackParamCovarianceConfig` struct and `estimateTrackParamCovariance` function to estimate track parameter covariance. ### Refactoring: * [`Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp`](diffhunk://#diff-3fa61f411627effaf29755fa1d539c90bbd2c5155f04c4fa7a0d7f36d99340f3L38-L79): Removed the `makeInitialCovariance` function and replaced its usage with the new `estimateTrackParamCovariance` function. This change simplifies the code by removing redundant logic. [[1]](diffhunk://#diff-3fa61f411627effaf29755fa1d539c90bbd2c5155f04c4fa7a0d7f36d99340f3L38-L79) [[2]](diffhunk://#diff-3fa61f411627effaf29755fa1d539c90bbd2c5155f04c4fa7a0d7f36d99340f3L174-R144) * [`Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp`](diffhunk://#diff-d4047681edb055a3b4ca13bb837f6fef194fd0c8b3205f337db73e97f4b6de82L131-R141): Updated the covariance calculation to use the new `estimateTrackParamCovariance` function, ensuring consistency across the codebase. ### Miscellaneous: * [`Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp`](diffhunk://#diff-d4047681edb055a3b4ca13bb837f6fef194fd0c8b3205f337db73e97f4b6de82R14): Included the `EstimateTrackParamsFromSeed.hpp` header to access the new covariance estimation function.
- Loading branch information
1 parent
af91734
commit 3351b78
Showing
7 changed files
with
111 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target_sources(ActsCore PRIVATE EstimateTrackParamsFromSeed.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp" | ||
|
||
#include "Acts/Definitions/TrackParametrization.hpp" | ||
|
||
Acts::BoundMatrix Acts::estimateTrackParamCovariance( | ||
const EstimateTrackParamCovarianceConfig& config, const BoundVector& params, | ||
bool hasTime) { | ||
assert((params[eBoundTheta] > 0 && params[eBoundTheta] < M_PI) && | ||
"Theta must be in the range (0, pi)"); | ||
|
||
BoundSquareMatrix result = BoundSquareMatrix::Zero(); | ||
|
||
for (std::size_t i = eBoundLoc0; i < eBoundSize; ++i) { | ||
double sigma = config.initialSigmas[i]; | ||
double variance = sigma * sigma; | ||
|
||
if (i == eBoundQOverP) { | ||
// note that we rely on the fact that sigma theta is already computed | ||
double varianceTheta = result(eBoundTheta, eBoundTheta); | ||
|
||
// transverse momentum contribution | ||
variance += std::pow(config.initialSigmaPtRel * params[eBoundQOverP], 2); | ||
|
||
// theta contribution | ||
variance += | ||
varianceTheta * | ||
std::pow(params[eBoundQOverP] / std::tan(params[eBoundTheta]), 2); | ||
} | ||
|
||
if (i == eBoundTime && !hasTime) { | ||
// Inflate the time uncertainty if no time measurement is available | ||
variance *= config.noTimeVarInflation; | ||
} | ||
|
||
// Inflate the initial covariance | ||
variance *= config.initialVarInflation[i]; | ||
|
||
result(i, i) = variance; | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters