Skip to content

Commit 3da7940

Browse files
committed
Cleanup, use configurable params for TPC/ITS matcher
1 parent 0d61c49 commit 3da7940

17 files changed

Lines changed: 401 additions & 456 deletions

File tree

Common/MathUtils/CMakeLists.txt

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,55 @@
88
# granted to it by virtue of its status as an Intergovernmental Organization or
99
# submit itself to any jurisdiction.
1010

11-
o2_add_library(MathUtils
12-
SOURCES src/CachingTF1.cxx
13-
src/Cartesian2D.cxx
14-
src/Cartesian3D.cxx
15-
src/Chebyshev3D.cxx
16-
src/Chebyshev3DCalc.cxx
17-
src/MathBase.cxx
18-
src/RandomRing.cxx
19-
src/Primitive2D.cxx
20-
PUBLIC_LINK_LIBRARIES ROOT::Hist
21-
FairRoot::Base
22-
O2::CommonConstants
23-
O2::GPUCommon
24-
ROOT::GenVector
25-
ROOT::Geom
26-
Vc::Vc)
11+
o2_add_library(
12+
MathUtils
13+
SOURCES src/CachingTF1.cxx
14+
src/Cartesian2D.cxx
15+
src/Cartesian3D.cxx
16+
src/Chebyshev3D.cxx
17+
src/Chebyshev3DCalc.cxx
18+
src/MathBase.cxx
19+
src/RandomRing.cxx
20+
src/Primitive2D.cxx
21+
PUBLIC_LINK_LIBRARIES
22+
ROOT::Hist
23+
FairRoot::Base
24+
O2::CommonConstants
25+
O2::GPUCommon
26+
ROOT::GenVector
27+
ROOT::Geom
28+
Vc::Vc)
2729

28-
o2_target_root_dictionary(MathUtils
29-
HEADERS include/MathUtils/Utils.h
30-
include/MathUtils/Chebyshev3D.h
31-
include/MathUtils/Chebyshev3DCalc.h
32-
include/MathUtils/MathBase.h
33-
include/MathUtils/Cartesian2D.h
34-
include/MathUtils/Cartesian3D.h
35-
include/MathUtils/CachingTF1.h
36-
include/MathUtils/RandomRing.h
37-
include/MathUtils/Primitive2D.h
38-
include/MathUtils/Bracket.h)
30+
o2_target_root_dictionary(
31+
MathUtils
32+
HEADERS include/MathUtils/Utils.h
33+
include/MathUtils/Chebyshev3D.h
34+
include/MathUtils/Chebyshev3DCalc.h
35+
include/MathUtils/MathBase.h
36+
include/MathUtils/Cartesian2D.h
37+
include/MathUtils/Cartesian3D.h
38+
include/MathUtils/CachingTF1.h
39+
include/MathUtils/RandomRing.h
40+
include/MathUtils/Primitive2D.h
41+
include/MathUtils/Bracket.h)
3942

40-
o2_add_test(CachingTF1
41-
SOURCES test/testCachingTF1.cxx
42-
COMPONENT_NAME MathUtils
43-
PUBLIC_LINK_LIBRARIES O2::MathUtils
44-
LABELS utils)
43+
o2_add_test(
44+
CachingTF1
45+
SOURCES test/testCachingTF1.cxx
46+
COMPONENT_NAME MathUtils
47+
PUBLIC_LINK_LIBRARIES O2::MathUtils
48+
LABELS utils)
4549

46-
o2_add_test(Cartesian3D
47-
SOURCES test/testCartesian3D.cxx
48-
COMPONENT_NAME MathUtils
49-
PUBLIC_LINK_LIBRARIES O2::MathUtils
50-
LABELS utils)
50+
o2_add_test(
51+
Cartesian3D
52+
SOURCES test/testCartesian3D.cxx
53+
COMPONENT_NAME MathUtils
54+
PUBLIC_LINK_LIBRARIES O2::MathUtils
55+
LABELS utils)
5156

52-
o2_add_test(Utils
53-
SOURCES test/testUtils.cxx
54-
COMPONENT_NAME MathUtils
55-
PUBLIC_LINK_LIBRARIES O2::MathUtils
56-
LABELS utils)
57+
o2_add_test(
58+
Utils
59+
SOURCES test/testUtils.cxx
60+
COMPONENT_NAME MathUtils
61+
PUBLIC_LINK_LIBRARIES O2::MathUtils
62+
LABELS utils)

DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/Cluster.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,4 @@ struct is_messageable<o2::itsmft::Cluster> : std::true_type {
206206

207207
} // namespace o2
208208

209-
template <>
210-
struct o2::framework::is_messageable<o2::itsmft::Cluster> : std::true_type {
211-
};
212-
213209
#endif /* ALICEO2_ITSMFT_CLUSTER_H */

Detectors/GlobalTracking/CMakeLists.txt

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,27 @@
88
# granted to it by virtue of its status as an Intergovernmental Organization or
99
# submit itself to any jurisdiction.
1010

11-
o2_add_library(GlobalTracking
12-
SOURCES src/MatchTPCITS.cxx src/MatchTOF.cxx src/CalibTOF.cxx
13-
src/CollectCalibInfoTOF.cxx
14-
PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC
15-
O2::DataFormatsITSMFT
16-
O2::DataFormatsITS
17-
O2::DataFormatsFT0
18-
O2::DataFormatsTOF
19-
O2::ITSReconstruction
20-
O2::TPCFastTransformation
21-
O2::GPUTracking
22-
O2::TPCBase
23-
O2::TPCReconstruction
24-
O2::TOFBase
25-
O2::TOFCalibration)
11+
o2_add_library(
12+
GlobalTracking
13+
SOURCES src/MatchTPCITS.cxx src/MatchTOF.cxx src/CalibTOF.cxx
14+
src/MatchTPCITSParams.cxx src/CollectCalibInfoTOF.cxx
15+
PUBLIC_LINK_LIBRARIES
16+
O2::DataFormatsTPC
17+
O2::DataFormatsITSMFT
18+
O2::DataFormatsITS
19+
O2::DataFormatsFT0
20+
O2::DataFormatsTOF
21+
O2::ITSReconstruction
22+
O2::TPCFastTransformation
23+
O2::GPUTracking
24+
O2::TPCBase
25+
O2::TPCReconstruction
26+
O2::TOFBase
27+
O2::TOFCalibration
28+
O2::SimConfig)
2629

27-
o2_target_root_dictionary(GlobalTracking
28-
HEADERS include/GlobalTracking/MatchTPCITS.h
29-
include/GlobalTracking/MatchTOF.h
30-
include/GlobalTracking/CalibTOF.h
31-
include/GlobalTracking/CollectCalibInfoTOF.h)
30+
o2_target_root_dictionary(
31+
GlobalTracking
32+
HEADERS include/GlobalTracking/MatchTPCITS.h include/GlobalTracking/MatchTPCITSParams.h
33+
include/GlobalTracking/MatchTOF.h include/GlobalTracking/CalibTOF.h
34+
include/GlobalTracking/CollectCalibInfoTOF.h)

Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h

Lines changed: 21 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "DataFormatsTPC/ClusterNativeHelper.h"
4444
#include "ITSReconstruction/RecoGeomHelper.h"
4545
#include "TPCFastTransform.h"
46+
#include "GlobalTracking/MatchTPCITSParams.h"
4647

4748
class 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
100101
struct 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
//---------------------------------------------------
185185
struct 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

Comments
 (0)