diff --git a/algo/trigger/V0Trigger.cxx b/algo/trigger/V0Trigger.cxx index 1bd3937c8d6a4ccb0be4e225cf45be06e359dca5..5234d19c5282575c7e89995b9c11795a93f4a194 100644 --- a/algo/trigger/V0Trigger.cxx +++ b/algo/trigger/V0Trigger.cxx @@ -4,6 +4,8 @@ #include "V0Trigger.h" +#include <iterator> + namespace cbm::algo { @@ -14,7 +16,7 @@ namespace cbm::algo Result result; for (auto trackIter1 = tracks.begin(); trackIter1 != tracks.end(); trackIter1++) { - for (auto trackIter2 = trackIter1++; trackIter2 != tracks.end(); trackIter2++) { + for (auto trackIter2 = std::next(trackIter1); trackIter2 != tracks.end(); trackIter2++) { // Check track time difference float time1 = trackIter1->fParFirst.GetTime(); diff --git a/algo/trigger/V0Trigger.h b/algo/trigger/V0Trigger.h index 67bdd732b88713fb0bde2a827c10ab8ac78fac3a..52aa3f4ac8bba8a5a1a8f747037b917adec66c66 100644 --- a/algo/trigger/V0Trigger.h +++ b/algo/trigger/V0Trigger.h @@ -14,8 +14,8 @@ namespace cbm::algo { /** @struct V0TriggerConfig - ** @brief Configuration (cut values) for the V0Trigger class -**/ + ** @brief Configuration (cut values) for the V0Trigger class + **/ struct V0TriggerConfig { double cutTime{}; /// Maximum time difference of tracks double cutZ{}; /// Minimum z position at closest approach @@ -24,15 +24,24 @@ namespace cbm::algo /** @struct V0TriggerMoniData - ** @brief Monitoring information for the algorithm V0Trigger - **/ + ** @brief Monitoring information for the algorithm V0Trigger + **/ struct V0TriggerMoniData { size_t errTracksUnsorted{0}; size_t numTrackPairs{0}; size_t numTrackPairsWithinTimeCut{0}; }; - + /** @class V0Trigger + ** @brief Trigger class for secondary two-track vertices in mCBM + ** @author Volker Friese <v.friese@gsi.de> + ** @date 1 February 2024 + ** + ** The class takes an array of tracks and searches for track pairs close in time and with a point of closest approach (PCA) + ** outside of the target area. Tracks are assumed to be straight lines, in the absence of a magnetic field as in mCBM. + ** The class returns a list of trigger times corresponding to track pairs satisfying the selection criteria: + ** Maximum time difference, minimum z of PCA, maximum distance at PCA. + **/ class V0Trigger { public: @@ -59,14 +68,14 @@ namespace cbm::algo private: /** @brief Calculation of closest approach of two tracks (straight lines) - ** @param track1 Parameters of first track - ** @param track2 Parameters of second track - ** @return (z position, distance) - ** - ** The closest approach is defined at the z position where the transverse distance of the tracks (in the x-y plane) is minimal. - ** This is not strictly the minimal distance in 3-d space, which is mathematically and computationally more involved. - ** It should be a good criterion for the purpose of finding displaced vertices. - **/ + ** @param track1 Parameters of first track + ** @param track2 Parameters of second track + ** @return (z position, distance) + ** + ** The closest approach is defined at the z position where the transverse distance of the tracks (in the x-y plane) is minimal. + ** This is not strictly the minimal distance in 3-d space, which is mathematically and computationally more involved. + ** It should be a good criterion for the purpose of finding displaced vertices. + **/ std::pair<double, double> CalcPCA(const TrackParam& track1, const TrackParam& track2) const; };