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 "GPUO2InterfaceRefit.h"
52#include "GPUTPCGeometry.h"
57#include "TPCFastTransformPOD.h"
58#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
60#endif
61#ifdef ENABLE_UPGRADES
63#endif
64
65class TTree;
66
67namespace o2
68{
69
70namespace globaltracking
71{
72class RecoContainer;
73}
74
75namespace dataformats
76{
77template <typename TruthElement>
79}
80
81namespace its
82{
83class TrackITS;
84}
85
86namespace itsmft
87{
88class Cluster;
89}
90
91namespace tpc
92{
93class TrackTPC;
94class VDriftCorrFact;
95} // namespace tpc
96
97namespace gpu
98{
99struct GPUParam;
100}
101
102namespace globaltracking
103{
104
105constexpr int Zero = 0;
106constexpr int MinusOne = -1;
107constexpr int MinusTen = -10;
108constexpr int Validated = -2;
109
122
126 enum Constraint_t : uint8_t { Constrained,
130 float time0 = 0.f;
131 float timeErr = 0.f;
132 int sourceID = 0;
133 o2::dataformats::GlobalTrackID gid{}; // global track source ID (TPC track may be part of it)
135 uint8_t lowestRow = -1;
136 uint8_t padFromEdge = -1;
138
139 float getCorrectedTime(float dt) const // return time0 corrected for extra drift (to match certain Z)
140 {
141 return constraint == Constrained ? time0 : (constraint == ASide ? time0 + dt : time0 - dt);
142 }
143 float getSignedDT(float dt) const // account for TPC side in time difference for dt=external_time - tpc.time0
144 {
145 return constraint == Constrained ? 0.f : (constraint == ASide ? dt : -dt);
146 }
147
149};
150
154 enum : uint16_t { CloneBefore = 0x1,
155 CloneAfter = 0x2 };
157 int sourceID = 0;
160 float xrho = 0;
161 float dL = 0;
162 bool hasCloneBefore() const { return getUserField() & CloneBefore; }
163 bool hasCloneAfter() const { return getUserField() & CloneAfter; }
164 int getCloneShift() const { return hasCloneBefore() ? -1 : (hasCloneAfter() ? 1 : 0); }
165 void setCloneBefore() { setUserField(getUserField() | CloneBefore); }
166 void setCloneAfter() { setUserField(getUserField() | CloneAfter); }
167
169};
170
174 float chi2 = -1.f;
178 MatchRecord(int partID, float chi2match, int nxt = MinusOne, int candIC = MinusOne) : partnerID(partID), chi2(chi2match), nextRecID(nxt), matchedIC(candIC) {}
179 MatchRecord() = default;
180
181 bool isBetter(float otherChi2, int otherIC = MinusOne) const
182 { // prefer record with matched IC candidate, otherwise, better chi2
183 if (otherIC == MinusOne) {
184 return matchedIC == MinusOne ? chi2 < otherChi2 : true;
185 } else {
186 return matchedIC == MinusOne ? false : chi2 < otherChi2;
187 }
188 }
189
190 bool isBetter(const MatchRecord& other) const
191 {
192 return isBetter(other.chi2, other.matchedIC);
193 }
194};
195
199 static constexpr int Disabled = -2;
203 uint8_t nDaughters = 0;
204 int8_t layerID = -1;
205 int8_t nContLayers = 0;
206 uint8_t ladderID = 0xff;
207 float chi2 = 0.f;
208
209 ABTrackLink() = default;
210 ~ABTrackLink() = default;
211 ABTrackLink(const o2::track::TrackParCov& tr, int cl, int parID, int nextID, int lr, int nc, int ld, float _chi2)
212 : o2::track::TrackParCov(tr), clID(cl), parentID(parID), nextOnLr(nextID), layerID(int8_t(lr)), nContLayers(int8_t(nc)), ladderID(uint8_t(ld)), chi2(_chi2) {}
213
214 bool isDisabled() const { return clID == Disabled; }
215 void disable() { clID = Disabled; }
216 bool isDummyTop() const { return clID == MinusTen; }
218 float chi2NormPredict(float chi2cl) const { return (chi2 + chi2cl) / (1 + o2::its::RecoGeomHelper::getNLayers() - layerID); }
219};
220
222 std::vector<std::deque<ABTrackLink>> threadPool;
223};
224
225// AB primary seed: TPC track propagated to outermost ITS layer under specific InteractionCandidate hypothesis
226struct TPCABSeed {
227 static constexpr int8_t NeedAlternative = -3;
231 uint32_t linksEntry = 0;
232 int nLinks = 0;
234 int8_t status = MinusOne;
235 uint8_t threadID = 0;
239
240 TPCABSeed(int id, int ic, const o2::track::TrackParCov& trc) : tpcWID(id), ICCanID(ic), track(trc)
241 {
242 firstInLr.fill(MinusOne);
243 }
244 bool isDisabled() const { return status == MinusTen; }
245 void disable() { status = MinusTen; }
246 bool isValidated() const { return status == Validated; }
247 void validate(int lID)
248 {
249 winLinkID = lID;
251 }
253 bool needAlteranative() const { return status == NeedAlternative; }
256 const ABTrackLink& getLink(int i) const { return gLinksPool->threadPool[threadID][i + linksEntry]; }
257 void addLink(const o2::track::TrackParCov& trc, int clID, int parentID, int nextID, int lr, int nc, int laddID, float chi2)
258 {
259 gLinksPool->threadPool[threadID].push_back({trc, clID, parentID, nextID, lr, nc, laddID, chi2});
260 nLinks++;
261 }
262 int getNLinks() const { return nLinks; }
267 bool checkLinkHasUsedClusters(int linkID, const std::vector<int>& clStatus) const
268 {
269 // check if some clusters used by the link or its parents are forbidden (already used by validatet track)
270 while (linkID > MinusOne) {
271 const auto& link = getLink(linkID);
272 if (link.clID > MinusOne && clStatus[link.clID] != MinusOne) {
273 return true;
274 }
275 linkID = link.parentID;
276 }
277 return false;
278 }
279 void flagLinkUsedClusters(int linkID, std::vector<int>& clStatus) const
280 {
281 // check if some clusters used by the link or its parents are forbidden (already used by validated track)
282 while (linkID > MinusOne) {
283 const auto& link = getLink(linkID);
284 if (link.clID > MinusOne) {
285 clStatus[link.clID] = MinusTen;
286 }
287 linkID = link.parentID;
288 }
289 }
290 size_t sizeInternal() const { return sizeof(ABTrackLink) * getNLinks(); }
291 size_t capInternal() const { return sizeof(ABTrackLink) * getNLinks(); }
292};
293
296 int rofITS; // corresponding ITS ROF entry (in the ROFRecord vectors)
297 uint32_t flag; // origin, etc.
299 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) {}
300};
301
306 std::vector<int> clusterID; // indices of sorted clusters
307
308#ifndef ENABLE_UPGRADES
309 std::array<ClusRange, o2::its::RecoGeomHelper::getNChips()> chipRefs; // offset and number of clusters in each chip
310 ITSChipClustersRefs(int nclIni = 50000)
311 {
312 clusterID.reserve(nclIni);
313 }
314#else
315 std::vector<ClusRange> chipRefs; // offset and number of clusters in each chip
316 ITSChipClustersRefs(int nchips = o2::its::RecoGeomHelper::getNChips(), int nclIni = 50000)
317 {
318 clusterID.reserve(nclIni);
319 chipRefs.resize(nchips, ClusRange());
320 }
321#endif
322
323 void clear()
324 {
325 clusterID.clear();
326 std::memset(chipRefs.data(), 0, chipRefs.size() * sizeof(ClusRange)); // reset chip->cluster references
327 }
328 size_t sizeInternal() const { return sizeof(int) * clusterID.size(); }
329 size_t capInternal() const { return sizeof(int) * clusterID.capacity(); }
330};
331
333{
334 public:
343
344 MatchTPCITS(); // std::unique_ptr to forward declared type needs constructor / destructor in .cxx
346
347 static constexpr int MaxUpDnLadders = 3; // max N ladders to check up and down from selected one
348 static constexpr int MaxLadderCand = 2 * MaxUpDnLadders + 1; // max ladders to check for matching clusters
349 static constexpr int MaxSeedsPerLayer = 50; // TODO
352#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
356 pmr::vector<int>& ABTrackletClusterIDs,
357 pmr::vector<o2::MCCompLabel>& matchLabels,
358 pmr::vector<o2::MCCompLabel>& ABTrackletLabels,
365 pmr::vector<int>& ABTrackletClusterIDs,
366 pmr::vector<o2::MCCompLabel>& matchLabels,
367 pmr::vector<o2::MCCompLabel>& ABTrackletLabels,
369 bool runAfterBurner(pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<o2::MCCompLabel>& matchLabels, pmr::vector<o2::MCCompLabel>& ABTrackletLabels, pmr::vector<int>& ABTrackletClusterIDs,
371 void refitABWinners(pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<o2::MCCompLabel>& matchLabels, pmr::vector<o2::MCCompLabel>& ABTrackletLabels, pmr::vector<int>& ABTrackletClusterIDs,
373 bool refitABTrack(int iITSAB, const TPCABSeed& seed, pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<int>& ABTrackletClusterIDs, pmr::vector<o2::itsmft::TrkClusRef>& ABTrackletRefs);
374#endif // CLING
375 void setSkipTPCOnly(bool v)
376 {
377 mSkipTPCOnly = v;
378 }
379 void setCosmics(bool v) { mCosmics = v; }
380 bool isCosmics() const { return mCosmics; }
381 void setNThreads(int n);
382
384 void init();
385 void end();
386 void reportTiming();
387
389 void clear();
390
392 void setBunchFilling(const o2::BunchFilling& bf);
393
394 void setNHBPerTF(int n) { mNHBPerTF = n; }
395
397 void setITSTriggered(bool v) { mITSTriggered = v; }
398 bool isITSTriggered() const { return mITSTriggered; }
399
400 void setUseFT0(bool v) { mUseFT0 = v; }
401 bool getUseFT0() const { return mUseFT0; }
402
403 void setUseBCFilling(bool v) { mUseBCFilling = v; }
404 bool getUseBCFilling() const { return mUseBCFilling; }
405
407 void setITSROFrameLengthMUS(float fums);
409 void setITSROFrameLengthInBC(int nbc);
410
411 void setITSTimeBiasInBC(int n);
412 int getITSTimeBiasInBC() const { return mITSTimeBiasInBC; }
413 float getITSTimeBiasMUS() const { return mITSTimeBiasMUS; }
414
415 // ==================== >> DPL-driven input >> =======================
416 void setITSDictionary(const o2::itsmft::TopologyDictionary* d) { mITSDict = d; }
417#ifdef ENABLE_UPGRADES
418 void setIT3Dictionary(const o2::its3::TopologyDictionary* d)
419 {
420 mIT3Dict = d;
421 }
422#endif
423
425 void setMCTruthOn(bool v)
426 {
427 mMCTruthON = v;
428 }
429
431 void setVDriftCalib(bool v)
432 {
433 mVDriftCalibOn = v;
434 }
436 void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph, float lumi);
437
439 void print() const;
440 void printCandidatesTPC() const;
441 void printCandidatesITS() const;
442
443 //>>> ====================== options =============================>>>
444 void setUseMatCorrFlag(MatCorrType f) { mUseMatCorrFlag = f; }
445 auto getUseMatCorrFlag() const { return mUseMatCorrFlag; }
446
447 //<<< ====================== options =============================<<<
448
449#ifdef _ALLOW_DEBUG_TREES_
450 enum DebugFlagTypes : UInt_t {
451 MatchTreeAll = 0x1 << 1,
452 MatchTreeAccOnly = 0x1 << 2,
453 WinnerMatchesTree = 0x1 << 3,
454 TPCOrigTree = 0x1 << 4
455 };
457 bool isDebugFlag(UInt_t flags) const { return mDBGFlags & flags; }
458
460 UInt_t getDebugFlags() const { return mDBGFlags; }
461
463 void setDebugFlag(UInt_t flag, bool on = true);
464
466 void setDebugTreeFileName(std::string name)
467 {
468 if (!name.empty()) {
469 mDebugTreeFileName = name;
470 }
471 }
472
474 const std::string& getDebugTreeFileName() const { return mDebugTreeFileName; }
475
477 void fillTPCITSmatchTree(int itsID, int tpcID, int rejFlag, float chi2 = -1., float tCorr = 0.);
479 void dumpTPCOrig(bool acc, int tpcIndex);
480#endif
481
482 private:
483 void updateTimeDependentParams();
484
485 int findLaddersToCheckBOn(int ilr, int lad0, const o2::math_utils::CircleXYf_t& circle, float errYFrac,
486 std::array<int, MaxLadderCand>& lad2Check) const;
487 int findLaddersToCheckBOff(int ilr, int lad0, const o2::math_utils::IntervalXYf_t& trcLinPar, float errYFrac,
488 std::array<int, MatchTPCITS::MaxLadderCand>& lad2Check) const;
489 bool prepareTPCData();
490 bool prepareITSData();
491 bool prepareFITData();
492 int prepareInteractionTimes();
493 int prepareTPCTracksAfterBurner();
494 int addTPCSeed(const o2::track::TrackParCov& _tr, float t0, float terr, o2::dataformats::GlobalTrackID srcGID, int tpcID);
495
496 int preselectChipClusters(std::vector<int>& clVecOut, const ClusRange& clRange, const ITSChipClustersRefs& itsChipClRefs,
497 float trackY, float trackZ, float tolerY, float tolerZ) const;
498 void fillClustersForAfterBurner(int rofStart, int nROFs, ITSChipClustersRefs& itsChipClRefs);
499 void flagUsedITSClusters(const o2::its::TrackITS& track);
500
501 void doMatching(int sec);
502
503 bool refitTPCInward(o2::track::TrackParCov& trcIn, float& chi2, float xTgt, int trcID, float timeTB) const;
504
505 void selectBestMatches();
506 bool validateTPCMatch(int iTPC);
507 void removeITSfromTPC(int itsID, int tpcID);
508 void removeTPCfromITS(int tpcID, int itsID);
509 bool isValidatedTPC(const TrackLocTPC& t) const;
510 bool isValidatedITS(const TrackLocITS& t) const;
511 bool isDisabledTPC(const TrackLocTPC& t) const;
512 bool isDisabledITS(const TrackLocITS& t) const;
513
514 int compareTPCITSTracks(const TrackLocITS& tITS, const TrackLocTPC& tTPC, float& chi2) const;
515 float getPredictedChi2NoZ(const o2::track::TrackParCov& trITS, const o2::track::TrackParCov& trTPC) const;
516 bool propagateToRefX(o2::track::TrackParCov& trc, o2::track::TrackLTIntegral* lti = nullptr);
517 void addLastTrackCloneForNeighbourSector(int sector, o2::track::TrackLTIntegral* trackLTInt = nullptr);
518
520 bool registerMatchRecordTPC(int iITS, int iTPC, float chi2, int candIC = MinusOne);
521 void registerMatchRecordITS(int iITS, int iTPC, float chi2, int candIC = MinusOne);
522 void suppressMatchRecordITS(int iITS, int iTPC);
523
525 int getNMatchRecordsTPC(const TrackLocTPC& tTPC) const;
526
528 int getNMatchRecordsITS(const TrackLocITS& tITS) const;
529
531 BracketIR tBracket2IRBracket(const BracketF tbrange);
532
534 int time2ITSROFrameCont(float t) const
535 {
536 int rof = (t - mITSTimeBiasMUS) * mITSROFrameLengthMUSInv;
537 if (rof < 0) {
538 rof = 0;
539 }
540 // the rof is estimated continuous counter but the actual bins might have gaps (e.g. HB rejects etc)-> use mapping
541 return rof < int(mITSTrackROFContMapping.size()) ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
542 }
543
545 int time2ITSROFrameTrig(float t, int start) const
546 {
547 t -= mITSTimeBiasMUS;
548 while (start < int(mITSROFTimes.size())) {
549 if (mITSROFTimes[start].getMax() > t) {
550 return start;
551 }
552 start++;
553 }
554 return --start;
555 }
556
558 float tpcTimeBin2Z(float tbn) const { return tbn * mTPCBin2Z; }
559
561 float tpcTimeBin2MUS(float tbn) const { return tbn * mTPCTBinMUS; }
562
564 float tpcTimeBin2NS(float tbn) const { return tbn * mTPCTBinNS; }
565
567 float z2TPCBin(float z) const { return z * mZ2TPCBin; }
568
570 float tpcBin2Z(float t) const { return t * mTPCBin2Z; }
571
573 int roughCheckDif(float delta, float toler, int rejFlag) const
574 {
575 return delta > toler ? rejFlag : (delta < -toler ? -rejFlag : Accept);
576 }
577
578 // ========================= AFTERBURNER =========================
579 int prepareABSeeds();
580 void processABSeed(int sid, const ITSChipClustersRefs& itsChipClRefs, uint8_t tID);
581 int followABSeed(const o2::track::TrackParCov& seed, const ITSChipClustersRefs& itsChipClRefs, int seedID, int lrID, TPCABSeed& ABSeed);
582 int registerABTrackLink(TPCABSeed& ABSeed, const o2::track::TrackParCov& trc, int clID, int parentID, int lr, int laddID, float chi2Cl);
583 bool isBetter(float chi2A, float chi2B) { return chi2A < chi2B; } // RS FIMXE TODO
584 void accountForOverlapsAB(int lrSeed);
585 float correctTPCTrack(o2::track::TrackParCov& trc, const TrackLocTPC& tTPC, const InteractionCandidate& cand) const; // RS FIXME will be needed for refit
586 //================================================================
587
588 bool mInitDone = false;
589 bool mFieldON = true;
590 bool mCosmics = false;
591 bool mMCTruthON = false;
592 float mBz = 0;
593 int mTFCount = 0;
594 int mNThreads = 1;
595 int mNHBPerTF = 0;
596 int mNTPCOccBinLength = 0;
597 float mNTPCOccBinLengthInv;
598 o2::InteractionRecord mStartIR{0, 0};
599
601 const Params* mParams = nullptr;
602 const o2::ft0::InteractionTag* mFT0Params = nullptr;
603
604 MatCorrType mUseMatCorrFlag = MatCorrType::USEMatCorrTGeo;
605 bool mUseBCFilling = false;
606 bool mSkipTPCOnly = false;
607 bool mITSTriggered = false;
608 bool mUseFT0 = false;
609
611 bool mCompareTracksDZ = false;
612
613 float YMaxAtXMatchingRef = 999.;
614
615 float mSectEdgeMargin = 0.;
616
619 float mTPCTimeEdgeTSafeMargin = 0.f;
620 float mTPCExtConstrainedNSigmaInv = 0.f; // inverse for NSigmas for TPC time-interval from external constraint time sigma
621 int mITSROFrameLengthInBC = 0;
622 float mITSROFrameLengthMUS = -1.;
623 float mITSTimeResMUS = -1.;
624 float mITSROFrameLengthMUSInv = -1.;
625 int mITSTimeBiasInBC = 0;
626 float mITSTimeBiasMUS = 0.;
627 float mTPCVDrift = -1.;
628 float mTPCVDriftInv = -1.;
629 float mTPCDriftTimeOffset = 0;
630 float mTPCTBinMUS = 0.;
631 float mTPCTBinNS = 0.;
632 float mTPCTBinMUSInv = 0.;
633 float mZ2TPCBin = 0.;
634 float mTPCBin2Z = 0.;
635 float mNTPCBinsFullDrift = 0.;
636 float mTPCZMax = 0.;
637 float mTPCmeanX0Inv = 1. / 31850.;
638
639 float mMinTPCTrackPtInv = 999.;
640 float mMinITSTrackPtInv = 999.;
641 bool mVDriftCalibOn = false;
642 o2::tpc::VDriftCorrFact mTPCDrift{};
643 const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
644 float mLumiCTP{-1};
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.
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
POD correction map.
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
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD *maph, float lumi)
print settings
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 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, fair::mq::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)
LumiInfo lumi