From b629825c45cea4ef5afc534ba91713f109b2e391 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Mon, 25 Sep 2023 08:33:07 +0200 Subject: [PATCH] Core: modify maximum bc offset for tracks to be considered in time-based reassociation (#3212) --- Common/Core/CollisionAssociation.h | 12 ++++++++---- .../TableProducer/fwdtrackToCollisionAssociator.cxx | 1 + Common/TableProducer/trackToCollisionAssociator.cxx | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Common/Core/CollisionAssociation.h b/Common/Core/CollisionAssociation.h index 47e08aa5952..458ad6a3043 100644 --- a/Common/Core/CollisionAssociation.h +++ b/Common/Core/CollisionAssociation.h @@ -55,6 +55,7 @@ class CollisionAssociation void setUsePvAssociation(bool enable = true) { mUsePvAssociation = enable; } void setIncludeUnassigned(bool enable = true) { mIncludeUnassigned = enable; } void setFillTableOfCollIdsPerTrack(bool fill = true) { mFillTableOfCollIdsPerTrack = fill; } + void setBcWindow(int bcWindow = 115) { mBcWindowForOneSigma = bcWindow; } template void runStandardAssoc(o2::aod::Collisions const& collisions, @@ -150,7 +151,7 @@ class CollisionAssociation // loop over collisions to find time-compatible tracks auto trackBegin = tracks.begin(); - constexpr auto bOffsetMax = 241; // 6 mus (ITS) + auto bOffsetMax = mBcWindowForOneSigma * mNumSigmaForTimeCompat + mTimeMargin / o2::constants::lhc::LHCBunchSpacingNS; for (const auto& collision : collisions) { const float collTime = collision.collisionTime(); const float collTimeRes2 = collision.collisionTimeRes() * collision.collisionTimeRes(); @@ -160,12 +161,13 @@ class CollisionAssociation if (!mIncludeUnassigned && !track.has_collision()) { continue; } - const int64_t bcOffset = (int64_t)globalBC[track.filteredIndex()] - (int64_t)collBC; - if (std::abs(bcOffset) > bOffsetMax) { + + float trackTime = track.trackTime(); + const int64_t bcOffsetWindow = (int64_t)globalBC[track.filteredIndex()] + trackTime / o2::constants::lhc::LHCBunchSpacingNS - (int64_t)collBC; + if (std::abs(bcOffsetWindow) > bOffsetMax) { continue; } - float trackTime = track.trackTime(); float trackTimeRes = track.trackTimeRes(); if constexpr (isCentralBarrel) { if (mUsePvAssociation && track.isPVContributor()) { @@ -174,6 +176,7 @@ class CollisionAssociation } } + const int64_t bcOffset = (int64_t)globalBC[track.filteredIndex()] - (int64_t)collBC; const float deltaTime = trackTime - collTime + bcOffset * o2::constants::lhc::LHCBunchSpacingNS; float sigmaTimeRes2 = collTimeRes2 + trackTimeRes * trackTimeRes; 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, globalBC[track.filteredIndex()], deltaTime); @@ -238,6 +241,7 @@ class CollisionAssociation bool mUsePvAssociation{true}; // use the information of PV contributors bool mIncludeUnassigned{true}; // include tracks that were originally not assigned to any collision bool mFillTableOfCollIdsPerTrack{false}; // fill additional table with vectors of compatible collisions per track + int mBcWindowForOneSigma{115}; // BC window to be multiplied by the number of sigmas to define maximum window to be considered }; #endif // COMMON_CORE_COLLISIONASSOCIATION_H_ diff --git a/Common/TableProducer/fwdtrackToCollisionAssociator.cxx b/Common/TableProducer/fwdtrackToCollisionAssociator.cxx index 4528a381028..0478b69b12d 100644 --- a/Common/TableProducer/fwdtrackToCollisionAssociator.cxx +++ b/Common/TableProducer/fwdtrackToCollisionAssociator.cxx @@ -37,6 +37,7 @@ struct FwdTrackToCollisionAssociation { Configurable timeMargin{"timeMargin", 0.f, "time margin in ns added to uncertainty because of uncalibrated TPC"}; Configurable includeUnassigned{"includeUnassigned", false, "consider also tracks which are not assigned to any collision"}; Configurable fillTableOfCollIdsPerTrack{"fillTableOfCollIdsPerTrack", false, "fill additional table with vector of collision ids per track"}; + Configurable bcWindowForOneSigma{"bcWindowForOneSigma", 115, "BC window to be multiplied by the number of sigmas to define maximum window to be considered"}; CollisionAssociation collisionAssociator; diff --git a/Common/TableProducer/trackToCollisionAssociator.cxx b/Common/TableProducer/trackToCollisionAssociator.cxx index b39d9f31f32..62d90edaa9f 100644 --- a/Common/TableProducer/trackToCollisionAssociator.cxx +++ b/Common/TableProducer/trackToCollisionAssociator.cxx @@ -38,6 +38,7 @@ struct TrackToCollisionAssociation { Configurable usePVAssociation{"usePVAssociation", true, "if the track is a PV contributor, use the collision time for it"}; Configurable includeUnassigned{"includeUnassigned", false, "consider also tracks which are not assigned to any collision"}; Configurable fillTableOfCollIdsPerTrack{"fillTableOfCollIdsPerTrack", false, "fill additional table with vector of collision ids per track"}; + Configurable bcWindowForOneSigma{"bcWindowForOneSigma", 60, "BC window to be multiplied by the number of sigmas to define maximum window to be considered"}; CollisionAssociation collisionAssociator; @@ -61,6 +62,7 @@ struct TrackToCollisionAssociation { collisionAssociator.setUsePvAssociation(usePVAssociation); collisionAssociator.setIncludeUnassigned(includeUnassigned); collisionAssociator.setFillTableOfCollIdsPerTrack(fillTableOfCollIdsPerTrack); + collisionAssociator.setBcWindow(bcWindowForOneSigma); } void processAssocWithTime(Collisions const& collisions, TracksWithSel const& tracksUnfiltered, TracksWithSelFilter const& tracks, AmbiguousTracks const& ambiguousTracks, BCs const& bcs)