Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class SVertexer
struct TrackCand : o2::track::TrackParCov {
GIndex gid{};
VBracket vBracket{};
float minR = 0; // track lowest point r
float minR = 0; // track lowest point r (tracks with TPC but without ITS: the TPC inner reference)
float rInnerUpdate = -1.f; // radius of the innermost measured point if it differs from minR (tracks with TPC but without ITS), < 0: minR
bool hasTPC = false;
int8_t nITSclu = -1;
bool compatibleProton = false; // dE/dx compatibility with proton hypothesis (FIXME: use better, uint8_t compat mask?)
Expand Down Expand Up @@ -161,6 +162,7 @@ class SVertexer
bool acceptTrack(const GIndex gid, const o2::track::TrackParCov& trc) const;
bool processTPCTrack(const o2::tpc::TrackTPC& trTPC, GIndex gid, int vtxid);
float correctTPCTrack(TrackCand& trc, const o2::tpc::TrackTPC& tTPC, float tmus, float tmusErr) const;
float getTPCInnermostR(const o2::tpc::TrackTPC& tTPC, float tTB) const;

uint64_t getPairIdx(GIndex id1, GIndex id2) const
{
Expand Down
51 changes: 41 additions & 10 deletions Detectors/Vertexing/src/SVertexer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,17 @@ void SVertexer::buildT2V(const o2::globaltracking::RecoContainer& recoData) // a
bool isTPCloaded = recoData.isTrackSourceLoaded(GIndex::TPC);
bool isITSloaded = recoData.isTrackSourceLoaded(GIndex::ITS);
bool isITSTPCloaded = recoData.isTrackSourceLoaded(GIndex::ITSTPC);
mTPCClusterIdxStruct = nullptr;
if (isTPCloaded && !mSVParams->mExcludeTPCtracks) {
mTPCTracksArray = recoData.getTPCTracks();
mTPCTrackClusIdx = recoData.getTPCTracksClusterRefs();
mTPCClusterIdxStruct = &recoData.inputsTPCclusters->clusterIndex;
mTPCRefitterShMap = recoData.clusterShMapTPC;
mTPCRefitterOccMap = mRecoCont->occupancyMapTPC;
mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct, mTPCCorrMaps, o2::base::Propagator::Instance()->getNominalBz(), mTPCTrackClusIdx.data(), 0, mTPCRefitterShMap.data(), mTPCRefitterOccMap.data(), mTPCRefitterOccMap.size(), nullptr, o2::base::Propagator::Instance());
} else if (isTPCloaded && recoData.inputsTPCclusters) { // TPC-only tracks excluded: clusters still needed for the innermost radius of global tracks
mTPCTrackClusIdx = recoData.getTPCTracksClusterRefs();
mTPCClusterIdxStruct = &recoData.inputsTPCclusters->clusterIndex;
}

std::unordered_map<GIndex, std::pair<int, int>> tmap;
Expand Down Expand Up @@ -556,7 +560,14 @@ void SVertexer::buildT2V(const o2::globaltracking::RecoContainer& recoData) // a

int posneg = trc.getSign() < 0 ? 1 : 0;
float r = std::sqrt(trc.getX() * trc.getX() + trc.getY() * trc.getY());
mTracksPool[posneg].emplace_back(TrackCand{trc, tvid, {iv, iv}, r, hasTPC, nITSclu, compatibleWithProton});
mTracksPool[posneg].emplace_back(TrackCand{trc, tvid, {iv, iv}, r, -1.f, hasTPC, nITSclu, compatibleWithProton});
if (hasTPC && !itsGID.isIndexSet() && tvid.getSource() != GIndex::TPC && mTPCClusterIdxStruct && mTPCCorrMaps) {
// track with TPC but without ITS (e.g. TPC-TOF, TPC-TRD): its parameters are at the TPC inner reference (minR); the V0 must
// not lie beyond its innermost measured point, the innermost TPC cluster (transformed with the TPC track's time, the radius
// barely depends on it). Needs the TPC clusters, i.e. TPC among the vertexing sources. TPC-only tracks: in correctTPCTrack.
const auto& tpcTrack = recoData.getTPCTrack(tpcGID);
mTracksPool[posneg].back().rInnerUpdate = getTPCInnermostR(tpcTrack, tpcTrack.getTime0());
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not all TPC tracks w/o ITS? See below.

if (tvid.getSource() == GIndex::TPC) { // constrained TPC track?
correctTPCTrack(mTracksPool[posneg].back(), mTPCTracksArray[tvid], -1, -1);
}
Expand Down Expand Up @@ -648,9 +659,14 @@ bool SVertexer::checkV0(const TrackCand& seedP, const TrackCand& seedN, int iP,
return false;
}
float rv0 = std::sqrt(r2v0), drv0P = rv0 - seedP.minR, drv0N = rv0 - seedN.minR;
if (drv0P > mSVParams->causalityRTolerance || drv0P < -mSVParams->maxV0ToProngsRDiff ||
drv0N > mSVParams->causalityRTolerance || drv0N < -mSVParams->maxV0ToProngsRDiff) {
LOG(debug) << "RejCausality " << drv0P << " " << drv0N;
// upper side of the causality check: the V0 must not lie beyond the innermost measured point of a prong. The lower side
// (maxV0ToProngsRDiff) uses minR, for all tracks with TPC but without ITS the TPC inner reference: with the innermost cluster it
// would reject V0s whose TPC track misses its inner part.
const float drv0PUp = seedP.rInnerUpdate > 0.f ? rv0 - seedP.rInnerUpdate : drv0P;
const float drv0NUp = seedN.rInnerUpdate > 0.f ? rv0 - seedN.rInnerUpdate : drv0N;
if (drv0PUp > mSVParams->causalityRTolerance || drv0P < -mSVParams->maxV0ToProngsRDiff ||
drv0NUp > mSVParams->causalityRTolerance || drv0N < -mSVParams->maxV0ToProngsRDiff) {
LOG(debug) << "RejCausality " << drv0PUp << " " << drv0P << " " << drv0NUp << " " << drv0N;
return false;
}
const int cand = 0;
Expand Down Expand Up @@ -1308,7 +1324,7 @@ bool SVertexer::processTPCTrack(const o2::tpc::TrackTPC& trTPC, GIndex gid, int
}
}

auto& trLoc = mTracksPool[posneg].emplace_back(TrackCand{trTPC, gid, {vtxid, vtxid}, 0., true, -1, compatibleWithProton});
auto& trLoc = mTracksPool[posneg].emplace_back(TrackCand{trTPC, gid, {vtxid, vtxid}, 0., -1.f, true, -1, compatibleWithProton});
auto err = correctTPCTrack(trLoc, trTPC, twe.getTimeStamp(), twe.getTimeStampError());
if (err < 0) {
mTracksPool[posneg].pop_back(); // discard
Expand Down Expand Up @@ -1362,16 +1378,31 @@ float SVertexer::correctTPCTrack(SVertexer::TrackCand& trc, const o2::tpc::Track
// eventually should be refitted, at the moment we simply shift...
trc.setZ(tTPC.getZ() + (tTPC.hasASideClustersOnly() ? dDrift : -dDrift));
trc.setCov(trc.getSigmaZ2() + driftErr * driftErr, o2::track::kSigZ2);
uint8_t sector, row;
// as for the other tracks with TPC but without ITS: upper side of the V0 causality check at the innermost cluster, lower side at
// the TPC inner reference
trc.rInnerUpdate = getTPCInnermostR(tTPC, tTB);
trc.minR = o2::constants::geom::XTPCInnerRef;
return driftErr;
}

//______________________________________________
float SVertexer::getTPCInnermostR(const o2::tpc::TrackTPC& tTPC, float tTB) const
{
// radius of the innermost TPC cluster of the track, transformed with the time tTB [TPC time bins], at least the TPC inner
// reference radius
uint8_t sector;
uint8_t row;
auto cl = &tTPC.getCluster(mTPCTrackClusIdx, tTPC.getNClusters() - 1, *mTPCClusterIdxStruct, sector, row);
float x = 0, y = 0, z = 0;
float x = 0;
float y = 0;
float z = 0;
mTPCCorrMaps->Transform(sector, row, cl->getPad(), cl->getTime(), x, y, z, tTB);
if (x < o2::constants::geom::XTPCInnerRef) {
x = o2::constants::geom::XTPCInnerRef;
}
trc.minR = std::sqrt(x * x + y * y);
LOGP(debug, "set MinR = {} for row {}, x:{}, y:{}, z:{}", trc.minR, row, x, y, z);
return driftErr;
const float r = std::sqrt(x * x + y * y);
LOGP(debug, "innermost TPC cluster R = {} for row {}, x:{}, y:{}, z:{}", r, row, x, y, z);
return r;
}

//______________________________________________
Expand Down
Loading