Closed jchelly closed 1 month ago
Calling CountParticleTypes() (which recomputes TracerIndex) at the end of KickNullParticles() allows the test run to complete without crashing.
A better fix might be to have a separate ChooseTracer() function which we can call to recompute the tracer index. I don't think it's a good idea to just count the number of removed particles before the tracer because the tracer itself might have been removed!
The change to fix this by calling CountParticleTypes() has been merged and the L2800N5040/HYDRO_FIDUCIAL run completed with HBT_CHECK_TRACER_INDEX=ON so I think this is fixed.
In the check_tracer_index branch I've modified the code so that TracerIndex is only accessed through GetTracerIndex and SetTracerIndex functions.
If we compile with HBT_CHECK_TRACER_INDEX=ON then SetTracerIndex records the ID of the tracer particle. GetTracerIndex checks that the particle with the specified index has the expected ID. On the small Colibre test run at /cosma7/data/dp004/dc-foro1/colibre/ this consistency check fails. This might due to the TracerIndex not being updated when particles which no longer exist are removed from the subhalo.