acts icon indicating copy to clipboard operation
acts copied to clipboard

feat: global chi2 fitter / GX2F

Open r4lv opened this issue 3 years ago • 10 comments

Dear all, please have a look at my implementation of the global χ² fitter. It consists of the core Chi2Fitter.hpp, an Algorithm, an Example (in cpp...) and a simple Unit Test.

I'd mark this as WIP, as there is still a lot of debug output and comments which might need to be removed before this gets merged.

r4lv avatar Dec 06 '21 16:12 r4lv

Codecov Report

Merging #1099 (ed15008) into main (7135dc8) will decrease coverage by 1.21%. The diff coverage is 31.12%.

:exclamation: Current head ed15008 differs from pull request most recent head 6737e91. Consider uploading reports for the commit 6737e91 to get more accurate results

@@            Coverage Diff             @@
##             main    #1099      +/-   ##
==========================================
- Coverage   48.59%   47.38%   -1.22%     
==========================================
  Files         380      378       -2     
  Lines       20589    19984     -605     
  Branches     9431     9420      -11     
==========================================
- Hits        10005     9469     -536     
+ Misses       4097     4016      -81     
- Partials     6487     6499      +12     
Impacted Files Coverage Δ
Core/src/TrackFitting/Chi2FitterError.cpp 0.00% <0.00%> (ø)
Core/include/Acts/TrackFitting/Chi2Fitter.hpp 32.41% <32.41%> (ø)
...de/Acts/TrackFitting/detail/VoidChi2Components.hpp 50.00% <50.00%> (ø)
Core/include/Acts/TrackFitting/GsfOptions.hpp 25.00% <0.00%> (-75.00%) :arrow_down:
Core/src/TrackFitting/GsfUtils.cpp 24.44% <0.00%> (-20.00%) :arrow_down:
.../include/Acts/Propagator/detail/SteppingHelper.hpp 44.00% <0.00%> (-9.85%) :arrow_down:
Core/include/Acts/Utilities/Delegate.hpp 77.27% <0.00%> (-9.57%) :arrow_down:
Core/src/TrackFitting/GainMatrixUpdater.cpp 11.11% <0.00%> (-8.89%) :arrow_down:
Core/include/Acts/EventData/MultiTrajectory.hpp 66.27% <0.00%> (-8.50%) :arrow_down:
Core/src/Material/MaterialSlab.cpp 47.36% <0.00%> (-7.18%) :arrow_down:
... and 172 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Dec 06 '21 17:12 codecov[bot]

Hi @r4lv , could you remind me if this is ready to be reviewed or not?

XiaocongAi avatar Dec 13 '21 14:12 XiaocongAi

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

stale[bot] avatar Jan 16 '22 23:01 stale[bot]

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

stale[bot] avatar Feb 25 '22 02:02 stale[bot]

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

stale[bot] avatar May 25 '22 23:05 stale[bot]

With the recent addition of the GSF, the Examples/Algorithms/TrackFitting/src/TrackFittingAlgorithm.cpp is now using GeneralFitterOptions instead of KalmanFitterOptions. Can this be reused for the Gχ²F? For now, the Gχ²F is in its separate TrackFittingChi2 folder, I think it would make sense to merge it with the KF+GSF, e.g. create a Examples/Algorithms/TrackFitting/src/TrackFittingAlgorithmFunctionsChi2.cpp.

Also the Examples/Python/src/TrackFitting.cpp (diff), Examples/Run/Reconstruction/Common/RecTruthTracks.cpp(diff) and others have been updated with the new Fitter Options.

r4lv avatar Jul 05 '22 14:07 r4lv

I'll have a look at the macOS CI failure.

paulgessinger avatar Jul 07 '22 07:07 paulgessinger

Ok, can reproduce the unit test failure with a clang13 build on CentOS8 too. The error is

10:04:56    Chi2Fitter     VERBOSE   Step with size = 1.34078e+154 performed
10:04:56    Chi2Fitter     VERBOSE   Target: 0 | Target stepSize (path limit) updated to (5.36312e+154,  +∞,  +∞,  +∞ )
10:04:56    Chi2Fitter     ERROR     Propagation reached the step count limit of 1000 (did 1000 steps)
10:04:56    Chi2Fitter     ERROR     chi2 | it=1 | propapation failed: PropagatorError:3

where it performs a large number of very large steps. This comes after

10:04:56    Chi2Fitter     VERBOSE   chi2 | Finalize...                                                                                                                                                                                                                                                                                             
10:04:56    Chi2Fitter     VERBOSE   Stepping loop done.                                                                                                                                                                                                                                                                                            
10:04:56    Chi2Fitter     VERBOSE   chi2 | it=0 | χ² = 6.72687e+36                                                                                                                                                                                                                                                                                 
10:04:56    Chi2Fitter     VERBOSE   chi2 | it=0 | updated parameters = 6.65817e+09    -4.57298     -683016     1.51275           1     12591.3                                                                                                                                                                                                     
10:04:56    Chi2Fitter     VERBOSE   Entering propagation.                                                                                                                                                                                                                                                                                          
10:04:56    Chi2Fitter     VERBOSE   No Volume | Entering navigator::status.                                                                                                                                                                                                                                                                        
10:04:56    Chi2Fitter     VERBOSE   No Volume | Initialization.                                                                                                                                                                                                                                                                                    
10:04:56    Chi2Fitter     VERBOSE   No Volume | Current surface set to start surface undefined                                                                                                                                                                                                                                                     
10:04:56    Chi2Fitter     VERBOSE   No Volume | Slow start initialization through search.                                                                                                                                                                                                                                                          
10:04:56    Chi2Fitter     VERBOSE   No Volume | Starting from position (-3000.0000, 6658169179.5303, -4.5730) and direction (-0.6777, -0.7330, 0.0580)                                                                                                                                                                                             
10:04:56    Chi2Fitter     VERBOSE   Volume 1 | Start volume resolved.    
# ...
10:04:56    Chi2Fitter     VERBOSE    - Surface intersecion invalid                                                                                                       
10:04:56    Chi2Fitter     VERBOSE   Volume reports 0 confined dense volumes                                                                                              
10:04:56    Chi2Fitter     VERBOSE   0 boundary candidates found at path(s):                                                                                              
10:04:56    Chi2Fitter     VERBOSE   Volume 1 | No further navigation action, proceed to target.                                                                          
10:04:56    Chi2Fitter     VERBOSE   Starting stepping loop. 

where it has started to resolve the navigation sequence. This is in the test ZeroFieldNoSurfaceForward. I think what's happening is that the first propagation pass completes, the GX2F then wants to rerun the propagation again, but the GX2F has produced incorrect starting parameters: it=0 | updated parameters = 6.65817e+09 -4.57298 -683016 1.51275 1 12591.3, which are clearly out of bounds.

Is this something we can expect to happen? That the Chi2 update produces garbage and can't succeed from there? Maybe we need more verbose logging output on the calculation happening there so it's easier to understand what part of the calculation breaks.

paulgessinger avatar Jul 07 '22 08:07 paulgessinger

macOS CI failure: I ran the unit test on Ubuntu 20.04 with Clang 10.0.0 and could NOT reproduce the failure.

:
:
        Start 126: GsfComponentMerging
126/212 Test #126: GsfComponentMerging ..................   Passed    0.02 sec
        Start 127: Chi2Fitter
127/212 Test #127: Chi2Fitter ...........................   Passed    0.06 sec
        Start 128: AnnealingUtility
128/212 Test #128: AnnealingUtility .....................   Passed    0.01 sec
:
:
100% tests passed, 0 tests failed out of 212

AJPfleger avatar Jul 11 '22 15:07 AJPfleger

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

stale[bot] avatar Aug 11 '22 21:08 stale[bot]

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

stale[bot] avatar Sep 30 '22 23:09 stale[bot]

A followup on this topic is made with PR #1580 .

AJPfleger avatar Oct 11 '22 09:10 AJPfleger