2020#ifndef COMMON_CORE_COLLISIONASSOCIATION_H_
2121#define COMMON_CORE_COLLISIONASSOCIATION_H_
2222
23- #include < vector>
23+ #include < CommonConstants/LHCConstants.h>
24+ #include < Framework/ASoAHelpers.h>
25+ #include < Framework/AnalysisDataModel.h>
26+
2427#include < memory>
2528#include < utility>
26-
27- #include " CommonConstants/LHCConstants.h"
28- #include " Framework/AnalysisDataModel.h"
29- #include " Framework/ASoAHelpers.h"
29+ #include < vector>
3030
3131namespace o2 ::aod
3232{
@@ -191,58 +191,58 @@ class CollisionAssociation
191191 for (auto & iterationWindow : trackIterationWindows) {
192192 bool iteratorMoved = false ;
193193 const bool isAssignedTrackWindow = (iterationWindow.first != iterationWindow.second ) ? iterationWindow.first .has_collision () : false ;
194- for (auto track = iterationWindow.first ; track != iterationWindow.second ; ++track ) {
195- int64_t trackBC = globalBC[track .filteredIndex ()];
194+ for (auto trackInWindow = iterationWindow.first ; trackInWindow != iterationWindow.second ; ++trackInWindow ) {
195+ int64_t trackBC = globalBC[trackInWindow .filteredIndex ()];
196196 if (trackBC < 0 ) {
197197 continue ;
198198 }
199199
200200 // Optimization to avoid looping over the full track list each time. This builds on that tracks are sorted by BCs (which they should be because collisions are sorted by BCs)
201- const int64_t bcOffset = trackBC - ( int64_t ) collBC;
201+ const int64_t bcOffset = trackBC - static_cast < int64_t >( collBC) ;
202202 if constexpr (isCentralBarrel) {
203203 // only for blocks with collision association
204204 if (isAssignedTrackWindow) {
205205 constexpr int margin = 200 ;
206206 if (!iteratorMoved && bcOffset > -bcOffsetMax - margin) {
207- iterationWindow.first .setCursor (track .filteredIndex ());
207+ iterationWindow.first .setCursor (trackInWindow .filteredIndex ());
208208 iteratorMoved = true ;
209- LOGP (debug, " Moving iterator begin {}" , track .filteredIndex ());
209+ LOGP (debug, " Moving iterator begin {}" , trackInWindow .filteredIndex ());
210210 } else if (bcOffset > bcOffsetMax + margin) {
211- LOGP (debug, " Stopping iterator {}" , track .filteredIndex ());
211+ LOGP (debug, " Stopping iterator {}" , trackInWindow .filteredIndex ());
212212 break ;
213213 }
214214 }
215215 }
216216
217- int64_t bcOffsetWindow = trackBCCache[track .filteredIndex ()] - ( int64_t ) collBC;
217+ int64_t bcOffsetWindow = trackBCCache[trackInWindow .filteredIndex ()] - static_cast < int64_t >( collBC) ;
218218 if (std::abs (bcOffsetWindow) > bcOffsetMax) {
219219 continue ;
220220 }
221221
222222 float trackTime = 0 ;
223223 float trackTimeRes = 0 ;
224224 if constexpr (isCentralBarrel) {
225- if (mUsePvAssociation && track .isPVContributor ()) {
226- trackTime = track .collision ().collisionTime (); // if PV contributor, we assume the time to be the one of the collision
227- trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC
225+ if (mUsePvAssociation && trackInWindow .isPVContributor ()) {
226+ trackTime = trackInWindow .collision ().collisionTime (); // if PV contributor, we assume the time to be the one of the collision
227+ trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC
228228 } else {
229- trackTime = track .trackTime ();
230- trackTimeRes = track .trackTimeRes ();
229+ trackTime = trackInWindow .trackTime ();
230+ trackTimeRes = trackInWindow .trackTimeRes ();
231231 }
232232 } else {
233- trackTime = track .trackTime ();
234- trackTimeRes = track .trackTimeRes ();
233+ trackTime = trackInWindow .trackTime ();
234+ trackTimeRes = trackInWindow .trackTimeRes ();
235235 }
236236
237237 const float deltaTime = trackTime - collTime + bcOffset * o2::constants::lhc::LHCBunchSpacingNS;
238238 float sigmaTimeRes2 = collTimeRes2 + trackTimeRes * trackTimeRes;
239- LOGP (debug, " collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}" , collTime, collision.collisionTimeRes (), track .trackTime (), track .trackTimeRes (), collBC, trackBC, deltaTime);
239+ LOGP (debug, " collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}" , collTime, collision.collisionTimeRes (), trackInWindow .trackTime (), trackInWindow .trackTimeRes (), collBC, trackBC, deltaTime);
240240
241241 float thresholdTime = 0 .;
242242 if constexpr (isCentralBarrel) {
243- if (mUsePvAssociation && track .isPVContributor ()) {
243+ if (mUsePvAssociation && trackInWindow .isPVContributor ()) {
244244 thresholdTime = trackTimeRes;
245- } else if (TESTBIT (track .flags (), o2::aod::track::TrackTimeResIsRange)) {
245+ } else if (TESTBIT (trackInWindow .flags (), o2::aod::track::TrackTimeResIsRange)) {
246246 // the track time resolution is a range, not a gaussian resolution
247247 thresholdTime = trackTimeRes + mNumSigmaForTimeCompat * std::sqrt (collTimeRes2) + mTimeMargin ;
248248 } else {
@@ -262,7 +262,7 @@ class CollisionAssociation
262262
263263 if (std::abs (deltaTime) < thresholdTime) {
264264 const auto collIdx = collision.globalIndex ();
265- const auto trackIdx = track .globalIndex ();
265+ const auto trackIdx = trackInWindow .globalIndex ();
266266 LOGP (debug, " Filling track id {} for coll id {}" , trackIdx, collIdx);
267267 association (collIdx, trackIdx);
268268 if (mFillTableOfCollIdsPerTrack ) {
@@ -278,9 +278,9 @@ class CollisionAssociation
278278 // create reverse index track to collisions if enabled
279279 if (mFillTableOfCollIdsPerTrack ) {
280280 std::vector<int > empty{};
281- for (const auto & track : tracksUnfiltered) {
281+ for (const auto & trackUnfiltered : tracksUnfiltered) {
282282
283- const auto trackId = track .globalIndex ();
283+ const auto trackId = trackUnfiltered .globalIndex ();
284284 if (collsPerTrack[trackId] == nullptr ) {
285285 reverseIndices (empty);
286286 } else {
0 commit comments