Skip to content

Commit

Permalink
Merge branch 'main' into revert-2917
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger authored Feb 28, 2024
2 parents 3eb493f + 6a25545 commit 20f0a31
Show file tree
Hide file tree
Showing 74 changed files with 1,720 additions and 995 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ jobs:
PYTEST_MD_REPORT_OUTPUT: pytest.md
run: >
/usr/local/bin/geant4-config --install-datasets
&& source /usr/local/bin/thisroot.sh
&& source /usr/local/bin/thisdd4hep_only.sh
&& source /usr/local/bin/geant4.sh
&& source build/python/setup.sh
&& export PYTHONPATH=/usr/local/python:$PYTHONPATH
&& export LD_LIBRARY_PATH=$PWD/build/thirdparty/OpenDataDetector/factory:$LD_LIBRARY_PATH
&& source build/this_acts_withdeps.sh
&& pip3 install -r Examples/Python/tests/requirements.txt
&& pip3 install pytest-md-report
&& pytest -rFsv -k "not exatrkx" -v
Expand Down Expand Up @@ -195,13 +190,8 @@ jobs:
&& pip3 install histcmp==0.6.5 spyral-cli==1.1.1 matplotlib
&& pip3 install -r Examples/Scripts/requirements.txt
&& /usr/local/bin/geant4-config --install-datasets
&& source /usr/local/bin/thisroot.sh
&& source /usr/local/bin/thisdd4hep_only.sh
&& source /usr/local/bin/geant4.sh
&& source build/python/setup.sh
&& export LD_LIBRARY_PATH=$PWD/build/thirdparty/OpenDataDetector/factory:$LD_LIBRARY_PATH
&& source build/this_acts_withdeps.sh
&& echo "::endgroup::"
&& export PYTHONPATH="${PYTHONPATH}":"${GITHUB_WORKSPACE}/Examples/Scripts/Python"
&& CI/physmon/phys_perf_mon.sh all physmon
&& cat physmon/summary.md >> $GITHUB_STEP_SUMMARY
Expand Down
17 changes: 3 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ test_exatrkx_python:
script:
- apt-get update -y
- apt-get install -y python3 libxxhash0
- source /usr/local/bin/thisroot.sh
- source build/python/setup.sh
- source build/this_acts_withdeps.sh
- git clone $CLONE_URL src
- cd src
- git checkout $HEAD_SHA
Expand Down Expand Up @@ -205,12 +204,7 @@ linux_test_examples:
- cd ..

- /usr/local/bin/geant4-config --install-datasets
- "source /usr/local/bin/thisroot.sh || true"
- "source /usr/local/bin/thisdd4hep_only.sh || true"
- "source /usr/local/bin/geant4.sh || true"
- source build/python/setup.sh
- export PYTHONPATH=/usr/local/python:$PYTHONPATH
- export LD_LIBRARY_PATH=$PWD/build/thirdparty/OpenDataDetector/factory:$LD_LIBRARY_PATH
- source build/this_acts_withdeps.sh
- cd src
- pip3 install -r Examples/Python/tests/requirements.txt
- pytest -rFsv -k "not exatrkx" -v
Expand Down Expand Up @@ -240,13 +234,8 @@ linux_physmon:
- pip3 install histcmp==0.6.5 spyral-cli==1.1.0 matplotlib
- pip3 install -r src/Examples/Scripts/requirements.txt
- /usr/local/bin/geant4-config --install-datasets
- "source /usr/local/bin/thisroot.sh || true"
- "source /usr/local/bin/thisdd4hep_only.sh || true"
- "source /usr/local/bin/geant4.sh || true"
- source build/python/setup.sh
- export LD_LIBRARY_PATH=$PWD/build/thirdparty/OpenDataDetector/factory:$LD_LIBRARY_PATH
- source build/this_acts_withdeps.sh
- cd src
- export PYTHONPATH="${PYTHONPATH}":"${PWD}/Examples/Scripts/Python"
- CI/physmon/phys_perf_mon.sh all physmon

###############################
Expand Down
48 changes: 48 additions & 0 deletions CI/physmon/gx2f.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
checks:
"*":
Chi2Test:
threshold: 0.01
KolmogorovTest:
threshold: 0.68
RatioCheck:
threshold: 3
ResidualCheck:
threshold: 3
IntegralCheck:
threshold: 3

"nStates_*":
KolmogorovTest: null
"nMeasurements_*":
KolmogorovTest: null

pullmean_phi_vs_eta:
IntegralCheck:
threshold: 4
pullmean_theta_vs_eta:
IntegralCheck: null
pullmean_z0_vs_eta:
IntegralCheck: null

pullwidth_phi_vs_eta:
IntegralCheck:
threshold: 4.3
reswidth_d0_vs_eta:
IntegralCheck:
threshold: 4
resmean_d0_vs_eta:
IntegralCheck:
threshold: 4

pullwidth_*:
Chi2Test: null
KolmogorovTest: null
pullmean_*:
Chi2Test: null
KolmogorovTest: null
reswidth_*:
Chi2Test: null
KolmogorovTest: null
resmean_*:
Chi2Test: null
KolmogorovTest: null
12 changes: 12 additions & 0 deletions CI/physmon/phys_perf_mon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ fi
if [[ "$mode" == "all" || "$mode" == "gsf" ]]; then
run_physmon_gen "Truth Tracking GSF" "truth_tracking_gsf"
fi
if [[ "$mode" == "all" || "$mode" == "gx2f" ]]; then
run_physmon_gen "Truth Tracking GX2F" "truth_tracking_gx2f"
fi
if [[ "$mode" == "all" || "$mode" == "fullchains" ]]; then
run_physmon_gen "CKF Tracking" "ckf_tracking"
run_physmon_gen "Track finding ttbar" "track_finding_ttbar"
Expand Down Expand Up @@ -340,6 +343,15 @@ if [[ "$mode" == "all" || "$mode" == "kalman" ]]; then
-c CI/physmon/truth_tracking.yml
fi

if [[ "$mode" == "all" || "$mode" == "gx2f" ]]; then
run_histcmp \
$outdir/performance_gx2f.root \
$refdir/performance_gx2f.root \
"Truth tracking (GX2F)" \
gx2f \
-c CI/physmon/gx2f.yml
fi

if [[ "$mode" == "all" || "$mode" == "vertexing" ]]; then
Examples/Scripts/vertex_mu_scan.py \
$outdir/performance_vertexing_*mu*.root \
Expand Down
Binary file modified CI/physmon/reference/performance_ambi_ttbar.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_gridseeder_ttbar_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_ttbar_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_ttbar.root
Binary file not shown.
Binary file added CI/physmon/reference/performance_gx2f.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_seeding_ttbar.root
Binary file not shown.
Binary file modified CI/physmon/reference/tracksummary_ckf_ttbar_hist.root
Binary file not shown.
34 changes: 34 additions & 0 deletions CI/physmon/workflows/physmon_truth_tracking_gx2f.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
import tempfile
from pathlib import Path
import shutil

import acts
from truth_tracking_gx2f import runTruthTrackingGx2f

from physmon_common import makeSetup

setup = makeSetup()

with tempfile.TemporaryDirectory() as temp:
s = acts.examples.Sequencer(
events=10000,
numThreads=-1,
logLevel=acts.logging.INFO,
)

tp = Path(temp)
runTruthTrackingGx2f(
trackingGeometry=setup.trackingGeometry,
field=setup.field,
outputDir=tp,
digiConfigFile=setup.digiConfig,
s=s,
)

s.run()
del s

perf_file = tp / "performance_gx2f.root"
assert perf_file.exists(), "Performance file not found"
shutil.copy(perf_file, setup.outdir / "performance_gx2f.root")
63 changes: 53 additions & 10 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,6 @@ class Gx2Fitter {
/// Calibration context for the fit
const CalibrationContext* calibrationContext{nullptr};

/// The current iteration of the fitter.
/// The variable is updated in fit().
/// The actor needs to know the current iteration for adding new
/// trackStates. During the first iteration, each measurement surfaces will
/// be added to the track.
std::size_t nUpdate = Acts::MultiTrajectoryTraits::kInvalid;

/// @brief Gx2f actor operation
///
/// @tparam propagator_state_t is the type of Propagator state
Expand Down Expand Up @@ -495,8 +488,10 @@ class Gx2Fitter {
} else if (trackStateProxy.calibratedSize() == 2) {
collector<2>(trackStateProxy, result, *actorLogger);
} else {
ACTS_WARNING(
"Only measurements of 1 and 2 dimensions are implemented yet.");
ACTS_WARNING("Found measurement with "
<< trackStateProxy.calibratedSize()
<< " dimensions. Only measurements of 1 and 2 "
"dimensions are implemented yet.");
}

// Set the measurement type flag
Expand Down Expand Up @@ -646,7 +641,6 @@ class Gx2Fitter {
gx2fActor.extensions = gx2fOptions.extensions;
gx2fActor.calibrationContext = &gx2fOptions.calibrationContext.get();
gx2fActor.actorLogger = m_actorLogger.get();
gx2fActor.nUpdate = nUpdate;

auto propagatorState = m_propagator.makeState(params, propagatorOptions);

Expand Down Expand Up @@ -675,6 +669,24 @@ class Gx2Fitter {
ACTS_VERBOSE("gx2fResult.collectorProjectedJacobians.size() = "
<< gx2fResult.collectorProjectedJacobians.size());

// This check takes into account the evaluated dimensions of the
// measurements. To fit, we need at least NDF+1 measurements. However,
// we n-dimensional measurements count for n measurements, reducing the
// effective number of needed measurements.
// We might encounter the case, where we cannot use some (parts of a)
// measurements, maybe if we do not support that kind of measurement. This
// is also taken into account here.
// `ndf = 4` is chosen, since this a minimum that makes sense for us, but
// a more general approach is desired.
// TODO genernalize for n-dimensional fit
constexpr std::size_t ndf = 4;
if (ndf + 1 > gx2fResult.collectorResiduals.size()) {
ACTS_INFO("Not enough measurements. Require "
<< ndf + 1 << ", but only "
<< gx2fResult.collectorResiduals.size() << " could be used.");
return Experimental::GlobalChiSquareFitterError::NotEnoughMeasurements;
}

chi2sum = 0;
aMatrix = BoundMatrix::Zero();
bVector = BoundVector::Zero();
Expand Down Expand Up @@ -777,6 +789,37 @@ class Gx2Fitter {

ACTS_VERBOSE("final covariance:\n" << fullCovariancePredicted);

// Propagate again with the final covariance matrix. This is necessary to
// obtain the propagated covariance for each state.
if (gx2fOptions.nUpdateMax > 0) {
ACTS_VERBOSE("Propagate with the final covariance.");
// update covariance
ACTS_VERBOSE("finaldeltaParams:\n" << deltaParams);
params.covariance() = fullCovariancePredicted;

// set up propagator and co
Acts::GeometryContext geoCtx = gx2fOptions.geoContext;
Acts::MagneticFieldContext magCtx = gx2fOptions.magFieldContext;
// Set options for propagator
PropagatorOptions propagatorOptions(geoCtx, magCtx);
auto& gx2fActor = propagatorOptions.actionList.template get<GX2FActor>();
gx2fActor.inputMeasurements = &inputMeasurements;
gx2fActor.extensions = gx2fOptions.extensions;
gx2fActor.calibrationContext = &gx2fOptions.calibrationContext.get();
gx2fActor.actorLogger = m_actorLogger.get();

auto propagatorState = m_propagator.makeState(params, propagatorOptions);

auto& r = propagatorState.template get<Gx2FitterResult<traj_t>>();
r.fittedStates = &trackContainer.trackStateContainer();

// Clear the track container. It could be more performant to update the
// existing states, but this needs some more thinking.
trackContainer.clear();

m_propagator.template propagate(propagatorState);
}

if (!trackContainer.hasColumn(
Acts::hashString(Gx2fConstants::gx2fnUpdateColumn))) {
trackContainer.template addColumn<std::size_t>("Gx2fnUpdateColumn");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum class GlobalChiSquareFitterError {
// ensure all values are non-zero
AIsNotInvertible = 1,
DidNotConverge = 2,
NotEnoughMeasurements = 3,
};

std::error_code make_error_code(
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AdaptiveMultiVertexFitter {
struct State {
State(const MagneticFieldProvider& field,
const Acts::MagneticFieldContext& magContext)
: ipState(field.makeCache(magContext)),
: ipState{field.makeCache(magContext)},
fieldCache(field.makeCache(magContext)) {}
// Vertex collection to be fitted
std::vector<Vertex*> vertexCollection;
Expand Down
Loading

0 comments on commit 20f0a31

Please sign in to comment.