4343#include " DataFormatsTPC/ClusterNativeHelper.h"
4444#include " ITSReconstruction/RecoGeomHelper.h"
4545#include " TPCFastTransform.h"
46+ #include " GlobalTracking/MatchTPCITSParams.h"
4647
4748class TTree ;
4849
@@ -98,7 +99,7 @@ enum TrackRejFlag : int {
9899// /< TPC track parameters propagated to reference X, with time bracket and index of
99100// /< original track in the currently loaded TPC reco output
100101struct TrackLocTPC : public o2 ::track::TrackParCov {
101- TimeBracket timeBins; // /< bracketing time-bins
102+ o2::utils::Bracket< float > timeBins; // /< bracketing time-bins
102103 int sourceID = 0 ; // /< track origin id
103104 float zMin = 0 ; // min possible Z of this track
104105 float zMax = 0 ; // max possible Z of this track
@@ -141,7 +142,7 @@ struct ABTrackLink : public o2::track::TrackParCov {
141142 int icCandID = MinusOne; // /< ID of the interaction candidate this track belongs to
142143 uint8_t nDaughters = 0 ; // /< number of daughter links on lower layers
143144 int8_t layerID = -1 ; // /< layer ID
144- uint8_t ladderID = 0xff ; // /< ladder ID in the layer (used for seeds with 2 hits in the layer)
145+ uint8_t ladderID = 0xff ; // /< ladder ID in the layer (used for seeds with 2 hits in the layer)
145146 float chi2 = 0 .f; // /< chi2 after update
146147#ifdef _ALLOW_DEBUG_AB_
147148 o2::track::TrackParCov seed; // seed before update
@@ -152,7 +153,7 @@ struct ABTrackLink : public o2::track::TrackParCov {
152153 bool isDisabled () const { return clID == Disabled; }
153154 void disable () { clID = Disabled; }
154155 bool isDummyTop () const { return clID == MinusTen; }
155- float chi2Norm () const { return layerID< o2::its::RecoGeomHelper::getNLayers () ? chi2/ (o2::its::RecoGeomHelper::getNLayers ()- layerID) : 999 .; }
156+ float chi2Norm () const { return layerID < o2::its::RecoGeomHelper::getNLayers () ? chi2 / (o2::its::RecoGeomHelper::getNLayers () - layerID) : 999 .; }
156157 float chi2NormPredict (float chi2cl) const { return (chi2 + chi2cl) / (1 + o2::its::RecoGeomHelper::getNLayers () - layerID); }
157158};
158159
@@ -173,14 +174,13 @@ struct ABTrackLinksList {
173174 void validate () { status = Validated; }
174175};
175176
176- struct ABOrderLink { // /< link used for cross-layer sorting of best ABTrackLinks of the ABTrackLinksList
177- int trackLinkID = MinusOne; // /< ABTrackLink ID
178- int nextLinkID = MinusOne; // /< indext on the next ABOrderLink
177+ struct ABOrderLink { // /< link used for cross-layer sorting of best ABTrackLinks of the ABTrackLinksList
178+ int trackLinkID = MinusOne; // /< ABTrackLink ID
179+ int nextLinkID = MinusOne; // /< indext on the next ABOrderLink
179180 ABOrderLink () = default ;
180181 ABOrderLink (int id, int nxt = MinusOne) : trackLinkID(id), nextLinkID(nxt) {}
181182};
182-
183-
183+
184184// ---------------------------------------------------
185185struct ABDebugLink : o2::BaseCluster<float > {
186186#ifdef _ALLOW_DEBUG_AB_
@@ -257,6 +257,7 @@ class MatchTPCITS
257257 using MCLabCont = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;
258258 using TPCTransform = o2::gpu::TPCFastTransform;
259259 using BracketF = o2::utils::Bracket<float >;
260+ using Params = o2::globaltracking::MatchITSTPCParams;
260261
261262 public:
262263 MatchTPCITS (); // std::unique_ptr to forward declared type needs constructor / destructor in .cxx
@@ -320,10 +321,6 @@ class MatchTPCITS
320321 // /< set ITS 0-th ROFrame time start in \mus
321322 void setITSROFrameOffsetMUS (float v) { mITSROFrameOffsetMUS = v; }
322323
323- // /< After-burner getter/setter
324- void setRunAfterBurner (bool v) { mRunAfterBurner = v; }
325- bool isRunAfterBurner () const { return mRunAfterBurner ; }
326-
327324 // ==================== >> DPL-driven input >> =======================
328325
329326 // /< set flag to use MC truth from the DPL input
@@ -382,14 +379,6 @@ class MatchTPCITS
382379 mTPCTrackClusIdx = inp;
383380 }
384381
385- // /< set input TPC tracks cluster indices received via DPL
386- // TODO Temporary solution, see disclaimer about TPCClRefElem in TrackTPC. Later should be changed to uint32_t
387- void setTPCTrackClusIdxInp (const gsl::span<const o2::tpc::TPCClRefElem> inp)
388- {
389- assertDPLIO (true );
390- mTPCTrackClusIdxInp = inp;
391- }
392-
393382 // /< set input TPC clusters received via DPL
394383 void setTPCClustersInp (const o2::tpc::ClusterNativeAccess* inp)
395384 {
@@ -420,9 +409,10 @@ class MatchTPCITS
420409
421410 // /< set input FIT info received via DPL
422411 void setFITInfoInp (const std::vector<o2::ft0::RecPoints>* inp)
412+ // void setFITInfoInp(const gsl::span<const o2::ft0::RecPoints> inp) // FT0 recpoints are not yet
423413 {
424414 assertDPLIO (true );
425- mFITInfoInp = inp;
415+ mFITInfo = inp;
426416 }
427417
428418 // ===================== << DPL-driven input << ========================
@@ -486,45 +476,6 @@ class MatchTPCITS
486476
487477 // <<< ====================== options =============================<<<
488478
489- // >>> ====================== cuts ================================>>>
490-
491- // /< set cuts on absolute difference of ITS vs TPC track parameters
492- void setCrudeAbsDiffCut (const std::array<float , o2::track::kNParams >& vals) { mCrudeAbsDiffCut = vals; }
493- // /< get cuts on absolute difference of ITS vs TPC track parameters
494- const std::array<float , o2::track::kNParams >& getCrudeAbsDiffCut () const { return mCrudeAbsDiffCut ; }
495-
496- // /< set cuts on difference^2/sig^2 of ITS vs TPC track parameters
497- void setCrudeNSigma2Cut (const std::array<float , o2::track::kNParams >& vals) { mCrudeNSigma2Cut = vals; }
498- // /< get cuts on absolute difference of ITS vs TPC track parameters
499- const std::array<float , o2::track::kNParams >& getCrudeNSigma2Cut () const { return mCrudeNSigma2Cut ; }
500-
501- // /< set cut matching chi2
502- void setCutMatchingChi2 (float val) { mCutMatchingChi2 = val; }
503- // /< get cut on matching chi2
504- float getCutMatchingChi2 () const { return mCutMatchingChi2 ; }
505-
506- // /< set cut on AB track-cluster chi2
507- void setCutABTrack2ClChi2 (float val) { mCutABTrack2ClChi2 = val; }
508- // /< get cut on matching chi2
509- float getCutABTrack2ClChi2 () const { return mCutABTrack2ClChi2 ; }
510-
511- // /< set max number of matching candidates to consider
512- void setMaxMatchCandidates (int n) { mMaxMatchCandidates = n > 1 ? 1 : n; }
513- // /< get max number of matching candidates to consider
514- int getMaxMatchCandidates () const { return mMaxMatchCandidates ; }
515-
516- // /< set tolerance (TPC time bins) on ITS-TPC times comparison
517- void setTimeBinTolerance (float val) { mTimeBinTolerance = val; }
518- // /< get tolerance (TPC time bins) on ITS-TPC times comparison
519- float getTimeBinTolerance () const { return mTimeBinTolerance ; }
520-
521- // /< set tolerance on TPC time-bins estimate from highest cluster Z
522- void setTPCTimeEdgeZSafeMargin (float val) { mTPCTimeEdgeZSafeMargin = val; }
523- // /< get tolerance on TPC time-bins estimate from highest cluster Z
524- float getTPCTimeEdgeZSafeMargin () const { return mTPCTimeEdgeZSafeMargin ; }
525-
526- // <<< ====================== cuts ================================<<<
527-
528479#ifdef _ALLOW_DEBUG_TREES_
529480 enum DebugFlagTypes : UInt_t {
530481 MatchTreeAll = 0x1 << 1 , // /< produce matching candidates tree for all candidates
@@ -567,7 +518,6 @@ class MatchTPCITS
567518 int prepareTPCTracksAfterBurner ();
568519 bool prepareTPCTracks ();
569520 bool prepareITSTracks ();
570- bool prepareITSClusters ();
571521 bool prepareFITInfo ();
572522 bool loadTPCTracks ();
573523 bool loadTPCClusters ();
@@ -649,48 +599,22 @@ class MatchTPCITS
649599 bool mMCTruthON = false ; // /< flag availability of MC truth
650600
651601 o2::InteractionRecord mStartIR ; // /< IR corresponding to the start of the TF
602+
652603 // /========== Parameters to be set externally, e.g. from CCDB ====================
604+ const Params* mParams = nullptr ;
605+
653606 int mUseMatCorrFlag = o2::base::Propagator::USEMatCorrTGeo;
654607
655608 bool mITSTriggered = false ; // /< ITS readout is triggered
656609
657610 // /< do we use track Z difference to reject fake matches? makes sense for triggered mode only
658611 bool mCompareTracksDZ = false ;
659612
660- // /< do we want to run an afterburner for secondaries matchint?
661- bool mRunAfterBurner = true ;
662-
663- // /<tolerance on abs. different of ITS/TPC params
664- std::array<float , o2::track::kNParams > mCrudeAbsDiffCut = {2 .f , 2 .f , 0 .2f , 0 .2f , 4 .f };
665-
666- // /<tolerance on per-component ITS/TPC params NSigma
667- std::array<float , o2::track::kNParams > mCrudeNSigma2Cut = {49 .f , 49 .f , 49 .f , 49 .f , 49 .f };
668-
669- float mMinTPCPt = 0.04 ; // /< cut on minimal pT of TPC tracks to consider for matching
670- int mMinTPCClusters = 25 ; // /< minimum number of clusters to consider
671- int mAskMinTPCRow = 15 ; // /< disregard tracks starting above this row
672-
673- float mCutMatchingChi2 = 30 .f; // /< cut on matching chi2
674-
675- float mCutABTrack2ClChi2 = 30 .f; // /< cut on AfterBurner track-cluster chi2
676-
677613 float mSectEdgeMargin2 = 0 .; // /< crude check if ITS track should be matched also in neighbouring sector
678614
679- int mMaxMatchCandidates = 5 ; // /< max allowed matching candidates per TPC track
680-
681- int mABRequireToReachLayer = 5 ; // /< AB tracks should reach at least this layer from above
682-
683- // /< safety margin (in TPC time bins) for ITS-TPC tracks time (in TPC time bins!) comparison
684- float mTPCITSTimeBinSafeMargin = 1 .f;
685-
686- // /< safety margin in cm when estimating TPC track tMin and tMax from assigned time0 and its
687- // /< track Z position
688- float mTPCTimeEdgeZSafeMargin = 20 .f;
689-
690615 // /< safety margin in TPC time bins when estimating TPC track tMin and tMax from
691616 // /< assigned time0 and its track Z position (converted from mTPCTimeEdgeZSafeMargin)
692617 float mTPCTimeEdgeTSafeMargin = 0 .f;
693- float mTimeBinTolerance = 10 .f; // /<tolerance in time-bin for ITS-TPC time bracket matching
694618
695619 float mITSROFrameLengthMUS = -1 .; // /< ITS RO frame in \mus
696620 float mITSROFrameOffsetMUS = 0 ; // /< time in \mus corresponding to start of 1st ITS ROFrame,
@@ -744,7 +668,11 @@ class MatchTPCITS
744668 const std::vector<o2::itsmft::ROFRecord>* mITSClusterROFRecPtr = nullptr ; // /< input ITS clusters ROFRecord from tree
745669 gsl::span<const o2::itsmft::ROFRecord> mITSClusterROFRec ; // /< input ITS clusters ROFRecord span from DPL
746670
747- const std::vector<o2::ft0::RecPoints>* mFITInfoInp = nullptr ; // /< optional input FIT info
671+ const std::vector<o2::ft0::RecPoints>* mFITInfoPtr = nullptr ; // /< optional input FIT info from the tree
672+ // FT0 is not POD yet
673+ const std::vector<o2::ft0::RecPoints>* mFITInfo = nullptr ; // /< optional input FIT info span from DPL
674+ // gsl::span<const o2::ft0::RecPoints> mFITInfo; ///< optional input FIT info span from DPL
675+
748676 const o2::tpc::ClusterNativeAccess* mTPCClusterIdxStruct = nullptr ; // /< struct holding the TPC cluster indices
749677
750678 const MCLabCont* mITSTrkLabels = nullptr ; // /< input ITS Track MC labels
@@ -910,7 +838,7 @@ inline void MatchTPCITS::flagUsedITSClusters(const o2::its::TrackITS& track, int
910838 // flag clusters used by this track
911839 int clEntry = track.getFirstClusterEntry ();
912840 for (int icl = track.getNumberOfClusters (); icl--;) {
913- mABClusterLinkIndex [rofOffset + (* mITSTrackClusIdxInp ) [clEntry++]] = MinusTen;
841+ mABClusterLinkIndex [rofOffset + mITSTrackClusIdx [clEntry++]] = MinusTen;
914842 }
915843}
916844// __________________________________________________________
@@ -922,7 +850,7 @@ inline int MatchTPCITS::preselectChipClusters(std::vector<int>& clVecOut, const
922850 int icID = clRange.getFirstEntry ();
923851 for (int icl = clRange.getEntries (); icl--;) { // note: clusters within a chip are sorted in Z
924852 int clID = clRefs.clusterID [icID++]; // so, we go in clusterID increasing direction
925- const auto & cls = (* mITSClustersArrayInp ) [clID];
853+ const auto & cls = mITSClustersArray [clID];
926854 float dz = trackZ - cls.getZ ();
927855 auto label = mITSClsLabels ->getLabels (clID)[0 ]; // tmp
928856 // if (!(label == lblTrc)) {
0 commit comments