40#include "GPUParam.inc"
64 return param::RowX[
row];
72 ROOT::Math::Impl::Transform3D<double>::Point local{geo->cdrHght() - 0.5 - 0.279, 0., 0.};
73 return (geo->getMatrixT2L(
channel) ^ local).X();
78 float pos[3] = {0.f, 0.f, 0.f};
84 LOGP(fatal,
"Did not recognize detector type: row:{}, sec:{}, channel:{}",
row,
sec,
channel);
91 LOGP(warn,
"geometry initialization was not done, doing this for the current timestamp");
94 LOGP(fatal,
"geometry initialization failed");
102 LOGP(warn,
"Initialization was already done");
109 geoTRD->createPadPlaneArray();
110 geoTRD->createClusterMatrixArray();
130 LOG(info) <<
"Start initializing TrackInterpolation";
132 LOG(
error) <<
"Initialization already performed.";
137 mTPCTimeBinMUS = elParam.ZbinWidth;
142 mRecoParam.
init(mBz);
146 mSourcesConfigured =
src;
147 mSourcesConfiguredMap = srcMap;
148 mSingleSourcesConfigured = (mSourcesConfigured == mSourcesConfiguredMap);
155 geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
159 std::string dbgnm = mNLanes == 1 ?
"track_interpolation_dbg.root" : fmt::format(
"track_interpolation_dbg_{}.root", mLaneID);
160 mDBGOut = std::make_unique<o2::utils::TreeStreamRedirector>(dbgnm.c_str(),
"recreate");
164 LOGP(info,
"Done initializing TrackInterpolation. Configured track input: {}. Track input specifically for map: {}",
170 LOGP(
debug,
"Check if input track {} is accepted", gid.
asString());
172 if (!hasOuterPoint && !mProcessITSTPConly) {
186 if (itsTrk.getChi2() / itsTrk.getNumberOfClusters() > mParams->
maxITSChi2 || tpcTrk.getChi2() / tpcTrk.getNClusterReferences() > mParams->
maxTPCChi2) {
189 if (!hasOuterPoint) {
198 if (itsTrk.getNumberOfClusters() < mParams->
minITSNCls || tpcTrk.getNClusterReferences() < mParams->
minTPCNCls) {
206 if (!prop->propagateToDCA(pv, trc, prop->getNominalBz(), 2., o2::base::PropagatorF::MatCorrType::USEMatCorrLUT, &dca)) {
241 uint32_t countSeedCandidates[4] = {0};
245 int nv = vtxRefs.size() - 1;
249 mITSRefitSeedID.resize(mRecoCont->
getITSTracks().size(), -1);
252 for (
int iv = 0; iv < nv; iv++) {
253 LOGP(
debug,
"processing PV {} of {}", iv, nv);
255 const auto& vtref = vtxRefs[iv];
260 for (
uint32_t is = 0; is < SrcFast.size() && !usePV; is++) {
261 int src = SrcFast[is], idMin = vtref.getFirstEntryOfSource(
src), idMax = idMin + vtref.getEntriesOfSource(
src);
262 for (
int i = idMin;
i < idMax;
i++) {
275 if (!allowedSources[is]) {
278 LOGP(
debug,
"Checking source {}", is);
279 int idMin = vtref.getFirstEntryOfSource(is), idMax = idMin + vtref.getEntriesOfSource(is);
280 for (
int i = idMin;
i < idMax;
i++) {
281 auto vid = trackIndex[
i];
286 if (vid.isAmbiguous()) {
290 if (!mSourcesConfigured[is]) {
300 ++countSeedCandidates[mTrackTypes[vid.getSource()]];
301 LOGP(
debug,
"Checking vid {}", vid.asString());
306 mSeeds.back().setPID(mRecoCont->
getTrackParam(vidOrig).getPID(),
true);
307 mGIDs.push_back(vid);
308 mGIDtables.push_back(gidTable);
309 mTrackTimes.push_back(pv.getTimeStamp().getTimeStamp());
310 mTrackIndices[mTrackTypes[vid.getSource()]].push_back(nTrackSeeds++);
311 mTrackPVID.push_back(iv);
316 LOGP(info,
"Created {} seeds. {} out of {} ITS-TPC-TRD-TOF, {} out of {} ITS-TPC-TRD, {} out of {} ITS-TPC-TOF, {} out of {} ITS-TPC",
326 std::random_device
rd;
327 std::mt19937
g(
rd());
328 std::uniform_real_distribution<>
distr(0., 1.);
337 LOG(
error) <<
"Initialization not yet done. Aborting...";
346 mNTPCOccBinLength = mTPCParam->rec.tpc.occupancyMapTimeBins;
347 mNTPCOccBinLengthInv = 1.f / mNTPCOccBinLength;
350 LOG(
error) <<
"No ITS dictionary available";
355 mITSClustersArray.
init(nLr);
356 for (
int lr = 0; lr < nLr; lr++) {
360 auto pattIt = patterns.begin();
361 mITSClustersArray.
getClusters().reserve(mITSClustersArray.
size() + clusITS.size());
362 LOGP(info,
"We have {} ITS clusters and the number of patterns is {} on the layer slot {}", clusITS.size(), patterns.size(), lr);
372 std::random_device
rd;
373 std::mt19937
g(
rd());
374 std::vector<uint32_t> trackIndices;
383 int nSeeds = mSeeds.size(), lastChecked = 0;
385 mParentID.resize(nSeeds, -1);
387 int maxOutputTracks = (mMaxTracksPerTF >= 0) ? mMaxTracksPerTF + mAddTracksForMapPerTF : nSeeds;
388 mTrackData.reserve(maxOutputTracks);
389 mClRes.reserve(maxOutputTracks * param::NPadRows);
390 mDetInfoRes.reserve(maxOutputTracks * param::NPadRows);
391 bool maxTracksReached =
false;
392 for (
int iSeed = 0; iSeed < nSeeds; ++iSeed) {
393 if (mMaxTracksPerTF >= 0 && mTrackDataCompact.size() >= mMaxTracksPerTF + mAddTracksForMapPerTF) {
394 LOG(info) <<
"Maximum number of tracks per TF reached. Skipping the remaining " << nSeeds - iSeed <<
" tracks.";
397 int seedIndex = trackIndices[iSeed];
402 this->mGIDs.push_back(this->mGIDtables[seedIndex][
src]);
404 this->mTrackTimes.push_back(this->mTrackTimes[seedIndex]);
405 this->mSeeds.push_back(this->mSeeds[seedIndex]);
406 this->mParentID.push_back(seedIndex);
407 this->mTrackPVID.push_back(this->mTrackPVID[seedIndex]);
411 if (!mSingleSourcesConfigured && !mSourcesConfiguredMap[mGIDs[seedIndex].getSource()]) {
418 if (mMaxTracksPerTF >= 0 && mTrackDataCompact.size() >= mMaxTracksPerTF) {
419 if (!maxTracksReached) {
420 LOGP(info,
"We already have reached mMaxTracksPerTF={}, but we continue to create seeds until mAddTracksForMapPerTF={} is also reached, iSeed: {} of {} inital seeds", mMaxTracksPerTF, mAddTracksForMapPerTF, iSeed, nSeeds);
422 maxTracksReached =
true;
425 if (mGIDs[seedIndex].includesDet(DetID::TRD) || mGIDs[seedIndex].includesDet(DetID::TOF)) {
427 LOGP(
debug,
"interpolateTrack {} {}, accepted: {}", iSeed,
GTrackID::getSourceName(mGIDs[seedIndex].getSource()), mTrackDataCompact.size());
429 if (mGIDs[seedIndex].includesDet(DetID::TRD) && mGIDs[seedIndex].includesDet(DetID::TOF) && !partsAdded[
GTrackID::ITSTPCTRD]) {
438 LOGP(
debug,
"extrapolateTrack {} {}, accepted: {}", iSeed,
GTrackID::getSourceName(mGIDs[seedIndex].getSource()), mTrackDataCompact.size());
442 std::vector<int> remSeeds;
443 if (mSeeds.size() > ++lastChecked) {
444 remSeeds.resize(mSeeds.size() - lastChecked);
445 std::iota(remSeeds.begin(), remSeeds.end(), lastChecked);
446 std::shuffle(remSeeds.begin(), remSeeds.end(),
g);
447 LOGP(info,
"Up to {} tracks out of {} additional seeds will be processed in random order, of which {} are stripped versions, accepted seeds: {}",
448 mAddTracksForMapPerTF > 0 ? mAddTracksForMapPerTF : remSeeds.size(),
449 remSeeds.size(), mSeeds.size() - nSeeds, mTrackDataCompact.size());
451 int extraChecked = 0;
452 for (
int iSeed : remSeeds) {
453 if (mAddTracksForMapPerTF > 0 && mTrackDataCompact.size() >= mMaxTracksPerTF + mAddTracksForMapPerTF) {
454 LOGP(info,
"Maximum number {} of additional tracks per TF reached. Skipping the remaining {} tracks", mAddTracksForMapPerTF, remSeeds.size() - extraChecked);
458 if (mGIDs[iSeed].includesDet(DetID::TRD) || mGIDs[iSeed].includesDet(DetID::TOF)) {
460 LOGP(
debug,
"extra check {} of {}, seed {} interpolateTrack {}, used: {}", extraChecked, remSeeds.size(), iSeed,
GTrackID::getSourceName(mGIDs[iSeed].getSource()), mTrackDataCompact.size());
462 LOGP(
debug,
"extra check {} of {}, seed {} extrapolateTrack {}, used: {}", extraChecked, remSeeds.size(), iSeed,
GTrackID::getSourceName(mGIDs[iSeed].getSource()), mTrackDataCompact.size());
466 LOGP(info,
"Could process {} tracks successfully ({} rejected in refits, {} in propagation, {} as loopers), {} residuals were rejected, {} accepted",
467 mTrackData.size(), mNRejRefit, mNRejProp, mNRejLoop, mRejectedResiduals, mClRes.size());
469 LOGP(info,
"keepClustersOnPropFail: {} tracks kept after a propagation failure, {} position-only TPC clusters stored", mNPosOnlyTracks, mNPosOnlyClusters);
472 mNPosOnlyClusters = 0;
473 mRejectedResiduals = 0;
482struct PositionOnlyCluster {
490 LOGP(
debug,
"Starting track interpolation for GID {}", mGIDs[iSeed].
asString());
494 std::unique_ptr<TrackDataExtended> trackDataExtended;
495 std::vector<TPCClusterResiduals> clusterResiduals;
497 const auto& gidTable = mGIDtables[iSeed];
500 if (mDumpTrackPoints) {
501 trackDataExtended = std::make_unique<TrackDataExtended>();
502 (*trackDataExtended).gid = mGIDs[iSeed];
503 (*trackDataExtended).clIdx.setFirstEntry(mClRes.size());
504 (*trackDataExtended).trkITS = trkITS;
505 (*trackDataExtended).trkTPC = trkTPC;
506 auto nCl = trkITS.getNumberOfClusters();
507 auto clEntry = trkITS.getFirstClusterEntry();
508 for (
int iCl = nCl - 1; iCl >= 0; iCl--) {
509 const auto& clsITS = mITSClustersArray[mITSTrackClusIdx[clEntry + iCl]];
510 (*trackDataExtended).clsITS.push_back(clsITS);
517 trackData.
gid = mGIDs[iSeed];
518 trackData.
par = mSeeds[iSeed];
519 auto trkWork = mSeeds[iSeed];
522 for (
auto& elem : mCache) {
523 elem.clAvailable = 0;
525 trackData.
clIdx.setFirstEntry(mClRes.size());
526 float clusterTimeBinOffset = mTrackTimes[iSeed] / mTPCTimeBinMUS;
529 std::array<std::pair<uint16_t, uint16_t>, constants::MAXGLOBALPADROW> mCacheDEDX{};
530 std::array<short, constants::MAXGLOBALPADROW> multBins{};
533 bool allLost =
false;
534 std::array<bool, constants::MAXGLOBALPADROW> refOut{}, refIn{};
535 std::vector<PositionOnlyCluster> posOnly;
536 for (
int iCl = trkTPC.getNClusterReferences(); iCl--;) {
539 trkTPC.getClusterReference(mTPCTrackClusIdx, iCl,
sector,
row, clusterIndexInRow);
541 const auto& clTPC = mTPCClusterIdxStruct->
clustersLinear[absoluteIndex];
543 std::array<float, 2> clTPCYZ;
544 mFastTransform->TransformIdeal(
sector,
row, clTPC.getPad(), clTPC.getTime(), clTPCX, clTPCYZ[0], clTPCYZ[1], clusterTimeBinOffset);
546 mCache[
row].clAvailable = 1;
547 mCache[
row].clY = clTPCYZ[0];
548 mCache[
row].clZ = clTPCYZ[1];
550 mCache[
row].clFlags = clTPC.getFlags();
554 mCacheDEDX[
row].first = std::min<uint16_t>(clTPC.getQtot(), UINT16_MAX);
555 mCacheDEDX[
row].second = clTPC.getQmax();
556 int imb = int(clTPC.getTime() * mNTPCOccBinLengthInv);
557 if (imb < mTPCParam->occupancyMapSize) {
558 multBins[
row] = 1 + std::max(0, imb);
563 for (
int iRow = 0; iRow < param::NPadRows; ++iRow) {
564 if (!mCache[iRow].clAvailable) {
567 if (!trkWork.rotate(mCache[iRow].clAngle) || !propagator->PropagateToXBxByBz(trkWork, param::RowX[iRow], mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
568 LOG(
debug) <<
"Failed on first extrapolation";
577 mCache[iRow].y[
ExtOut] = trkWork.getY();
578 mCache[iRow].z[
ExtOut] = trkWork.getZ();
579 mCache[iRow].sy2[
ExtOut] = trkWork.getSigmaY2();
580 mCache[iRow].szy[
ExtOut] = trkWork.getSigmaZY();
581 mCache[iRow].sz2[
ExtOut] = trkWork.getSigmaZ2();
582 mCache[iRow].snp[
ExtOut] = trkWork.getSnp();
588 LOG(
debug) <<
"TOF point available";
590 if (mDumpTrackPoints) {
591 (*trackDataExtended).clsTOF = clTOF;
592 (*trackDataExtended).matchTOF = mRecoCont->
getTOFMatch(mGIDs[iSeed]);
594 const int clTOFSec = clTOF.getCount();
596 float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
597 if (!clTOF.isInNominalSector()) {
600 std::array<float, 2> clTOFYZ{clTOFxyz[1], clTOFxyz[2]};
603 if (!trkWork.rotate(clTOFAlpha) || !propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->
maxSnp, mParams->
maxStep, mMatCorr) || !trkWork.update(clTOFYZ, clTOFCov)) {
604 LOG(
debug) <<
"Failed to rotate/propagate/update the extrapolated ITS track at the TOF cluster";
615 if (mDumpTrackPoints) {
616 (*trackDataExtended).trkTRD = trkTRD;
618 for (
int iLayer = o2::trd::constants::NLAYER - 1; iLayer >= 0; --iLayer) {
619 std::array<float, 2> trkltTRDYZ{};
620 std::array<float, 3> trkltTRDCov{};
625 if (
res < -1 || !trkWork.update(trkltTRDYZ, trkltTRDCov)) {
626 LOG(
debug) <<
"Failed to reach or update the track at TRD layer " << iLayer;
639 if (mDumpTrackPoints) {
640 (*trackDataExtended).trkOuter = trkWork;
642 auto trkOuter = trkWork;
645 bool outerParamStored =
false;
646 for (
int iRow = param::NPadRows; !allLost && iRow--;) {
647 if (!mCache[iRow].clAvailable) {
650 if (mProcessSeeds && !outerParamStored) {
656 trackData.
par = trkWork;
657 outerParamStored =
true;
659 if (!trkWork.rotate(mCache[iRow].clAngle) || !propagator->PropagateToXBxByBz(trkWork, param::RowX[iRow], mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
660 LOG(
debug) <<
"Failed on back propagation";
668 mCache[iRow].y[
ExtIn] = trkWork.getY();
669 mCache[iRow].z[
ExtIn] = trkWork.getZ();
670 mCache[iRow].sy2[
ExtIn] = trkWork.getSigmaY2();
671 mCache[iRow].szy[
ExtIn] = trkWork.getSigmaZY();
672 mCache[iRow].sz2[
ExtIn] = trkWork.getSigmaZ2();
673 mCache[iRow].snp[
ExtIn] = trkWork.getSnp();
677 unsigned short deltaRow = 0;
678 for (
int iRow = 0; iRow < param::NPadRows; ++iRow) {
679 if (!mCache[iRow].clAvailable) {
683 if (!refOut[iRow] || !refIn[iRow]) {
684 posOnly.push_back({mCache[iRow].clY, mCache[iRow].clZ, mCache[iRow].clSec, (
unsigned char)iRow, mCache[iRow].clFlags});
688 float wTotY = 1.f / mCache[iRow].sy2[
ExtOut] + 1.f / mCache[iRow].sy2[
ExtIn];
689 float wTotZ = 1.f / mCache[iRow].sz2[
ExtOut] + 1.f / mCache[iRow].sz2[
ExtIn];
690 mCache[iRow].y[
Int] = (mCache[iRow].y[
ExtOut] / mCache[iRow].sy2[
ExtOut] + mCache[iRow].y[
ExtIn] / mCache[iRow].sy2[
ExtIn]) / wTotY;
691 mCache[iRow].z[
Int] = (mCache[iRow].z[
ExtOut] / mCache[iRow].sz2[
ExtOut] + mCache[iRow].z[
ExtIn] / mCache[iRow].sz2[
ExtIn]) / wTotZ;
694 mCache[iRow].snp[
Int] = (mCache[iRow].snp[
ExtOut] + mCache[iRow].snp[
ExtIn]) / 2.f;
696 const auto dY = mCache[iRow].clY - mCache[iRow].y[
Int];
697 const auto dZ = mCache[iRow].clZ - mCache[iRow].z[
Int];
698 const auto y = mCache[iRow].y[
Int];
699 const auto z = mCache[iRow].z[
Int];
700 const auto snp = mCache[iRow].snp[
Int];
701 const auto sec = mCache[iRow].clSec;
702 clusterResiduals.emplace_back(dY, dZ,
y,
z, snp, sec, deltaRow, mCache[iRow].clFlags);
707 trackData.
chi2TPC = trkTPC.getChi2();
708 trackData.
chi2ITS = trkITS.getChi2();
709 trackData.
nClsTPC = trkTPC.getNClusterReferences();
710 trackData.
nClsITS = trkITS.getNumberOfClusters();
713 double t0forTOF = 0.;
714 float t0forTOFwithinBC = 0.f;
715 float t0forTOFres = 9999.f;
718 const auto& tofMatch = mRecoCont->
getTOFMatch(mGIDs[iSeed]);
722 t0forTOFres = tofMatch.getFT0BestRes();
723 trackData.
deltaTOF = tofMatch.getSignal() - t0forTOF - tofMatch.getLTIntegralOut().getTOF(trkTPC.getPID().getID());
728 trackData.
dEdxTPC = trkTPC.getdEdx().dEdxTotTPC;
730 mTrackValidation.
clear();
736 int nClValidated = 0;
740 auto flushPosOnly = [&](
int rowLimit) {
741 for (; iPosOnly < posOnly.size() && posOnly[iPosOnly].row < rowLimit; ++iPosOnly) {
742 const auto& pc = posOnly[iPosOnly];
743 if (std::abs(pc.y) < param::MaxY && std::abs(pc.z) < param::MaxZ) {
744 mClRes.emplace_back(0.f, 0.f, 0.f, pc.y, pc.z, pc.row, pc.sec, pc.flags,
false);
746 mDetInfoRes.emplace_back().setTPC(mCacheDEDX[pc.row].first, mCacheDEDX[pc.row].second);
750 ++mRejectedResiduals;
754 for (
unsigned int iCl = 0; iCl < clusterResiduals.size(); ++iCl) {
755 iRow += clusterResiduals[iCl].dRow;
761 const float tgPhi = clusterResiduals[iCl].snp / std::sqrt((1.f - clusterResiduals[iCl].snp) * (1.f + clusterResiduals[iCl].snp));
762 const auto dy = clusterResiduals[iCl].dy;
763 const auto dz = clusterResiduals[iCl].dz;
764 const auto y = clusterResiduals[iCl].y;
765 const auto z = clusterResiduals[iCl].z;
766 const auto sec = clusterResiduals[iCl].sec;
767 const short flags = clusterResiduals[iCl].flags;
769 const bool tgPhiOK = (std::abs(tgPhi) < param::MaxTgSlp) || mParams->
clampTgSlp;
770 const float tgPhiStore = std::clamp(tgPhi, -param::MaxTgSlp, param::MaxTgSlp);
771 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(
y) < param::MaxY) && (std::abs(
z) < param::MaxZ) && tgPhiOK) {
772 mClRes.emplace_back(dy, dz, tgPhiStore,
y,
z, iRow, sec,
flags, rej);
773 mDetInfoRes.emplace_back().setTPC(mCacheDEDX[iRow].
first, mCacheDEDX[iRow].second);
776 ++mRejectedResiduals;
779 flushPosOnly(constants::MAXGLOBALPADROW);
780 if (!posOnly.empty()) {
783 trackData.
clIdx.setEntries(nClValidated);
786 for (
int ist = 0; ist < NSTACKS; ist++) {
787 int mltBinMin = 0x7ffff, mltBinMax = -1, prevBin = -1;
788 for (
int ir = STACKROWS[ist];
ir < STACKROWS[ist + 1];
ir++) {
789 if (multBins[
ir] != prevBin && multBins[
ir] > 0) {
790 prevBin = multBins[
ir];
791 if (multBins[
ir] > mltBinMax) {
792 mltBinMax = multBins[
ir];
794 if (multBins[
ir] < mltBinMin) {
795 mltBinMin = multBins[
ir];
799 if (--mltBinMin >= 0) {
801 for (
int ib = mltBinMin; ib < mltBinMax; ib++) {
802 avMlt += mTPCParam->occupancyMap[ib];
804 avMlt /= (mltBinMax - mltBinMin);
809 bool stopPropagation = !mExtDetResid;
811 if (!stopPropagation) {
817 for (
int iLayer = 0; iLayer < o2::trd::constants::NLAYER; iLayer++) {
818 std::array<float, 2> trkltTRDYZ{};
819 int res =
processTRDLayer(trkTRD, iLayer, trkWork, &trkltTRDYZ,
nullptr, &trackData, &trkl64, &trklCalib);
824 stopPropagation =
true;
828 float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
829 auto dy = trkltTRDYZ[0] - trkWork.getY();
830 auto dz = trkltTRDYZ[1] - trkWork.getZ();
831 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
833 mDetInfoRes.emplace_back().setTRD(trkl64.getQ0(), trkl64.getQ1(), trkl64.getQ2(), trklCalib.getDy());
840 while (!allLost && gidTable[
GTrackID::TOF].isIndexSet() && !stopPropagation) {
842 float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
843 if (!clTOF.isInNominalSector()) {
847 if (trkWork.getAlpha() != clTOFAlpha && !trkWork.rotate(clTOFAlpha)) {
848 LOG(
debug) <<
"Failed to rotate into TOF cluster sector frame";
849 stopPropagation =
true;
852 if (!propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
853 LOG(
debug) <<
"Failed final propagation to TOF radius";
857 float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
858 auto dy = clTOFxyz[1] - trkWork.getY();
859 auto dz = clTOFxyz[2] - trkWork.getZ();
862 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
863 mClRes.emplace_back(dy, dz, tgPhi, trkWork.getY(), trkWork.getZ(), 170, clTOF.getCount(), clTOF.getPadInSector());
866 LOGP(fatal,
"ITS-TPC seed index is not set for TOF track");
868 float tdif =
static_cast<float>(clTOF.getTime() - t0forTOF);
869 mDetInfoRes.emplace_back().setTOF(tdif * 1
e-6);
876 while (!stopPropagation) {
877 auto& trkWorkITS = trkInner;
878 auto nCl = trkITS.getNumberOfClusters();
879 auto clEntry = trkITS.getFirstClusterEntry();
881 for (
int iCl = 0; iCl < nCl; iCl++) {
882 const auto& cls = mITSClustersArray[mITSTrackClusIdx[clEntry + iCl]];
883 int chip = cls.getSensorID();
884 float chipX, chipAlpha;
885 geom->getSensorXAlphaRefPlane(cls.getSensorID(), chipX, chipAlpha);
886 if (!trkWorkITS.rotate(chipAlpha) || !propagator->PropagateToXBxByBz(trkWorkITS, chipX, mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
887 LOGP(
debug,
"Failed final propagation to ITS X={} alpha={}", chipX, chipAlpha);
888 stopPropagation =
true;
891 float tgPhi = trkWorkITS.getSnp() / std::sqrt((1.f - trkWorkITS.getSnp()) * (1.f + trkWorkITS.getSnp()));
892 auto dy = cls.getY() - trkWorkITS.getY();
893 auto dz = cls.getZ() - trkWorkITS.getZ();
894 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
895 mClRes.emplace_back(dy, dz, tgPhi, trkWorkITS.getY(), trkWorkITS.getZ(), 180 + geom->getLayer(cls.getSensorID()), -1, cls.getSensorID());
896 mDetInfoRes.emplace_back();
900 if (!stopPropagation) {
903 if (!propagator->propagateToDCA(vtx, trkWorkITS, mBz, mParams->
maxStep, mMatCorr)) {
904 LOGP(
debug,
"Failed propagation to DCA to PV ({} {} {}), {}", pv.getX(), pv.getY(), pv.getZ(), trkWorkITS.asString());
905 stopPropagation =
true;
909 float sn, cs,
alpha = trkWorkITS.getAlpha();
910 math_utils::detail::bringToPMPi(
alpha);
911 math_utils::detail::sincos<float>(
alpha, sn, cs);
912 float xv = vtx.X() * cs + vtx.Y() * sn, yv = -vtx.X() * sn + vtx.Y() * cs, zv = vtx.Z();
913 auto dy = yv - trkWorkITS.getY();
914 auto dz = zv - trkWorkITS.getZ();
915 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && std::abs(xv) < param::MaxVtxX) {
917 mClRes.emplace_back(dy, dz,
alpha / TMath::Pi(), trkWorkITS.getY(), trkWorkITS.getZ(), 190, -1, compXV);
919 LOGP(fatal,
"ITS-TPC seed index is not set for TOF track");
922 mDetInfoRes.emplace_back().setPV(tdif);
930 mGIDsSuccess.push_back(mGIDs[iSeed]);
931 mTRDGIDsSuccess.push_back(gidTRDUsed);
933 mTrackData.push_back(std::move(trackData));
935 if (mDumpTrackPoints) {
936 (*trackDataExtended).clIdx.setEntries(nClValidated);
937 (*trackDataExtended).nExtDetResid = trackData.
nExtDetResid;
938 (*trackDataExtended).filterFlag = trackData.
filterFlag;
939 mTrackDataExtended.push_back(std::move(*trackDataExtended));
943 (*mDBGOut) <<
"valdata" <<
"params=" << mTrackValidation <<
"trackData=" << (stored ? mTrackData.back() : trackData) <<
"\n";
948 std::array<float, 2>* trkltTRDYZ, std::array<float, 3>* trkltTRDCov,
TrackData* trkData,
952 int trkltIdx = trkTRD.getTrackletIndex(iLayer);
958 auto trkltDet = trdTrklt.getDetector();
959 auto trkltSec = trkltDet / (o2::trd::constants::NLAYER * o2::trd::constants::NSTACK);
962 LOG(
debug) <<
"Track could not be rotated in TRD tracklet coordinate system in layer " << iLayer;
967 LOG(
debug) <<
"Failed propagation to TRD layer " << iLayer;
971 const auto* pad = mGeoTRD->getPadPlane(trkltDet);
972 float tilt =
tan(TMath::DegToRad() * pad->getTiltingAngle());
973 float tiltCorrUp = tilt * (trdSP.getZ() - trkWork.getZ());
974 float zPosCorrUp = trdSP.getZ() + mRecoParam.getZCorrCoeffNRC() * trkWork.getTgl();
975 float padLength = pad->getRowSize(trdTrklt.getPadRow());
976 if (!((trkWork.getSigmaZ2() < (padLength * padLength / 12.f)) && (std::abs(trdSP.getZ() - trkWork.getZ()) < padLength))) {
979 (*trkltTRDYZ)[0] = trdSP.getY() - tiltCorrUp;
980 (*trkltTRDYZ)[1] = zPosCorrUp;
982 mRecoParam.recalcTrkltCov(tilt, trkWork.getSnp(), pad->getRowSize(trdTrklt.getPadRow()), *trkltTRDCov);
986 auto slope = trdSP.getDy();
987 if (std::abs(
slope) < param::MaxTRDSlope) {
1003 LOGP(
debug,
"Starting track extrapolation for GID {}", mGIDs[iSeed].
asString());
1004 const auto& gidTable = mGIDtables[iSeed];
1008 std::unique_ptr<TrackDataExtended> trackDataExtended;
1009 std::vector<TPCClusterResiduals> clusterResiduals;
1010 trackData.
clIdx.setFirstEntry(mClRes.size());
1013 if (mDumpTrackPoints) {
1014 trackDataExtended = std::make_unique<TrackDataExtended>();
1015 (*trackDataExtended).gid = mGIDs[iSeed];
1016 (*trackDataExtended).clIdx.setFirstEntry(mClRes.size());
1017 (*trackDataExtended).trkITS = trkITS;
1018 (*trackDataExtended).trkTPC = trkTPC;
1019 auto nCl = trkITS.getNumberOfClusters();
1020 auto clEntry = trkITS.getFirstClusterEntry();
1021 for (
int iCl = nCl - 1; iCl >= 0; iCl--) {
1022 const auto& clsITS = mITSClustersArray[mITSTrackClusIdx[clEntry + iCl]];
1023 (*trackDataExtended).clsITS.push_back(clsITS);
1030 trackData.
gid = mGIDs[iSeed];
1031 trackData.
par = mSeeds[iSeed];
1033 auto trkWork = mSeeds[iSeed];
1034 float clusterTimeBinOffset = mTrackTimes[iSeed] / mTPCTimeBinMUS;
1036 unsigned short rowPrev = 0;
1037 unsigned short nMeasurements = 0;
1038 uint8_t clRowPrev = constants::MAXGLOBALPADROW;
1039 std::array<std::pair<uint16_t, uint16_t>, constants::MAXGLOBALPADROW> mCacheDEDX{};
1040 std::array<short, constants::MAXGLOBALPADROW> multBins{};
1041 bool refLost =
false;
1042 std::vector<PositionOnlyCluster> posOnly;
1043 for (
int iCl = trkTPC.getNClusterReferences(); iCl--;) {
1046 trkTPC.getClusterReference(mTPCTrackClusIdx, iCl,
sector,
row, clusterIndexInRow);
1048 const auto& cl = mTPCClusterIdxStruct->
clustersLinear[absoluteIndex];
1049 if (clRowPrev ==
row) {
1052 }
else if (clRowPrev < constants::MAXGLOBALPADROW && clRowPrev >
row) {
1054 LOGP(
debug,
"TPC track with pT={} GeV and {} clusters has cluster {} on row {} while the previous cluster was on row {}",
1055 mSeeds[iSeed].getPt(), trkTPC.getNClusterReferences(), iCl,
row, clRowPrev);
1062 float x = 0,
y = 0,
z = 0;
1063 mFastTransform->TransformIdeal(
sector,
row, cl.getPad(), cl.getTime(),
x,
y,
z, clusterTimeBinOffset);
1064 unsigned char flags = cl.getFlags();
1075 mCacheDEDX[
row].first = cl.getQtot();
1076 mCacheDEDX[
row].second = cl.getQmax();
1080 const auto dY =
y - trkWork.getY();
1081 const auto dZ =
z - trkWork.getZ();
1082 const auto ty = trkWork.getY();
1083 const auto tz = trkWork.getZ();
1084 const auto snp = trkWork.getSnp();
1086 clusterResiduals.emplace_back(dY, dZ, ty, tz, snp, sec,
row - rowPrev,
flags);
1089 int imb = int(cl.getTime() * mNTPCOccBinLengthInv);
1090 if (imb < mTPCParam->occupancyMapSize) {
1091 multBins[
row] = 1 + std::max(0, imb);
1096 mTrackValidation.
clear();
1097 if (clusterResiduals.size() > constants::MAXGLOBALPADROW) {
1098 LOGP(warn,
"Extrapolated ITS-TPC track and found more residuals than possible ({})", clusterResiduals.size());
1103 trackData.
chi2TPC = trkTPC.getChi2();
1104 trackData.
chi2ITS = trkITS.getChi2();
1105 trackData.
nClsTPC = trkTPC.getNClusterReferences();
1106 trackData.
nClsITS = trkITS.getNumberOfClusters();
1107 trackData.
clIdx.setEntries(nMeasurements);
1108 trackData.
dEdxTPC = trkTPC.getdEdx().dEdxTotTPC;
1109 if (mDumpTrackPoints) {
1110 (*trackDataExtended).trkOuter = trkWork;
1113 bool stored =
false;
1117 int nClValidated = 0, iRow = 0;
1118 unsigned int iCl = 0;
1120 size_t iPosOnly = 0;
1121 auto flushPosOnly = [&](
int rowLimit) {
1122 for (; iPosOnly < posOnly.size() && posOnly[iPosOnly].row < rowLimit; ++iPosOnly) {
1123 const auto& pc = posOnly[iPosOnly];
1124 if (std::abs(pc.y) < param::MaxY && std::abs(pc.z) < param::MaxZ) {
1125 mClRes.emplace_back(0.f, 0.f, 0.f, pc.y, pc.z, pc.row, pc.sec, pc.flags,
false);
1127 mDetInfoRes.emplace_back().setTPC(mCacheDEDX[pc.row].first, mCacheDEDX[pc.row].second);
1129 ++mNPosOnlyClusters;
1131 ++mRejectedResiduals;
1135 for (iCl = 0; iCl < clusterResiduals.size(); ++iCl) {
1136 iRow += clusterResiduals[iCl].dRow;
1138 if (iRow >= param::NPadRows) {
1145 const float tgPhi = clusterResiduals[iCl].snp / std::sqrt((1.f - clusterResiduals[iCl].snp) * (1.f + clusterResiduals[iCl].snp));
1146 const auto dy = clusterResiduals[iCl].dy;
1147 const auto dz = clusterResiduals[iCl].dz;
1148 const auto y = clusterResiduals[iCl].y;
1149 const auto z = clusterResiduals[iCl].z;
1150 const short flags = clusterResiduals[iCl].flags;
1152 const bool tgPhiOK = (std::abs(tgPhi) < param::MaxTgSlp) || mParams->
clampTgSlp;
1153 const float tgPhiStore = std::clamp(tgPhi, -param::MaxTgSlp, param::MaxTgSlp);
1154 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(
y) < param::MaxY) && (std::abs(
z) < param::MaxZ) && tgPhiOK) {
1155 mClRes.emplace_back(dy, dz, tgPhiStore,
y,
z, iRow, clusterResiduals[iCl].sec,
flags, rej);
1156 mDetInfoRes.emplace_back().setTPC(mCacheDEDX[iRow].
first, mCacheDEDX[iRow].second);
1159 ++mRejectedResiduals;
1162 flushPosOnly(constants::MAXGLOBALPADROW);
1163 if (!posOnly.empty()) {
1166 trackData.
clIdx.setEntries(nClValidated);
1169 for (
int ist = 0; ist < NSTACKS; ist++) {
1170 int mltBinMin = 0x7ffff, mltBinMax = -1, prevBin = -1;
1171 for (
int ir = STACKROWS[ist];
ir < STACKROWS[ist + 1];
ir++) {
1172 if (multBins[
ir] != prevBin && multBins[
ir] > 0) {
1173 prevBin = multBins[
ir];
1174 if (multBins[
ir] > mltBinMax) {
1175 mltBinMax = multBins[
ir];
1177 if (multBins[
ir] < mltBinMin) {
1178 mltBinMin = multBins[
ir];
1182 if (--mltBinMin >= 0) {
1184 for (
int ib = mltBinMin; ib < mltBinMax; ib++) {
1185 avMlt += mTPCParam->occupancyMap[ib];
1187 avMlt /= (mltBinMax - mltBinMin);
1192 bool stopPropagation = !mExtDetResid;
1194 if (!stopPropagation) {
1196 int iSeedFull = mParentID[iSeed] == -1 ? iSeed : mParentID[iSeed];
1197 auto gidFull = mGIDs[iSeedFull];
1198 const auto& gidTableFull = mGIDtables[iSeedFull];
1202 trackData.
nTrkltsTRD = trkTRD.getNtracklets();
1203 trackData.
chi2TRD = trkTRD.getChi2();
1204 for (
int iLayer = 0; iLayer < o2::trd::constants::NLAYER; iLayer++) {
1205 std::array<float, 2> trkltTRDYZ{};
1206 int res =
processTRDLayer(trkTRD, iLayer, trkWork, &trkltTRDYZ,
nullptr, &trackData, &trkl64, &trklCalib);
1211 stopPropagation =
true;
1215 float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
1216 auto dy = trkltTRDYZ[0] - trkWork.getY();
1217 auto dz = trkltTRDYZ[1] - trkWork.getZ();
1218 const auto sec = clusterResiduals[iCl].sec;
1219 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
1221 mDetInfoRes.emplace_back().setTRD(trkl64.getQ0(), trkl64.getQ1(), trkl64.getQ2(), trklCalib.getDy());
1229 while (!refLost && gidTableFull[
GTrackID::TOF].isIndexSet() && !stopPropagation) {
1230 const auto& tofMatch = mRecoCont->
getTOFMatch(gidFull);
1234 float t0forTOFres = tofMatch.getFT0BestRes();
1235 trackData.
deltaTOF = tofMatch.getSignal() - t0forTOF - tofMatch.getLTIntegralOut().getTOF(trkTPC.getPID().getID());
1239 float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
1240 if (!clTOF.isInNominalSector()) {
1243 if (trkWork.getAlpha() != clTOFAlpha && !trkWork.rotate(clTOFAlpha)) {
1244 LOG(
debug) <<
"Failed to rotate into TOF cluster sector frame";
1245 stopPropagation =
true;
1248 if (!propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
1249 LOG(
debug) <<
"Failed final propagation to TOF radius";
1253 float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
1254 auto dy = clTOFxyz[1] - trkWork.getY();
1255 auto dz = clTOFxyz[2] - trkWork.getZ();
1256 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
1257 mClRes.emplace_back(dy, dz, tgPhi, trkWork.getY(), trkWork.getZ(), 170, clTOF.getCount(), clTOF.getPadInSector());
1260 LOGP(fatal,
"ITS-TPC seed index is not set for TOF track");
1263 float tdif =
static_cast<float>(clTOF.getTime() - t0forTOF);
1264 mDetInfoRes.emplace_back().setTOF(tdif * 1
e-6);
1271 while (!stopPropagation) {
1273 auto nCl = trkITS.getNumberOfClusters();
1274 auto clEntry = trkITS.getFirstClusterEntry();
1276 for (
int iCl = 0; iCl < nCl; iCl++) {
1277 const auto& cls = mITSClustersArray[mITSTrackClusIdx[clEntry + iCl]];
1278 int chip = cls.getSensorID();
1279 float chipX, chipAlpha;
1280 geom->getSensorXAlphaRefPlane(cls.getSensorID(), chipX, chipAlpha);
1281 if (!trkWorkITS.rotate(chipAlpha) || !propagator->propagateToX(trkWorkITS, chipX, mBz, mParams->
maxSnp, mParams->
maxStep, mMatCorr)) {
1282 LOGP(
debug,
"Failed final propagation to ITS X={} alpha={}", chipX, chipAlpha);
1283 stopPropagation =
true;
1286 float tgPhi = trkWorkITS.getSnp() / std::sqrt((1.f - trkWorkITS.getSnp()) * (1.f + trkWorkITS.getSnp()));
1287 auto dy = cls.getY() - trkWorkITS.getY();
1288 auto dz = cls.getZ() - trkWorkITS.getZ();
1289 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
1290 mClRes.emplace_back(dy, dz, tgPhi, trkWorkITS.getY(), trkWorkITS.getZ(), 180 + geom->getLayer(cls.getSensorID()), -1, cls.getSensorID());
1291 mDetInfoRes.emplace_back();
1295 if (!stopPropagation) {
1298 if (!propagator->propagateToDCA(vtx, trkWorkITS, mBz, mParams->
maxStep, mMatCorr)) {
1299 LOGP(
debug,
"Failed propagation to DCA to PV ({} {} {}), {}", pv.getX(), pv.getY(), pv.getZ(), trkWorkITS.asString());
1300 stopPropagation =
true;
1304 float sn, cs,
alpha = trkWorkITS.getAlpha();
1305 math_utils::detail::bringToPMPi(
alpha);
1306 math_utils::detail::sincos<float>(
alpha, sn, cs);
1307 float xv = vtx.X() * cs + vtx.Y() * sn, yv = -vtx.X() * sn + vtx.Y() * cs, zv = vtx.Z();
1308 auto dy = yv - trkWorkITS.getY();
1309 auto dz = zv - trkWorkITS.getZ();
1310 if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && std::abs(xv) < param::MaxVtxX) {
1312 mClRes.emplace_back(dy, dz,
alpha / TMath::Pi(), trkWorkITS.getY(), trkWorkITS.getZ(), 190, -1, compXV);
1314 LOGP(fatal,
"ITS-TPC seed index is not set for TOF track");
1317 mDetInfoRes.emplace_back().setPV(tdif);
1324 mTrackData.push_back(std::move(trackData));
1326 mGIDsSuccess.push_back(mGIDs[iSeed]);
1327 mTRDGIDsSuccess.push_back(gidTRDUsed);
1329 if (mDumpTrackPoints) {
1330 (*trackDataExtended).clIdx.setEntries(nClValidated);
1331 (*trackDataExtended).nExtDetResid = trackData.
nExtDetResid;
1332 (*trackDataExtended).filterFlag = trackData.
filterFlag;
1333 mTrackDataExtended.push_back(std::move(*trackDataExtended));
1337 (*mDBGOut) <<
"valdata" <<
"params=" << mTrackValidation <<
"trackData=" << (stored ? mTrackData.back() : trackData) <<
"\n";
1345 if (clsRes.size() < mParams->
minNCl) {
1347 LOG(
debug) <<
"Skipping track with too few clusters: " << clsRes.size();
1355 if (!resHelix && interpol) {
1356 LOG(
debug) <<
"Skipping track too far from helix approximation";
1362 if (interpol && (std::abs(mBz) > 0.01 && std::abs(
params.qpt) > mParams->
maxQ2Pt)) {
1363 LOG(
debug) <<
"Skipping track with too high q/pT: " <<
params.qpt;
1377 return status & 0x7f;
1382 float curvature = std::abs(trk.
par.getQ2Pt() * mBz * o2::constants::physics::LightSpeedCm2S * 1e-14f);
1383 int secFirst = clsRes[0].sec;
1384 float phiSect = (secFirst + .5f) * o2::constants::math::SectorSpanRad;
1385 float snPhi = sin(phiSect);
1386 float csPhi = cos(phiSect);
1389 int nCl = clsRes.size();
1390 for (
unsigned int iP = 0; iP < nCl; ++iP) {
1391 auto& point =
params.points.emplace_back();
1393 iRow += clsRes[iP].dRow;
1394 point.yTrk = clsRes[iP].y;
1395 point.sec = clsRes[iP].sec;
1396 if (clsRes[iP].sec != secFirst) {
1397 float phiSectCurrent = (clsRes[iP].sec + .5f) * o2::constants::math::SectorSpanRad;
1398 float cs = cos(phiSectCurrent - phiSect);
1399 float sn = sin(phiSectCurrent - phiSect);
1400 point.xLab = param::RowX[iRow] * cs - point.yTrk * sn;
1401 point.yLab = point.yTrk * cs + param::RowX[iRow] * sn;
1403 point.xLab = param::RowX[iRow];
1404 point.yLab = point.yTrk;
1407 point.zTrk = clsRes[iP].z;
1408 point.xTrk = param::RowX[iRow];
1409 point.dy = clsRes[iP].dy;
1410 point.dz = clsRes[iP].dz;
1413 float dx = point.xLab -
params.points[iP - 1].xLab;
1414 float dy = point.yLab -
params.points[iP - 1].yLab;
1415 float ds2 = dx * dx + dy * dy;
1416 float ds = sqrt(ds2);
1420 if (
ds * curvature > 0.05) {
1421 ds *= (1.f + ds2 * curvature * curvature / 24.f);
1423 point.sPath =
params.points[iP - 1].sPath +
ds;
1428 if (std::abs(mBz) < 0.01) {
1434 float phiI = TMath::ATan2(
params.points.front().yLab,
params.points.front().xLab);
1435 float phiF = TMath::ATan2(
params.points.back().yLab,
params.points.back().xLab);
1437 phiI += o2::constants::math::TwoPI;
1440 phiF += o2::constants::math::TwoPI;
1442 float dPhi = phiF - phiI;
1443 float curvSign = -1.f;
1445 if (dPhi < o2::constants::math::PI) {
1448 }
else if (dPhi < -o2::constants::math::PI) {
1451 params.qpt = std::copysign(1.f / (
params.r * mBz * o2::constants::physics::LightSpeedCm2S * 1e-14f), curvSign);
1457 float hMaxY = -1e9f;
1459 float hMaxZ = -1e9f;
1464 for (
unsigned int iCl = 0; iCl < nCl; ++iCl) {
1465 iRow += clsRes[iCl].dRow;
1466 auto& pnt =
params.points[iCl];
1467 pnt.residHelixZ = pnt.zTrk - (
params.zOffs + pnt.sPath *
params.tgl);
1468 if (pnt.residHelixZ < hMinZ) {
1469 hMinZ = pnt.residHelixZ;
1471 if (pnt.residHelixZ > hMaxZ) {
1472 hMaxZ = pnt.residHelixZ;
1474 if (pnt.residHelixY < hMinY) {
1475 hMinY = pnt.residHelixY;
1477 if (pnt.residHelixY > hMaxY) {
1478 hMaxY = pnt.residHelixY;
1480 int sec = clsRes[iCl].sec;
1481 if (sec != secCurr) {
1483 phiSect = (.5f + sec) * o2::constants::math::SectorSpanRad;
1484 snPhi = sin(phiSect);
1485 csPhi = cos(phiSect);
1488 float cstalp = (param::RowX[iRow] - xcSec) /
params.r;
1489 if (std::abs(cstalp) > 1.f - sFloatEps) {
1491 cstalp = std::copysign(1.f - sFloatEps, cstalp);
1493 pnt.tglArr = cstalp / sqrt((1 - cstalp) * (1 + cstalp));
1496 if (
params.qpt * mBz > 0) {
1497 pnt.tglArr = -pnt.tglArr;
1507 if (clsRes.size() < mParams->
nMALong) {
1508 LOG(
debug) <<
"Skipping track with too few clusters for long moving average: " << clsRes.size();
1512 if (
static_cast<float>(
params.nRej) / clsRes.size() > mParams->
maxRejFrac) {
1513 LOGP(
debug,
"Skipping track with too many clusters rejected: {} out of {}",
params.nRej, clsRes.size());
1517 LOG(
debug) <<
"Skipping track with too large RMS: " << rmsLong;
1525 float rmsLong = 0.f;
1527 int nCl = clsRes.size();
1529 int iClLast = nCl - 1;
1530 int secStart = clsRes[0].sec;
1532 auto rejectAll = [&
params]() {
1533 for (
auto& pnt :
params.points) {
1540 std::array<float, param::NPadRows> absDevY{};
1541 std::array<float, param::NPadRows> absDevZ{};
1543 for (
unsigned int iCl = 0; iCl < nCl; ++iCl) {
1544 if (iCl < iClLast && clsRes[iCl].sec == secStart) {
1549 int nClSec = iCl - iClFirst;
1550 if (iCl == iClLast) {
1555 secStart = clsRes[iCl].sec;
1560 for (
int iCl = nCl; iCl--;) {
1561 const auto pnt =
params.points[iCl];
1562 if (std::abs(pnt.diffYSmooth) > param::sEps) {
1563 absDevY[nAccY++] = std::abs(pnt.diffYSmooth);
1565 if (std::abs(pnt.diffZSmooth) > param::sEps) {
1566 absDevZ[nAccZ++] = std::abs(pnt.diffZSmooth);
1569 if (nAccY < mParams->minNumberOfAcceptedResiduals || nAccZ < mParams->minNumberOfAcceptedResiduals) {
1576 int nKeepY =
static_cast<int>(.9 * nAccY);
1577 int nKeepZ =
static_cast<int>(.9 * nAccZ);
1578 std::nth_element(absDevY.begin(), absDevY.begin() + nKeepY, absDevY.begin() + nAccY);
1579 std::nth_element(absDevZ.begin(), absDevZ.begin() + nKeepZ, absDevZ.begin() + nAccZ);
1580 float rmsYkeep = 0.f;
1581 float rmsZkeep = 0.f;
1582 for (
int i = nKeepY;
i--;) {
1583 rmsYkeep += absDevY[
i] * absDevY[
i];
1585 for (
int i = nKeepZ;
i--;) {
1586 rmsZkeep += absDevZ[
i] * absDevZ[
i];
1588 rmsYkeep = std::sqrt(rmsYkeep / nKeepY);
1589 rmsZkeep = std::sqrt(rmsZkeep / nKeepZ);
1590 if (rmsYkeep < param::sEps || rmsZkeep < param::sEps) {
1591 LOG(warning) <<
"Too small RMS: " << rmsYkeep <<
"(y), " << rmsZkeep <<
"(z).";
1595 float rmsYkeepI = 1.f / rmsYkeep;
1596 float rmsZkeepI = 1.f / rmsZkeep;
1598 std::array<float, param::NPadRows> yAcc;
1599 std::array<float, param::NPadRows> yDiffLong;
1600 for (
int iCl = 0; iCl < nCl; ++iCl) {
1601 auto& pnt =
params.points[iCl];
1602 auto yDiffScl = pnt.diffYSmooth * rmsYkeepI;
1603 auto zDiffScl = pnt.diffZSmooth * rmsZkeepI;
1604 if (yDiffScl * yDiffScl + zDiffScl * zDiffScl > mParams->
maxStdDevMA) {
1608 yAcc[nAcc++] = pnt.dy;
1611 if (nAcc > mParams->
nMALong) {
1613 float average = 0.f, rms = 0.f;
1614 for (
int i = 0;
i < nAcc; ++
i) {
1616 rms += yDiffLong[
i] * yDiffLong[
i];
1620 rmsLong = (rmsLong > 0) ? std::sqrt(rmsLong) : 0.f;
1627 std::array<float, param::NPadRows + 1> sumX1{}, sumX2{}, sumY1{}, sumXY{}, sumZ1{}, sumXZ{};
1628 for (
int i = 0;
i < np; ++
i) {
1630 const float x = pnt.xTrk,
y = pnt.dy,
z = pnt.dz;
1631 sumX1[
i + 1] = sumX1[
i] +
x;
1632 sumX2[
i + 1] = sumX2[
i] +
x *
x;
1633 sumY1[
i + 1] = sumY1[
i] +
y;
1634 sumXY[
i + 1] = sumXY[
i] +
x *
y;
1635 sumZ1[
i + 1] = sumZ1[
i] +
z;
1636 sumXZ[
i + 1] = sumXZ[
i] +
x *
z;
1639 for (
int i = 0;
i < np; ++
i) {
1642 const int iLeft = std::max(0,
i - mParams->
nMAShort);
1643 const int iRight = std::min(np - 1,
i + mParams->
nMAShort);
1645 const int nPoints = iRight - iLeft;
1647 if (nPoints < mParams->nMAShort) {
1651 const float nPointsInv = 1.f / nPoints;
1653 float sX1 = sumX1[iRight + 1] - sumX1[iLeft] - pnt.xTrk;
1654 float sX2 = sumX2[iRight + 1] - sumX2[iLeft] - pnt.xTrk * pnt.xTrk;
1655 float sY1 = sumY1[iRight + 1] - sumY1[iLeft] - pnt.dy;
1656 float sXY = sumXY[iRight + 1] - sumXY[iLeft] - pnt.xTrk * pnt.dy;
1657 float sZ1 = sumZ1[iRight + 1] - sumZ1[iLeft] - pnt.dz;
1658 float sXZ = sumXZ[iRight + 1] - sumXZ[iLeft] - pnt.xTrk * pnt.dz;
1660 const float det = sX2 - nPointsInv * sX1 * sX1;
1662 if (std::abs(det) < 1e-12f) {
1666 const float slopeY = (sXY - nPointsInv * sX1 * sY1) / det;
1667 const float offsetY = nPointsInv * (sY1 - slopeY * sX1);
1668 const float slopeZ = (sXZ - nPointsInv * sX1 * sZ1) / det;
1669 const float offsetZ = nPointsInv * (sZ1 - slopeZ * sX1);
1670 pnt.diffYSmooth = pnt.dy - (slopeY * pnt.xTrk + offsetY);
1671 pnt.diffZSmooth = pnt.dz - (slopeZ * pnt.xTrk + offsetZ);
1678 std::array<float, param::NPadRows + 1>
sum{};
1679 for (
int i = 0;
i < np; ++
i) {
1682 for (
int i = 0;
i < np; ++
i) {
1684 int iLeft = std::max(0,
i - mParams->
nMALong);
1685 int iRight = std::min(np - 1,
i + mParams->
nMALong);
1686 int nPoints = iRight - iLeft;
1687 if (nPoints < mParams->nMALong) {
1690 float movingAverage = (
sum[iRight + 1] -
sum[iLeft] -
y[
i]) / nPoints;
1691 diffMA[
i] =
y[
i] - movingAverage;
1698 mTrackDataCompact.clear();
1699 mTrackDataExtended.clear();
1701 mDetInfoRes.clear();
1702 mGIDsSuccess.clear();
1703 mTRDGIDsSuccess.clear();
1704 for (
auto&
vec : mTrackIndices) {
1709 mTrackTimes.clear();
1711 mITSRefitSeedID.clear();
1719 if (
v.refVDrift != mTPCVDriftRef) {
1720 mTPCVDriftRef =
v.refVDrift;
1721 mTPCDriftTimeOffsetRef =
v.refTimeOffset;
1722 LOGP(info,
"Imposing reference VDrift={}/TDrift={} for TPC residuals extraction", mTPCVDriftRef, mTPCDriftTimeOffsetRef);
1731 auto& seed = mSeeds[seedID];
1732 int refitID = mITSRefitSeedID[gid.getIndex()];
1734 if (mSeeds[refitID].getPID() == seed.getPID()) {
1735 seed = mSeeds[refitID];
1741 auto nCl = trkITS.getNumberOfClusters();
1742 auto clEntry = trkITS.getFirstClusterEntry();
1744 track.resetCovariance();
1746 track.setPID(seed.getPID());
1750 for (
int iCl = nCl - 1; iCl >= 0; iCl--) {
1751 const auto& cls = mITSClustersArray[mITSTrackClusIdx[clEntry + iCl]];
1752 int chip = cls.getSensorID();
1753 float chipX, chipAlpha;
1754 geom->getSensorXAlphaRefPlane(cls.getSensorID(), chipX, chipAlpha);
1755 if (!track.rotate(chipAlpha, refLin, mBz)) {
1756 LOGP(
debug,
"failed to rotate ITS tracks to alpha={} for the refit: {}", chipAlpha, track.asString());
1760 LOGP(
debug,
"failed to propagate ITS tracks to X={}: {}", cls.getX(), track.asString());
1763 std::array<float, 2> posTF{cls.getY(), cls.getZ()};
1764 std::array<float, 3> covTF{cls.getSigmaY2(), cls.getSigmaYZ(), cls.getSigmaZ2()};
1765 if (!track.update(posTF, covTF)) {
1766 LOGP(
debug,
"failed to update ITS tracks by cluster ({},{})/({},{},{})", track.asString(), cls.getY(), cls.getZ(), cls.getSigmaY2(), cls.getSigmaYZ(), cls.getSigmaZ2());
1770 refLin.setY(posTF[0]);
1771 refLin.setZ(posTF[1]);
1776 mITSRefitSeedID[gid.getIndex()] = seedID;
std::string asString(TDataMember const &dm, char *pointer)
unsigned short int uint16_t
std::vector< double > sum
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from average
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions false
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in tan(phi) dependence of tracklet error due to radial misalignment(centered at 0 angle)") AddOptionRTC(maxChi2Red
char error[CURL_ERROR_SIZE]
Definition of the GeometryTGeo class.
Definition of the parameter class for the detector electronics.
Definition of the TrackInterpolation class.
Definition of the TrackResiduals class.
calibration data from laser track calibration
Referenc on track indices contributing to the vertex, with possibility chose tracks from specific sou...
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
static BasicCCDBManager & instance()
T * getSpecific(std::string const &path, long timestamp=-1, MD metaData=MD(), std::map< std::string, std::string > *headers=nullptr)
retrieve an object of type T from CCDB as stored under path, timestamp and metaData
static const ParameterElectronics & Instance()
Static class with identifiers, bitmasks and names for ALICE detectors.
static size_t fillOccupancyMapGetSize(uint32_t nHbfPerTf, const GPUParam *param=nullptr)
static void paramUseExternalOccupancyMap(GPUParam *param, uint32_t nHbfPerTf, const uint32_t *occupancymap, int32_t occupancyMapSize)
static std::shared_ptr< GPUParam > getFullParamShared(float solenoidBz, uint32_t nHbfPerTf=0, std::unique_ptr< GPUO2InterfaceConfiguration > *pConfiguration=nullptr, std::unique_ptr< GPUSettingsO2 > *pO2Settings=nullptr, bool *autoMaxTimeBin=nullptr)
void init(float bz, const GPUSettingsRec *rec=nullptr)
Load parameterization for given magnetic field.
float getSensorRefAlpha(int isn) const
static GeometryTGeo * Instance()
float getSensorRefX(int isn) const
void beginLayer(int lr)
to be called once all the layers were filled
void init(int nLr)
< prepare for filling nLr layer slots, discarding the previous content
static constexpr Double_t BC_TIME_INPS
static constexpr Double_t BC_TIME_INPS_INV
static void rotateToSector(Float_t *xyz, Int_t isector)
static void getPos(Int_t *det, Float_t *pos)
static constexpr Int_t NPADSXSECTOR
static void getVolumeIndices(Int_t index, Int_t *detId)
static void alignedToNominalSector(Float_t *xyz, Int_t isector)
float checkResiduals(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
void prepareInputTrackSample(const o2::globaltracking::RecoContainer &inp)
Prepare input track sample (not relying on CreateTracksVariadic functionality)
int processTRDLayer(const o2::trd::TrackTRD &trkTRD, int iLayer, o2::track::TrackParCov &trkWork, std::array< float, 2 > *trkltTRDYZ=nullptr, std::array< float, 3 > *trkltTRDCov=nullptr, TrackData *trkData=nullptr, o2::trd::Tracklet64 *trk64=nullptr, o2::trd::CalibratedTracklet *trkCalib=nullptr)
bool isInputTrackAccepted(const o2::dataformats::GlobalTrackID &gid, const o2::globaltracking::RecoContainer::GlobalIDSet &gidTable, const o2::dataformats::PrimaryVertex &pv) const
Check if input track passes configured cuts.
void extrapolateTrack(int iSeed)
@ ExtIn
extrapolation inwards of TRD/TOF track
@ Int
interpolation (mean positions of both extrapolations)
@ ExtOut
extrapolation outwards of ITS track
o2::dataformats::GlobalTrackID::Source findValidSource(const o2::dataformats::GlobalTrackID::mask_t mask, const o2::dataformats::GlobalTrackID::Source src) const
For given vertex track source which is not in mSourcesConfigured find the seeding source which is ena...
bool refITSTrack(o2::dataformats::GlobalTrackID, int iSeed)
void interpolateTrack(int iSeed)
void diffToMA(const int np, const std::array< float, param::NPadRows > &y, std::array< float, param::NPadRows > &diffMA)
For a given set of points, calculate their deviation from the moving average (build from the neighbou...
bool compareToHelix(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
void diffToLocLine(TrackValidationData ¶ms, int start, int np)
For a given set of points, calculate the differences from each point to the fitted lines from all oth...
void process()
Main processing function.
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
int8_t validateTrack(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes, bool interpol)
bool isTrackSelected(const o2::track::TrackParCov &trk) const
Given the defined downsampling factor tsalisThreshold check if track is selected.
void reset()
Reset cache and output vectors.
bool outlierFiltering(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
void init(o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap)
Initialize everything, set the requested track sources.
static bool fitPoly1(int nCl, std::array< float, param::NPadRows > &x, std::array< float, param::NPadRows > &y, std::array< float, 2 > &res)
static void fitCircle(int nCl, std::array< float, param::NPadRows > &x, std::array< float, param::NPadRows > &y, float &xc, float &yc, float &r, std::array< float, param::NPadRows > &residHelixY)
static Geometry * instance()
GLfloat GLfloat GLfloat alpha
GLuint GLuint GLfloat weight
GLenum const GLfloat * params
GLdouble GLdouble GLdouble z
constexpr int MaxITSLayers
void convertCompactClusters(gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, std::vector< o2::BaseCluster< float > > &output, const itsmft::TopologyDictionary *dict)
convert compact clusters to 3D spacepoints
int angle2Sector(float phi)
float sector2Angle(int sect)
Global TPC definitions and constants.
Enum< T >::Iterator begin(Enum< T >)
auto getITSPerLayer() const
auto getITSTracks() const
GlobalIDSet getSingleDetectorRefs(GTrackID gidx) const
const o2::tpc::TrackTPC & getTPCTrack(GTrackID id) const
gsl::span< const o2::trd::CalibratedTracklet > getTRDCalibratedTracklets() const
auto getITSTracksClusterRefs() const
auto getPrimaryVertices() const
auto getPrimaryVertexMatchedTracks() const
const o2::tpc::ClusterNativeAccess & getTPCClusters() const
auto getTPCTracksClusterRefs() const
auto getPrimaryVertexMatchedTrackRefs() const
auto getITSClustersPatterns(int layer=0) const
const o2::track::TrackParCov & getTrackParam(GTrackID gidx) const
auto getTOFClusters() const
gsl::span< const unsigned char > clusterShMapTPC
externally set TPC clusters sharing map
const o2::dataformats::TrackTPCITS & getTPCITSTrack(GTrackID gid) const
const o2::its::TrackITS & getITSTrack(GTrackID gid) const
auto getITSTPCTRDTrack(GTrackID id) const
gsl::span< const unsigned int > occupancyMapTPC
externally set TPC clusters occupancy map
auto getITSClusters(int layer=0) const
std::array< GTrackID, GTrackID::NSources > GlobalIDSet
gsl::span< const o2::trd::Tracklet64 > getTRDTracklets() const
const o2::dataformats::MatchInfoTOF & getTOFMatch(GTrackID id) const
static bool downsampleTsallisCharged(float pt, float factorPt, float sqrts, float &weight, float rnd, float mass=0.13957)
unsigned int clusterOffset[constants::MAXSECTOR][constants::MAXGLOBALPADROW]
const ClusterNative * clustersLinear
float maxRejFrac
if the fraction of rejected clusters of a track is higher, the full track is invalidated
float maxDCA
DCA cut value in cm.
float maxDevHelixZ
max deviation in Z for clusters wrt helix fit
int nMALong
number of points to be used for moving average (long range)
float maxTPCChi2
cut on TPC reduced chi2
float minPtNoOuterPoint
minimum pt for ITS-TPC tracks to be considered for extrapolation
bool clampTgSlp
store TPC cluster residuals with |tan(phi)| >= param::MaxTgSlp saturated (tgSlp = +-0x7fff,...
int minTRDNTrklts
min number of TRD space points
bool refitITS
refit ITS tracks with PID attached to the seed
bool keepClustersOnPropFail
if the reference track propagation fails (maxSnp, rotation), keep the track: TPC clusters without a r...
int nMAShort
number of points to be used for estimation of distance from local line (short range)
float maxDevHelixY
max deviation in Y for clusters wrt helix fit
float maxStdDevMA
max cluster std. deviation (Y^2 + Z^2) wrt moving average to accept
bool skipOutlierFiltering
if set, the outlier filtering will not be applied at all
bool ignoreNonPVContrib
flag if tracks which did not contribute to the PV should be ignored or not
bool keepRejectedResiduals
if set, keep rejected residuals setting rejected flag
int minITSNClsNoOuterPoint
min number of ITS clusters if no hit in TRD or TOF exists
int minTPCNCls
min number of TPC clusters
float tsalisThreshold
in case the sampling functions returns a value smaller than this the track is discarded (1....
bool shiftRefToCluster
when reftting the ITS track, shift the lin.reference to cluster after every update (better material m...
bool writeValidationData
write track validation data for debugging
float maxStep
maximum step for propagation
int minTOFTRDPVContributors
min contributors from TRD or TOF (fast detectors) to consider tracks of this PV
bool enableTrackDownsampling
flag if track sampling shall be enabled or not
float maxQ2Pt
max fitted q/pt for a track to be used for calibration
float sigYZ2TOF
for now assume cluster error for TOF equal for all clusters in both Y and Z
int minNumberOfAcceptedResiduals
min number of accepted residuals for
float maxRMSLong
maximum variance of the cluster residuals wrt moving avarage for a track to be considered
int minITSNCls
min number of ITS clusters
float maxSnp
max snp when propagating tracks
float maxITSChi2
cut on ITS reduced chi2
bool writeUnfiltered
if set, tracks failing validation will be kept with filterFlag>0 giving the reason of rejection
int minNCl
min number of clusters in a track to be used for calibration
int minTPCNClsNoOuterPoint
min number of TPC clusters if no hit in TRD or TOF exists
Structure filled for each track with track quality information and a vector with TPCClusterResiduals.
float chi2TRD
chi2 of TRD track
float dEdxTPC
TPC dEdx information.
unsigned short nTrkltsTRD
number of attached TRD tracklets
unsigned short clAvailTOF
whether or not track seed has a matched TOF cluster, if so, gives the resolution of the T0 in ps
std::array< uint8_t, 4 > multStack
short TRDTrkltSlope[6]
TRD tracklet slope 0x7fff / param::MaxTRDSlope.
unsigned short nClsITS
number of attached ITS clusters
o2::dataformats::RangeReference clIdx
index of first cluster residual and total number of TPC cluster residuals of this track
float chi2TPC
chi2 of TPC track
o2::track::TrackParCov par
ITS track at inner TPC radius.
unsigned short nClsTPC
number of attached TPC clusters
void setMultStack(float v, int stack)
o2::dataformats::GlobalTrackID gid
global track ID for seeding track
float deltaTOF
TOFsignal - T0 - texp(PID), if T0 is available.
int8_t filterFlag
-1: validation was not done, 0: validated, >0 : reason not passing validation, see validateTrack meth...
uint8_t nExtDetResid
number of external detectors (to TPC) residuals stored, on top of clIdx.getEntries
float chi2ITS
chi2 of ITS track
std::vector< ValidationPoint > points
unsigned char sec
TPC sector (0..35)
unsigned char row
TPC pad row.
static void init(long timestamp=-1)
static short packToShort(float value, float maximum, int limit=0x7fff)
static constexpr short TgSlpPositionOnly
static void checkInitDone()
short channel
extra channel info (ITS chip ID, TRD chamber, TOF main pad within the sector)
std::vector< o2::ctf::BufferType > vec
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::uniform_int_distribution< unsigned long long > distr