Skip to content

Commit

Permalink
Core: modify maximum bc offset for tracks to be considered in time-ba…
Browse files Browse the repository at this point in the history
…sed reassociation (AliceO2Group#3212)
  • Loading branch information
fgrosa authored Sep 25, 2023
1 parent 656b299 commit b629825
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Common/Core/CollisionAssociation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename TTracks, typename Slice, typename Assoc, typename RevIndices>
void runStandardAssoc(o2::aod::Collisions const& collisions,
Expand Down Expand Up @@ -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();
Expand All @@ -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()) {
Expand All @@ -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);
Expand Down Expand Up @@ -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_
1 change: 1 addition & 0 deletions Common/TableProducer/fwdtrackToCollisionAssociator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct FwdTrackToCollisionAssociation {
Configurable<float> timeMargin{"timeMargin", 0.f, "time margin in ns added to uncertainty because of uncalibrated TPC"};
Configurable<bool> includeUnassigned{"includeUnassigned", false, "consider also tracks which are not assigned to any collision"};
Configurable<bool> fillTableOfCollIdsPerTrack{"fillTableOfCollIdsPerTrack", false, "fill additional table with vector of collision ids per track"};
Configurable<int> bcWindowForOneSigma{"bcWindowForOneSigma", 115, "BC window to be multiplied by the number of sigmas to define maximum window to be considered"};

CollisionAssociation<false> collisionAssociator;

Expand Down
2 changes: 2 additions & 0 deletions Common/TableProducer/trackToCollisionAssociator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct TrackToCollisionAssociation {
Configurable<bool> usePVAssociation{"usePVAssociation", true, "if the track is a PV contributor, use the collision time for it"};
Configurable<bool> includeUnassigned{"includeUnassigned", false, "consider also tracks which are not assigned to any collision"};
Configurable<bool> fillTableOfCollIdsPerTrack{"fillTableOfCollIdsPerTrack", false, "fill additional table with vector of collision ids per track"};
Configurable<int> bcWindowForOneSigma{"bcWindowForOneSigma", 60, "BC window to be multiplied by the number of sigmas to define maximum window to be considered"};

CollisionAssociation<true> collisionAssociator;

Expand All @@ -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)
Expand Down

0 comments on commit b629825

Please sign in to comment.