Project
Loading...
Searching...
No Matches
MatchTPCITS.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#ifndef ALICEO2_GLOBTRACKING_MATCHTPCITS_
17#define ALICEO2_GLOBTRACKING_MATCHTPCITS_
18
19#define _ALLOW_DEBUG_TREES_ // to allow debug and control tree output
20
21#define _ALLOW_DEBUG_AB_ // fill extra debug info for AB
22
23#include <Rtypes.h>
24#include <array>
25#include <deque>
26#include <vector>
27#include <string>
28#include <gsl/span>
29#include <TStopwatch.h>
51#include "TPCFastTransform.h"
52#include "GPUO2InterfaceRefit.h"
53#include "GPUTPCGeometry.h"
59#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
61#endif
62#ifdef ENABLE_UPGRADES
64#endif
65
66class TTree;
67
68namespace o2
69{
70
71namespace globaltracking
72{
73class RecoContainer;
74}
75
76namespace dataformats
77{
78template <typename TruthElement>
80}
81
82namespace its
83{
84class TrackITS;
85}
86
87namespace itsmft
88{
89class Cluster;
90}
91
92namespace tpc
93{
94class TrackTPC;
95class VDriftCorrFact;
96} // namespace tpc
97
98namespace gpu
99{
100struct GPUParam;
101}
102
103namespace globaltracking
104{
105
106constexpr int Zero = 0;
107constexpr int MinusOne = -1;
108constexpr int MinusTen = -10;
109constexpr int Validated = -2;
110
123
127 enum Constraint_t : uint8_t { Constrained,
131 float time0 = 0.f;
132 float timeErr = 0.f;
133 int sourceID = 0;
134 o2::dataformats::GlobalTrackID gid{}; // global track source ID (TPC track may be part of it)
136 uint8_t lowestRow = -1;
137 uint8_t padFromEdge = -1;
139
140 float getCorrectedTime(float dt) const // return time0 corrected for extra drift (to match certain Z)
141 {
142 return constraint == Constrained ? time0 : (constraint == ASide ? time0 + dt : time0 - dt);
143 }
144 float getSignedDT(float dt) const // account for TPC side in time difference for dt=external_time - tpc.time0
145 {
146 return constraint == Constrained ? 0.f : (constraint == ASide ? dt : -dt);
147 }
148
150};
151
155 enum : uint16_t { CloneBefore = 0x1,
156 CloneAfter = 0x2 };
158 int sourceID = 0;
161 float xrho = 0;
162 float dL = 0;
163 bool hasCloneBefore() const { return getUserField() & CloneBefore; }
164 bool hasCloneAfter() const { return getUserField() & CloneAfter; }
165 int getCloneShift() const { return hasCloneBefore() ? -1 : (hasCloneAfter() ? 1 : 0); }
166 void setCloneBefore() { setUserField(getUserField() | CloneBefore); }
167 void setCloneAfter() { setUserField(getUserField() | CloneAfter); }
168
170};
171
175 float chi2 = -1.f;
179 MatchRecord(int partID, float chi2match, int nxt = MinusOne, int candIC = MinusOne) : partnerID(partID), chi2(chi2match), nextRecID(nxt), matchedIC(candIC) {}
180 MatchRecord() = default;
181
182 bool isBetter(float otherChi2, int otherIC = MinusOne) const
183 { // prefer record with matched IC candidate, otherwise, better chi2
184 if (otherIC == MinusOne) {
185 return matchedIC == MinusOne ? chi2 < otherChi2 : true;
186 } else {
187 return matchedIC == MinusOne ? false : chi2 < otherChi2;
188 }
189 }
190
191 bool isBetter(const MatchRecord& other) const
192 {
193 return isBetter(other.chi2, other.matchedIC);
194 }
195};
196
200 static constexpr int Disabled = -2;
204 uint8_t nDaughters = 0;
205 int8_t layerID = -1;
206 int8_t nContLayers = 0;
207 uint8_t ladderID = 0xff;
208 float chi2 = 0.f;
209
210 ABTrackLink() = default;
211 ~ABTrackLink() = default;
212 ABTrackLink(const o2::track::TrackParCov& tr, int cl, int parID, int nextID, int lr, int nc, int ld, float _chi2)
213 : o2::track::TrackParCov(tr), clID(cl), parentID(parID), nextOnLr(nextID), layerID(int8_t(lr)), nContLayers(int8_t(nc)), ladderID(uint8_t(ld)), chi2(_chi2) {}
214
215 bool isDisabled() const { return clID == Disabled; }
216 void disable() { clID = Disabled; }
217 bool isDummyTop() const { return clID == MinusTen; }
219 float chi2NormPredict(float chi2cl) const { return (chi2 + chi2cl) / (1 + o2::its::RecoGeomHelper::getNLayers() - layerID); }
220};
221
223 std::vector<std::deque<ABTrackLink>> threadPool;
224};
225
226// AB primary seed: TPC track propagated to outermost ITS layer under specific InteractionCandidate hypothesis
227struct TPCABSeed {
228 static constexpr int8_t NeedAlternative = -3;
232 uint32_t linksEntry = 0;
233 int nLinks = 0;
235 int8_t status = MinusOne;
236 uint8_t threadID = 0;
240
241 TPCABSeed(int id, int ic, const o2::track::TrackParCov& trc) : tpcWID(id), ICCanID(ic), track(trc)
242 {
243 firstInLr.fill(MinusOne);
244 }
245 bool isDisabled() const { return status == MinusTen; }
246 void disable() { status = MinusTen; }
247 bool isValidated() const { return status == Validated; }
248 void validate(int lID)
249 {
250 winLinkID = lID;
252 }
254 bool needAlteranative() const { return status == NeedAlternative; }
257 const ABTrackLink& getLink(int i) const { return gLinksPool->threadPool[threadID][i + linksEntry]; }
258 void addLink(const o2::track::TrackParCov& trc, int clID, int parentID, int nextID, int lr, int nc, int laddID, float chi2)
259 {
260 gLinksPool->threadPool[threadID].push_back({trc, clID, parentID, nextID, lr, nc, laddID, chi2});
261 nLinks++;
262 }
263 int getNLinks() const { return nLinks; }
268 bool checkLinkHasUsedClusters(int linkID, const std::vector<int>& clStatus) const
269 {
270 // check if some clusters used by the link or its parents are forbidden (already used by validatet track)
271 while (linkID > MinusOne) {
272 const auto& link = getLink(linkID);
273 if (link.clID > MinusOne && clStatus[link.clID] != MinusOne) {
274 return true;
275 }
276 linkID = link.parentID;
277 }
278 return false;
279 }
280 void flagLinkUsedClusters(int linkID, std::vector<int>& clStatus) const
281 {
282 // check if some clusters used by the link or its parents are forbidden (already used by validated track)
283 while (linkID > MinusOne) {
284 const auto& link = getLink(linkID);
285 if (link.clID > MinusOne) {
286 clStatus[link.clID] = MinusTen;
287 }
288 linkID = link.parentID;
289 }
290 }
291 size_t sizeInternal() const { return sizeof(ABTrackLink) * getNLinks(); }
292 size_t capInternal() const { return sizeof(ABTrackLink) * getNLinks(); }
293};
294
297 int rofITS; // corresponding ITS ROF entry (in the ROFRecord vectors)
298 uint32_t flag; // origin, etc.
300 InteractionCandidate(const o2::InteractionRecord& ir, float t, float dt, int rof, uint32_t f = 0) : o2::InteractionRecord(ir), tBracket(t - dt, t + dt), rofITS(rof), flag(f) {}
301};
302
307 std::vector<int> clusterID; // indices of sorted clusters
308
309#ifndef ENABLE_UPGRADES
310 std::array<ClusRange, o2::its::RecoGeomHelper::getNChips()> chipRefs; // offset and number of clusters in each chip
311 ITSChipClustersRefs(int nclIni = 50000)
312 {
313 clusterID.reserve(nclIni);
314 }
315#else
316 std::vector<ClusRange> chipRefs; // offset and number of clusters in each chip
317 ITSChipClustersRefs(int nchips = o2::its::RecoGeomHelper::getNChips(), int nclIni = 50000)
318 {
319 clusterID.reserve(nclIni);
320 chipRefs.resize(nchips, ClusRange());
321 }
322#endif
323
324 void clear()
325 {
326 clusterID.clear();
327 std::memset(chipRefs.data(), 0, chipRefs.size() * sizeof(ClusRange)); // reset chip->cluster references
328 }
329 size_t sizeInternal() const { return sizeof(int) * clusterID.size(); }
330 size_t capInternal() const { return sizeof(int) * clusterID.capacity(); }
331};
332
334{
335 public:
344
345 MatchTPCITS(); // std::unique_ptr to forward declared type needs constructor / destructor in .cxx
347
348 static constexpr int MaxUpDnLadders = 3; // max N ladders to check up and down from selected one
349 static constexpr int MaxLadderCand = 2 * MaxUpDnLadders + 1; // max ladders to check for matching clusters
350 static constexpr int MaxSeedsPerLayer = 50; // TODO
353#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
357 pmr::vector<int>& ABTrackletClusterIDs,
358 pmr::vector<o2::MCCompLabel>& matchLabels,
359 pmr::vector<o2::MCCompLabel>& ABTrackletLabels,
366 pmr::vector<int>& ABTrackletClusterIDs,
367 pmr::vector<o2::MCCompLabel>& matchLabels,
368 pmr::vector<o2::MCCompLabel>& ABTrackletLabels,
370 bool runAfterBurner(pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<o2::MCCompLabel>& matchLabels, pmr::vector<o2::MCCompLabel>& ABTrackletLabels, pmr::vector<int>& ABTrackletClusterIDs,
372 void refitABWinners(pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<o2::MCCompLabel>& matchLabels, pmr::vector<o2::MCCompLabel>& ABTrackletLabels, pmr::vector<int>& ABTrackletClusterIDs,
374 bool refitABTrack(int iITSAB, const TPCABSeed& seed, pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<int>& ABTrackletClusterIDs, pmr::vector<o2::itsmft::TrkClusRef>& ABTrackletRefs);
375#endif // CLING
376 void setSkipTPCOnly(bool v)
377 {
378 mSkipTPCOnly = v;
379 }
380 void setCosmics(bool v) { mCosmics = v; }
381 bool isCosmics() const { return mCosmics; }
382 void setNThreads(int n);
383
385 void init();
386 void end();
387 void reportTiming();
388
390 void clear();
391
393 void setBunchFilling(const o2::BunchFilling& bf);
394
395 void setNHBPerTF(int n) { mNHBPerTF = n; }
396
398 void setITSTriggered(bool v) { mITSTriggered = v; }
399 bool isITSTriggered() const { return mITSTriggered; }
400
401 void setUseFT0(bool v) { mUseFT0 = v; }
402 bool getUseFT0() const { return mUseFT0; }
403
404 void setUseBCFilling(bool v) { mUseBCFilling = v; }
405 bool getUseBCFilling() const { return mUseBCFilling; }
406
408 void setITSROFrameLengthMUS(float fums);
410 void setITSROFrameLengthInBC(int nbc);
411
412 void setITSTimeBiasInBC(int n);
413 int getITSTimeBiasInBC() const { return mITSTimeBiasInBC; }
414 float getITSTimeBiasMUS() const { return mITSTimeBiasMUS; }
415
416 // ==================== >> DPL-driven input >> =======================
417 void setITSDictionary(const o2::itsmft::TopologyDictionary* d) { mITSDict = d; }
418#ifdef ENABLE_UPGRADES
419 void setIT3Dictionary(const o2::its3::TopologyDictionary* d)
420 {
421 mIT3Dict = d;
422 }
423#endif
424
426 void setMCTruthOn(bool v)
427 {
428 mMCTruthON = v;
429 }
430
432 void setVDriftCalib(bool v)
433 {
434 mVDriftCalibOn = v;
435 }
438
440 void print() const;
441 void printCandidatesTPC() const;
442 void printCandidatesITS() const;
443
444 //>>> ====================== options =============================>>>
445 void setUseMatCorrFlag(MatCorrType f) { mUseMatCorrFlag = f; }
446 auto getUseMatCorrFlag() const { return mUseMatCorrFlag; }
447
448 //<<< ====================== options =============================<<<
449
450#ifdef _ALLOW_DEBUG_TREES_
451 enum DebugFlagTypes : UInt_t {
452 MatchTreeAll = 0x1 << 1,
453 MatchTreeAccOnly = 0x1 << 2,
454 WinnerMatchesTree = 0x1 << 3,
455 TPCOrigTree = 0x1 << 4
456 };
458 bool isDebugFlag(UInt_t flags) const { return mDBGFlags & flags; }
459
461 UInt_t getDebugFlags() const { return mDBGFlags; }
462
464 void setDebugFlag(UInt_t flag, bool on = true);
465
467 void setDebugTreeFileName(std::string name)
468 {
469 if (!name.empty()) {
470 mDebugTreeFileName = name;
471 }
472 }
473
475 const std::string& getDebugTreeFileName() const { return mDebugTreeFileName; }
476
478 void fillTPCITSmatchTree(int itsID, int tpcID, int rejFlag, float chi2 = -1., float tCorr = 0.);
480 void dumpTPCOrig(bool acc, int tpcIndex);
481#endif
482
483 private:
484 void updateTimeDependentParams();
485
486 int findLaddersToCheckBOn(int ilr, int lad0, const o2::math_utils::CircleXYf_t& circle, float errYFrac,
487 std::array<int, MaxLadderCand>& lad2Check) const;
488 int findLaddersToCheckBOff(int ilr, int lad0, const o2::math_utils::IntervalXYf_t& trcLinPar, float errYFrac,
489 std::array<int, MatchTPCITS::MaxLadderCand>& lad2Check) const;
490 bool prepareTPCData();
491 bool prepareITSData();
492 bool prepareFITData();
493 int prepareInteractionTimes();
494 int prepareTPCTracksAfterBurner();
495 int addTPCSeed(const o2::track::TrackParCov& _tr, float t0, float terr, o2::dataformats::GlobalTrackID srcGID, int tpcID);
496
497 int preselectChipClusters(std::vector<int>& clVecOut, const ClusRange& clRange, const ITSChipClustersRefs& itsChipClRefs,
498 float trackY, float trackZ, float tolerY, float tolerZ) const;
499 void fillClustersForAfterBurner(int rofStart, int nROFs, ITSChipClustersRefs& itsChipClRefs);
500 void flagUsedITSClusters(const o2::its::TrackITS& track);
501
502 void doMatching(int sec);
503
504 bool refitTPCInward(o2::track::TrackParCov& trcIn, float& chi2, float xTgt, int trcID, float timeTB) const;
505
506 void selectBestMatches();
507 bool validateTPCMatch(int iTPC);
508 void removeITSfromTPC(int itsID, int tpcID);
509 void removeTPCfromITS(int tpcID, int itsID);
510 bool isValidatedTPC(const TrackLocTPC& t) const;
511 bool isValidatedITS(const TrackLocITS& t) const;
512 bool isDisabledTPC(const TrackLocTPC& t) const;
513 bool isDisabledITS(const TrackLocITS& t) const;
514
515 int compareTPCITSTracks(const TrackLocITS& tITS, const TrackLocTPC& tTPC, float& chi2) const;
516 float getPredictedChi2NoZ(const o2::track::TrackParCov& trITS, const o2::track::TrackParCov& trTPC) const;
517 bool propagateToRefX(o2::track::TrackParCov& trc, o2::track::TrackLTIntegral* lti = nullptr);
518 void addLastTrackCloneForNeighbourSector(int sector, o2::track::TrackLTIntegral* trackLTInt = nullptr);
519
521 bool registerMatchRecordTPC(int iITS, int iTPC, float chi2, int candIC = MinusOne);
522 void registerMatchRecordITS(int iITS, int iTPC, float chi2, int candIC = MinusOne);
523 void suppressMatchRecordITS(int iITS, int iTPC);
524
526 int getNMatchRecordsTPC(const TrackLocTPC& tTPC) const;
527
529 int getNMatchRecordsITS(const TrackLocITS& tITS) const;
530
532 BracketIR tBracket2IRBracket(const BracketF tbrange);
533
535 int time2ITSROFrameCont(float t) const
536 {
537 int rof = (t - mITSTimeBiasMUS) * mITSROFrameLengthMUSInv;
538 if (rof < 0) {
539 rof = 0;
540 }
541 // the rof is estimated continuous counter but the actual bins might have gaps (e.g. HB rejects etc)-> use mapping
542 return rof < int(mITSTrackROFContMapping.size()) ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
543 }
544
546 int time2ITSROFrameTrig(float t, int start) const
547 {
548 t -= mITSTimeBiasMUS;
549 while (start < int(mITSROFTimes.size())) {
550 if (mITSROFTimes[start].getMax() > t) {
551 return start;
552 }
553 start++;
554 }
555 return --start;
556 }
557
559 float tpcTimeBin2Z(float tbn) const { return tbn * mTPCBin2Z; }
560
562 float tpcTimeBin2MUS(float tbn) const { return tbn * mTPCTBinMUS; }
563
565 float tpcTimeBin2NS(float tbn) const { return tbn * mTPCTBinNS; }
566
568 float z2TPCBin(float z) const { return z * mZ2TPCBin; }
569
571 float tpcBin2Z(float t) const { return t * mTPCBin2Z; }
572
574 int roughCheckDif(float delta, float toler, int rejFlag) const
575 {
576 return delta > toler ? rejFlag : (delta < -toler ? -rejFlag : Accept);
577 }
578
579 // ========================= AFTERBURNER =========================
580 int prepareABSeeds();
581 void processABSeed(int sid, const ITSChipClustersRefs& itsChipClRefs, uint8_t tID);
582 int followABSeed(const o2::track::TrackParCov& seed, const ITSChipClustersRefs& itsChipClRefs, int seedID, int lrID, TPCABSeed& ABSeed);
583 int registerABTrackLink(TPCABSeed& ABSeed, const o2::track::TrackParCov& trc, int clID, int parentID, int lr, int laddID, float chi2Cl);
584 bool isBetter(float chi2A, float chi2B) { return chi2A < chi2B; } // RS FIMXE TODO
585 void accountForOverlapsAB(int lrSeed);
586 float correctTPCTrack(o2::track::TrackParCov& trc, const TrackLocTPC& tTPC, const InteractionCandidate& cand) const; // RS FIXME will be needed for refit
587 //================================================================
588
589 bool mInitDone = false;
590 bool mFieldON = true;
591 bool mCosmics = false;
592 bool mMCTruthON = false;
593 float mBz = 0;
594 int mTFCount = 0;
595 int mNThreads = 1;
596 int mNHBPerTF = 0;
597 int mNTPCOccBinLength = 0;
598 float mNTPCOccBinLengthInv;
599 o2::InteractionRecord mStartIR{0, 0};
600
602 const Params* mParams = nullptr;
603 const o2::ft0::InteractionTag* mFT0Params = nullptr;
604
605 MatCorrType mUseMatCorrFlag = MatCorrType::USEMatCorrTGeo;
606 bool mUseBCFilling = false;
607 bool mSkipTPCOnly = false;
608 bool mITSTriggered = false;
609 bool mUseFT0 = false;
610
612 bool mCompareTracksDZ = false;
613
614 float YMaxAtXMatchingRef = 999.;
615
616 float mSectEdgeMargin = 0.;
617
620 float mTPCTimeEdgeTSafeMargin = 0.f;
621 float mTPCExtConstrainedNSigmaInv = 0.f; // inverse for NSigmas for TPC time-interval from external constraint time sigma
622 int mITSROFrameLengthInBC = 0;
623 float mITSROFrameLengthMUS = -1.;
624 float mITSTimeResMUS = -1.;
625 float mITSROFrameLengthMUSInv = -1.;
626 int mITSTimeBiasInBC = 0;
627 float mITSTimeBiasMUS = 0.;
628 float mTPCVDrift = -1.;
629 float mTPCVDriftInv = -1.;
630 float mTPCDriftTimeOffset = 0;
631 float mTPCTBinMUS = 0.;
632 float mTPCTBinNS = 0.;
633 float mTPCTBinMUSInv = 0.;
634 float mZ2TPCBin = 0.;
635 float mTPCBin2Z = 0.;
636 float mNTPCBinsFullDrift = 0.;
637 float mTPCZMax = 0.;
638 float mTPCmeanX0Inv = 1. / 31850.;
639
640 float mMinTPCTrackPtInv = 999.;
641 float mMinITSTrackPtInv = 999.;
642 bool mVDriftCalibOn = false;
643 o2::tpc::VDriftCorrFact mTPCDrift{};
644 o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
645
646 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mTPCRefitter;
647
648 o2::BunchFilling mBunchFilling;
649 std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchAbove; // closest filled bunch from above
650 std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchBelow; // closest filled bunch from below
651
652 std::array<float, 5> mCovDiagInner{};
653 std::array<float, 5> mCovDiagOuter{};
654
655 const o2::itsmft::ChipMappingITS ITSChMap{};
656
657 const o2::globaltracking::RecoContainer* mRecoCont = nullptr;
659 // since this info is provided by external device
660 gsl::span<const o2::tpc::TrackTPC> mTPCTracksArray;
661 gsl::span<const o2::tpc::TPCClRefElem> mTPCTrackClusIdx;
662 gsl::span<const o2::itsmft::ROFRecord> mITSTrackROFRec;
663 gsl::span<const o2::its::TrackITS> mITSTracksArray;
664 gsl::span<const int> mITSTrackClusIdx;
665 std::vector<ITSCluster> mITSClustersArray;
666 std::vector<uint8_t> mITSClusterSizes;
667
668 gsl::span<const o2::itsmft::ROFRecord> mITSClusterROFRec;
669 gsl::span<const o2::ft0::RecPoints> mFITInfo;
670
671 gsl::span<const unsigned char> mTPCRefitterShMap;
672 gsl::span<const unsigned int> mTPCRefitterOccMap;
673
674 const o2::itsmft::TopologyDictionary* mITSDict{nullptr}; // cluster patterns dictionary
675#ifdef ENABLE_UPGRADES
676 const o2::its3::TopologyDictionary* mIT3Dict{nullptr}; // cluster patterns dictionary
677#endif
678
679 const o2::tpc::ClusterNativeAccess* mTPCClusterIdxStruct = nullptr;
680
681 const o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mITSClsLabels = nullptr;
682 gsl::span<const o2::MCCompLabel> mITSTrkLabels;
683 gsl::span<const o2::MCCompLabel> mTPCTrkLabels;
685
686 size_t mNMatches = 0;
687 size_t mNCalibPrelim = 0;
688 size_t mNMatchesControl = 0;
689
690 size_t mNABRefsClus = 0;
691 float mAB2MatchGuess = 0.2; // heuristic guess about fraction of AB matches in total matches
692 std::vector<InteractionCandidate> mInteractions;
693 std::vector<int> mInteractionMUSLUT;
694
696 std::vector<MatchRecord> mMatchRecordsTPC; // RSS DEQ
698 std::vector<MatchRecord> mMatchRecordsITS; // RSS DEQ
699
701 std::vector<BracketF> mITSROFTimes;
702 std::vector<TrackLocTPC> mTPCWork;
703 std::vector<TrackLocITS> mITSWork;
704 std::vector<o2::MCCompLabel> mTPCLblWork;
705 std::vector<o2::MCCompLabel> mITSLblWork;
706 std::vector<float> mWinnerChi2Refit;
707 std::vector<float> mTBinClOcc;
708
709 // ------------------------------
710 std::vector<TPCABSeed> mTPCABSeeds;
712 std::vector<int> mTPCABIndexCache;
713 std::vector<int> mABWinnersIDs;
714 std::vector<int> mABClusterLinkIndex;
715 LinksPoolMT mABLinksPool;
716
718 std::array<std::vector<int>, o2::constants::math::NSectors> mTPCSectIndexCache;
720 std::array<std::vector<int>, o2::constants::math::NSectors> mITSSectIndexCache;
721
723 std::array<std::vector<int>, o2::constants::math::NSectors> mTPCTimeStart;
725 std::array<std::vector<int>, o2::constants::math::NSectors> mITSTimeStart;
726
728 std::vector<int> mITSTrackROFContMapping;
729
730 o2::its::RecoGeomHelper mRGHelper;
731
732#ifdef _ALLOW_DEBUG_TREES_
733 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
734 UInt_t mDBGFlags = 0;
735 std::string mDebugTreeFileName = "dbg_TPCITSmatch.root";
736#endif
737
739 static constexpr float Tan70 = 2.74747771e+00; // tg(70 degree): std::tan(70.*o2::constants::math::PI/180.);
740 static constexpr float Cos70I2 = 1. + Tan70 * Tan70; // 1/cos^2(70) = 1 + tan^2(70)
741 static constexpr float MaxSnp = 0.9; // max snp of ITS or TPC track at xRef to be matched
742 static constexpr float MaxTgp = 2.064; // max tg corresponting to MaxSnp = MaxSnp/std::sqrt(1.-MaxSnp^2)
743 static constexpr float MinTBToCleanCache = 600.; // keep in AB ITS cluster refs cache at most this number of TPC bins
744 static const o2::gpu::GPUTPCGeometry TPCGeometry;
745
746 enum TimerIDs { SWTot,
747 SWPrepITS,
748 SWPrepTPC,
749 SWDoMatching,
750 SWSelectBest,
751 SWRefit,
752 SWABSeeds,
753 SWABMatch,
754 SWABWinners,
755 SWABRefit,
756 SWIO,
757 SWDBG,
758 NStopWatches };
759 static constexpr std::string_view TimerName[] = {"Total", "PrepareITS", "PrepareTPC", "DoMatching", "SelectBest", "Refit",
760 "ABSeeds", "ABMatching", "ABWinners", "ABRefit", "IO", "Debug"};
761 TStopwatch mTimer[NStopWatches];
762};
763
764//______________________________________________
765inline bool MatchTPCITS::isValidatedTPC(const TrackLocTPC& t) const
766{
767 return t.matchID > MinusOne && mMatchRecordsTPC[t.matchID].nextRecID == Validated;
768}
769
770//______________________________________________
771inline bool MatchTPCITS::isValidatedITS(const TrackLocITS& t) const
772{
773 return t.matchID > MinusOne && mMatchRecordsITS[t.matchID].nextRecID == Validated;
774}
775
776//______________________________________________
777inline bool MatchTPCITS::isDisabledITS(const TrackLocITS& t) const { return t.matchID < 0; }
778
779//______________________________________________
780inline bool MatchTPCITS::isDisabledTPC(const TrackLocTPC& t) const { return t.matchID < 0; }
781
782} // namespace globaltracking
783} // namespace o2
784
785#endif
Helper class to read the binary format of TPC ClusterNative.
Helper class to access correction maps.
Definition of the ITSMFT cluster.
Definition of the ClusterTopology class.
Base track model for the Barrel, params only, w/o covariance.
Definition of the BuildTopologyDictionary class for ITS3.
Class to store event ID and index in the event for objects like track, cluster...
Definition of the FIT RecPoints class.
int32_t i
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of the ITSMFT ROFrame (trigger) record.
Configurable params for TPC ITS matching.
Declarations of 2D primitives.
Class to refer to the 1st entry and N elements of some group in the continuous container.
Declarations of the helper class for clusters / roadwidth matching.
o2::track::TrackParCov TrackParCov
Definition Recon.h:39
Definition of TPCFastTransform class.
Definition of the ITS track.
Result of refitting TPC-ITS matched track.
Reference on ITS/MFT clusters set.
calibration data from laser track calibration
void setUseMatCorrFlag(MatCorrType f)
void setDebugTreeFileName(std::string name)
get the name of output debug file
static constexpr int MaxLadderCand
void fillCalibDebug(int ifit, int iTPC, const o2::dataformats::TrackTPCITS &match, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
void reportTiming()
clear results of previous event reco
bool getUseBCFilling() const
set ITS ROFrame duration in microseconds
void setITSROFrameLengthMUS(float fums)
set ITS ROFrame duration in BC (continuous mode only)
@ MatchTreeAccOnly
fill the matching candidates tree only once the cut is passed
@ TPCOrigTree
original TPC tracks with some aux info
@ MatchTreeAll
produce matching candidates tree for all candidates
@ WinnerMatchesTree
separate debug tree for winner matches
void clear()
set Bunch filling and init helpers for validation by BCs
void refitWinners(pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
void refitABWinners(pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::MCCompLabel > &ABTrackletLabels, pmr::vector< int > &ABTrackletClusterIDs, pmr::vector< o2::itsmft::TrkClusRef > &ABTrackletRefs, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
bool refitABTrack(int iITSAB, const TPCABSeed &seed, pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< int > &ABTrackletClusterIDs, pmr::vector< o2::itsmft::TrkClusRef > &ABTrackletRefs)
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
void setNHBPerTF(int n)
ITS readout mode.
bool isDebugFlag(UInt_t flags) const
get debug trees flags
bool runAfterBurner(pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::MCCompLabel > &ABTrackletLabels, pmr::vector< int > &ABTrackletClusterIDs, pmr::vector< o2::itsmft::TrkClusRef > &ABTrackletRefs, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper *maph)
print settings
void reportSizes(pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::itsmft::TrkClusRef > &ABTrackletRefs, pmr::vector< int > &ABTrackletClusterIDs, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::MCCompLabel > &ABTrackletLabels, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
void setMCTruthOn(bool v)
request VDrift calibration
static constexpr int MaxSeedsPerLayer
void fillTPCITSmatchTree(int itsID, int tpcID, int rejFlag, float chi2=-1., float tCorr=0.)
bool refitTrackTPCITS(int slot, int iTPC, int &iITS, pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
static constexpr int MaxUpDnLadders
void run(const o2::globaltracking::RecoContainer &inp, pmr::vector< o2::dataformats::TrackTPCITS > &matchedTracks, pmr::vector< o2::itsmft::TrkClusRef > &ABTrackletRefs, pmr::vector< int > &ABTrackletClusterIDs, pmr::vector< o2::MCCompLabel > &matchLabels, pmr::vector< o2::MCCompLabel > &ABTrackletLabels, pmr::vector< o2::dataformats::Triplet< float, float, float > > &calib)
void setBunchFilling(const o2::BunchFilling &bf)
void dumpTPCOrig(bool acc, int tpcIndex)
void setDebugFlag(UInt_t flag, bool on=true)
set the name of output debug file
o2::globaltracking::MatchTPCITSParams Params
void setITSDictionary(const o2::itsmft::TopologyDictionary *d)
set flag to use MC truth
static constexpr int NITSLayers
perform matching for provided input
const std::string & getDebugTreeFileName() const
fill matching debug tree
UInt_t getDebugFlags() const
set or unset debug stream flag
void setNThreads(int n)
perform all initializations
HMPID cluster implementation.
Definition Cluster.h:27
bool match(const std::vector< std::string > &queries, const char *pattern)
Definition dcs-ccdb.cxx:229
GLdouble n
Definition glcorearb.h:1982
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLdouble f
Definition glcorearb.h:310
GLbitfield flags
Definition glcorearb.h:1570
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
GLuint start
Definition glcorearb.h:469
GLuint id
Definition glcorearb.h:650
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr int NSectors
constexpr int MinusTen
constexpr int MinusOne
constexpr int Validated
flags to tell the status of TPC-ITS tracks comparison
constexpr int Zero
std::vector< T, o2::pmr::polymorphic_allocator< T > > vector
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< ClusRange, o2::its::RecoGeomHelper::getNChips()> chipRefs
o2::dataformats::RangeReference< int, int > ClusRange
o2::math_utils::Bracketf_t tBracket
o2::dataformats::RangeReference< int, int > seedsRef
InteractionCandidate(const o2::InteractionRecord &ir, float t, float dt, int rof, uint32_t f=0)
std::vector< std::deque< ABTrackLink > > threadPool
bool isBetter(const MatchRecord &other) const
int partnerID
id of parnter track entry in mTPCWork or mITSWork containers
int nextRecID
index of eventual next record
int matchedIC
index of eventually matched InteractionCandidate
MatchRecord(int partID, float chi2match, int nxt=MinusOne, int candIC=MinusOne)
bool isBetter(float otherChi2, int otherIC=MinusOne) const
std::array< int, o2::its::RecoGeomHelper::getNLayers()> firstInLr
entry of 1st (best) hypothesis on each layer
void flagLinkUsedClusters(int linkID, std::vector< int > &clStatus) const
int8_t status
status (RS TODO)
int winLinkID
ID of the validated link.
TPCABSeed(int id, int ic, const o2::track::TrackParCov &trc)
void addLink(const o2::track::TrackParCov &trc, int clID, int parentID, int nextID, int lr, int nc, int laddID, float chi2)
const ABTrackLink & getLink(int i) const
int ICCanID
interaction candidate ID (they are sorted in increasing time)
ABTrackLink & getLink(int i)
uint32_t linksEntry
1st entry of the link
static constexpr int8_t NeedAlternative
o2::track::TrackParCov track
Seed propagated to the outer layer under certain time constraint.
int nLinks
number of links
bool checkLinkHasUsedClusters(int linkID, const std::vector< int > &clStatus) const
static LinksPoolMT * gLinksPool
pool of links per thread
int8_t lowestLayer
lowest layer reached
int roFrame
ITS readout frame assigned to this track.
o2::math_utils::Bracketf_t tBracket
bracketing time in \mus
float dL
distance integrated during propagation to reference X (as pion)
int matchID
entry (non if MinusOne) of its matchCand struct in the mMatchesITS
float xrho
x*rho seen during propagation to reference X (as pion)
float time0
nominal time in \mus since start of TF (time0 for bare TPC tracks, constrained time for TRD/TOF const...
int sourceID
TPC track origin in.
float getSignedDT(float dt) const
o2::math_utils::Bracketf_t tBracket
bracketing time in \mus
int matchID
entry (non if MinusOne) of its matchTPC struct in the mMatchesTPC
float getCorrectedTime(float dt) const
float timeErr
time sigma (makes sense for constrained tracks only)
o2::dataformats::GlobalTrackID gid
static constexpr int getNLayers()
static constexpr int getNChips()
VectorOfTObjectPtrs other
o2::InteractionRecord ir(0, 0)