Skip to content

Commit a6ba52d

Browse files
martenoledavidrohr
authored andcommitted
Add configurableParam for TRD tracker
- GPURecSettings are sorted by parameter type size - parameters are (if possible) directly accessed by the tracker without copying them
1 parent de829cc commit a6ba52d

4 files changed

Lines changed: 22 additions & 42 deletions

File tree

Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,40 +52,26 @@ void TRDGlobalTracking::init(InitContext& ic)
5252
mFlatGeo = std::make_unique<GeometryFlat>(*geo);
5353

5454
//-------- init GPU reconstruction --------//
55-
GPUSettingsEvent cfgEvent;
56-
cfgEvent.solenoidBz = o2::base::Propagator::Instance()->getNominalBz();
57-
GPUSettingsRec cfgRec;
58-
cfgRec.NWaysOuter = 1;
59-
GPUSettingsProcessing cfgDeviceProcessing;
60-
cfgDeviceProcessing.debugLevel = -1; // -1 : silent
6155
GPURecoStepConfiguration cfgRecoStep;
6256
cfgRecoStep.steps = GPUDataTypes::RecoStep::NoRecoStep;
6357
cfgRecoStep.inputs.clear();
6458
cfgRecoStep.outputs.clear();
6559
mRec = GPUReconstruction::CreateInstance("CPU", true);
66-
mRec->SetSettings(&cfgEvent, &cfgRec, &cfgDeviceProcessing, &cfgRecoStep);
60+
mRec->SetSettings(o2::base::Propagator::Instance()->getNominalBz(), &cfgRecoStep);
6761

6862
mChainTracking = mRec->AddChain<GPUChainTracking>();
6963

7064
mTracker = new GPUTRDTracker();
71-
mTracker->SetNCandidates(1); // must be set before initialization
65+
mTracker->SetNCandidates(mRec->GetProcessingSettings().trdNCandidates); // must be set before initialization
7266
mTracker->SetProcessPerTimeFrame();
73-
mTracker->SetNMaxCollisions(1000); // max number of collisions within a time frame which can be processed
67+
mTracker->SetNMaxCollisions(mRec->GetProcessingSettings().trdNMaxCollisions);
7468

7569
mRec->RegisterGPUProcessor(mTracker, false);
7670
mChainTracking->SetTRDGeometry(std::move(mFlatGeo));
7771
if (mRec->Init()) {
7872
LOG(FATAL) << "GPUReconstruction could not be initialized";
7973
}
8074

81-
// configure the tracker
82-
// TODO: these settings will eventually be moved to GPUSettingsRec to be configurable via --configKeyValues
83-
//mTracker->EnableDebugOutput();
84-
//mTracker->StartDebugging();
85-
mTracker->SetPtThreshold(0.5);
86-
mTracker->SetChi2Threshold(15);
87-
mTracker->SetChi2Penalty(12);
88-
mTracker->SetStopTrkFollowingAfterNMissingLayers(6);
8975
mTracker->PrintSettings();
9076

9177
mTimer.Stop();

GPU/GPUTracking/Base/GPUSettingsList.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ AddOptionRTC(TrackReferenceX, float, 1000.f, "", 0, "Transport all tracks to thi
4747
AddOptionRTC(tpcZSthreshold, float, 2.0f, "", 0, "Zero-Suppression threshold")
4848
AddOptionRTC(tpcTubeChi2, float, 5.f * 5.f, "", 0, "Max chi2 to mark cluster adjacent to track")
4949
AddOptionRTC(tpcTubeMaxSize2, float, 2.5f * 2.5f, "", 0, "Square of max tube size (normally derrived from tpcTubeChi2)")
50+
AddOptionRTC(trdMinTrackPt, float, .5f, "", 0, "Min Pt for tracks to be propagated through the TRD")
51+
AddOptionRTC(trdMaxChi2, float, 15.f, "", 0, "Max chi2 for TRD tracklets to be matched to a track")
52+
AddOptionRTC(trdPenaltyChi2, float, 12.f, "", 0, "Chi2 penalty for no available TRD tracklet (effective chi2 cut value)")
5053
AddOptionRTC(tpcCFqmaxCutoff, unsigned char, 3, "", 0, "Cluster Finder rejects cluster with qmax below this threshold")
5154
AddOptionRTC(tpcCFqtotCutoff, unsigned char, 0, "", 0, "Cluster Finder rejects cluster with qtot below this threshold")
5255
AddOptionRTC(tpcCFinnerThreshold, unsigned char, 0, "", 0, "Cluster Finder extends cluster if inner charge above this threshold")
@@ -78,6 +81,7 @@ AddOptionRTC(retryRefit, char, 1, "", 0, "Retry refit when fit fails")
7881
AddOptionRTC(loopInterpolationInExtraPass, char, -1, "", 0, "Perform loop interpolation in an extra pass")
7982
AddOptionRTC(mergerReadFromTrackerDirectly, char, 1, "", 0, "Forward data directly from tracker to merger on GPU")
8083
AddOptionRTC(useMatLUT, char, 0, "", 0, "Use material lookup table for TPC refit")
84+
AddOptionRTC(trdStopTrkAfterNMissLy, unsigned char, 6, "", 0, "Abandon track following after N layers without a TRD match")
8185
AddCustomCPP(void SetMinTrackPt(float v) { MaxTrackQPt = v > 0.001 ? (1. / v) : (1. / 0.001); })
8286
AddVariable(dummyRTC, float, 0.f) // Ensure non empty struct and proper alignment even if all normal members are constexpr
8387
AddHelp("help", 'h')
@@ -86,6 +90,8 @@ EndConfig()
8690
// Settings steering the processing once the device was selected
8791
BeginSubConfig(GPUSettingsProcessing, proc, configStandalone, "PROC", 0, "Processing settings")
8892
AddOption(platformNum, int, -1, "", 0, "Platform to use, in case the backend provides multiple platforms (-1 = auto-select)")
93+
AddOption(trdNCandidates, int, 1, "", 0, "Number of branching track candidates for single input track during propagation")
94+
AddOption(trdNMaxCollisions, int, 1000, "", 0, "Maximum number of collisions per TF which the TRD tracker can handle")
8995
AddOption(gpuDeviceOnly, bool, false, "", 0, "Use only GPU as device (i.e. no CPU for OpenCL)")
9096
AddOption(debugMask, int, -1, "", 0, "Mask for debug output dumps to file")
9197
AddOption(comparableDebutOutput, bool, true, "", 0, "Make CPU and GPU debug output comparable (sort / skip concurrent parts)")

GPU/GPUTracking/TRDTracking/GPUTRDTracker.cxx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void* GPUTRDTracker_t<TRDTRK, PROP>::SetPointersTracks(void* base)
105105
}
106106

107107
template <class TRDTRK, class PROP>
108-
GPUTRDTracker_t<TRDTRK, PROP>::GPUTRDTracker_t() : mR(nullptr), mIsInitialized(false), mProcessPerTimeFrame(false), mMemoryPermanent(-1), mMemoryTracklets(-1), mMemoryTracks(-1), mNMaxCollisions(1), mNMaxTracks(0), mNMaxSpacePoints(0), mTracks(nullptr), mNCandidates(1), mNCollisions(1), mNTracks(0), mNEvents(0), mTriggerRecordIndices(nullptr), mTriggerRecordTimes(nullptr), mTracklets(nullptr), mMaxThreads(100), mNTracklets(0), mTrackletIndexArray(nullptr), mHypothesis(nullptr), mCandidates(nullptr), mSpacePoints(nullptr), mTrackletLabels(nullptr), mGeo(nullptr), mRPhiA2(0), mRPhiB(0), mRPhiC2(0), mDyA2(0), mDyB(0), mDyC2(0), mAngleToDyA(0), mAngleToDyB(0), mAngleToDyC(0), mDebugOutput(false), mTimeWindow(.1f), mRadialOffset(-0.1), mMinPt(2.f), mMaxEta(0.84f), mExtraRoadY(2.f), mRoadZ(18.f), mMaxChi2(15.0f), mMaxMissingLy(6), mChi2Penalty(12.0f), mZCorrCoefNRC(1.4f), mMCEvent(nullptr), mDebug(new GPUTRDTrackerDebug<TRDTRK>())
108+
GPUTRDTracker_t<TRDTRK, PROP>::GPUTRDTracker_t() : mR(nullptr), mIsInitialized(false), mProcessPerTimeFrame(false), mMemoryPermanent(-1), mMemoryTracklets(-1), mMemoryTracks(-1), mNMaxCollisions(1), mNMaxTracks(0), mNMaxSpacePoints(0), mTracks(nullptr), mNCandidates(1), mNCollisions(1), mNTracks(0), mNEvents(0), mTriggerRecordIndices(nullptr), mTriggerRecordTimes(nullptr), mTracklets(nullptr), mMaxThreads(100), mNTracklets(0), mTrackletIndexArray(nullptr), mHypothesis(nullptr), mCandidates(nullptr), mSpacePoints(nullptr), mTrackletLabels(nullptr), mGeo(nullptr), mRPhiA2(0), mRPhiB(0), mRPhiC2(0), mDyA2(0), mDyB(0), mDyC2(0), mAngleToDyA(0), mAngleToDyB(0), mAngleToDyC(0), mDebugOutput(false), mTimeWindow(.1f), mRadialOffset(-0.1), mMaxEta(0.84f), mExtraRoadY(2.f), mRoadZ(18.f), mZCorrCoefNRC(1.4f), mMCEvent(nullptr), mDebug(new GPUTRDTrackerDebug<TRDTRK>())
109109
{
110110
//--------------------------------------------------------------------
111111
// Default constructor
@@ -299,8 +299,8 @@ void GPUTRDTracker_t<TRDTRK, PROP>::PrintSettings() const
299299
//--------------------------------------------------------------------
300300
GPUInfo("##############################################################");
301301
GPUInfo("Current settings for GPU TRD tracker:");
302-
GPUInfo(" mMaxChi2(%.2f), mChi2Penalty(%.2f), nCandidates(%i), maxMissingLayers(%i)", mMaxChi2, mChi2Penalty, mNCandidates, mMaxMissingLy);
303-
GPUInfo(" ptCut = %.2f GeV, abs(eta) < %.2f", mMinPt, mMaxEta);
302+
GPUInfo(" maxChi2(%.2f), chi2Penalty(%.2f), nCandidates(%i), maxMissingLayers(%i)", Param().rec.trdMaxChi2, Param().rec.trdPenaltyChi2, mNCandidates, Param().rec.trdStopTrkAfterNMissLy);
303+
GPUInfo(" ptCut = %.2f GeV, abs(eta) < %.2f", Param().rec.trdMinTrackPt, mMaxEta);
304304
GPUInfo("##############################################################");
305305
}
306306

@@ -435,7 +435,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::CheckTrackTRDCandidate(const TRDTRK&
435435
if (CAMath::Abs(trk.getEta()) > mMaxEta) {
436436
return false;
437437
}
438-
if (trk.getPt() < mMinPt) {
438+
if (trk.getPt() < Param().rec.trdMinTrackPt) {
439439
return false;
440440
}
441441
return true;
@@ -778,16 +778,16 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
778778
RecalcTrkltCov(tilt, trkWork->getSnp(), pad->GetRowSize(mTracklets[trkltIdx].GetZbin()), trkltCovTmp);
779779
float chi2 = prop->getPredictedChi2(trkltPosTmpYZ, trkltCovTmp);
780780
// GPUInfo("layer %i: chi2 = %f", iLayer, chi2);
781-
if (chi2 < mMaxChi2 && CAMath::Abs(GetAngularPull(mSpacePoints[trkltIdx].mDy, trkWork->getSnp())) < 4) {
781+
if (chi2 < Param().rec.trdMaxChi2 && CAMath::Abs(GetAngularPull(mSpacePoints[trkltIdx].mDy, trkWork->getSnp())) < 4) {
782782
Hypothesis hypo(trkWork->GetNlayers(), iCandidate, trkltIdx, trkWork->GetChi2() + chi2);
783783
InsertHypothesis(hypo, nCurrHypothesis, hypothesisIdxOffset);
784-
} // end tracklet chi2 < mMaxChi2
784+
} // end tracklet chi2 < Param().rec.trdMaxChi2
785785
} // end tracklet in window
786786
} // tracklet loop
787787
} // chamber loop
788788

789789
// add no update to hypothesis list
790-
Hypothesis hypoNoUpdate(trkWork->GetNlayers(), iCandidate, -1, trkWork->GetChi2() + mChi2Penalty);
790+
Hypothesis hypoNoUpdate(trkWork->GetNlayers(), iCandidate, -1, trkWork->GetChi2() + Param().rec.trdPenaltyChi2);
791791
InsertHypothesis(hypoNoUpdate, nCurrHypothesis, hypothesisIdxOffset);
792792
isOK = true;
793793
} // end candidate loop
@@ -853,10 +853,10 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
853853
if (mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId == -1) {
854854
// no matching tracklet found
855855
if (trkWork->GetIsFindable(iLayer)) {
856-
if (trkWork->GetNmissingConsecLayers(iLayer) > mMaxMissingLy) {
856+
if (trkWork->GetNmissingConsecLayers(iLayer) > Param().rec.trdStopTrkAfterNMissLy) {
857857
trkWork->SetIsStopped();
858858
}
859-
trkWork->SetChi2(trkWork->GetChi2() + mChi2Penalty);
859+
trkWork->SetChi2(trkWork->GetChi2() + Param().rec.trdPenaltyChi2);
860860
}
861861
if (iUpdate == 0 && mNCandidates > 1) { // TODO: is thie really necessary????? CHECK!
862862
*t = mCandidates[2 * iUpdate + nextIdx];
@@ -876,9 +876,9 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
876876
if (ENABLE_WARNING) {
877877
Warning("FollowProlongation", "Final track propagation for track %i update %i in layer %i failed", iTrack, iUpdate, iLayer);
878878
}
879-
trkWork->SetChi2(trkWork->GetChi2() + mChi2Penalty);
879+
trkWork->SetChi2(trkWork->GetChi2() + Param().rec.trdPenaltyChi2);
880880
if (trkWork->GetIsFindable(iLayer)) {
881-
if (trkWork->GetNmissingConsecLayers(iLayer) >= mMaxMissingLy) {
881+
if (trkWork->GetNmissingConsecLayers(iLayer) >= Param().rec.trdStopTrkAfterNMissLy) {
882882
trkWork->SetIsStopped();
883883
}
884884
}
@@ -922,9 +922,9 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
922922
if (ENABLE_WARNING) {
923923
Warning("FollowProlongation", "Failed to update track %i with space point in layer %i", iTrack, iLayer);
924924
}
925-
trkWork->SetChi2(trkWork->GetChi2() + mChi2Penalty);
925+
trkWork->SetChi2(trkWork->GetChi2() + Param().rec.trdPenaltyChi2);
926926
if (trkWork->GetIsFindable(iLayer)) {
927-
if (trkWork->GetNmissingConsecLayers(iLayer) >= mMaxMissingLy) {
927+
if (trkWork->GetNmissingConsecLayers(iLayer) >= Param().rec.trdStopTrkAfterNMissLy) {
928928
trkWork->SetIsStopped();
929929
}
930930
}

GPU/GPUTracking/TRDTracking/GPUTRDTracker.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,13 @@ class GPUTRDTracker_t : public GPUProcessor
148148
GPUd() void SetProcessPerTimeFrame() { mProcessPerTimeFrame = true; }
149149
GPUd() void SetMCEvent(AliMCEvent* mc) { mMCEvent = mc; }
150150
GPUd() void EnableDebugOutput() { mDebugOutput = true; }
151-
GPUd() void SetPtThreshold(float minPt) { mMinPt = minPt; }
152151
GPUd() void SetMaxEta(float maxEta) { mMaxEta = maxEta; }
153-
GPUd() void SetChi2Threshold(float chi2) { mMaxChi2 = chi2; }
154-
GPUd() void SetChi2Penalty(float chi2) { mChi2Penalty = chi2; }
155-
GPUd() void SetStopTrkFollowingAfterNMissingLayers(int ly) { mMaxMissingLy = ly; }
156152
GPUd() void SetExtraRoadY(float extraRoadY) { mExtraRoadY = extraRoadY; }
157153
GPUd() void SetRoadZ(float roadZ) { mRoadZ = roadZ; }
158154

159155
GPUd() AliMCEvent* GetMCEvent() const { return mMCEvent; }
160156
GPUd() bool GetIsDebugOutputOn() const { return mDebugOutput; }
161-
GPUd() float GetPtThreshold() const { return mMinPt; }
162157
GPUd() float GetMaxEta() const { return mMaxEta; }
163-
GPUd() float GetChi2Threshold() const { return mMaxChi2; }
164-
GPUd() float GetChi2Penalty() const { return mChi2Penalty; }
165-
GPUd() int GetMaxMissingLayers() const { return mMaxMissingLy; }
166158
GPUd() int GetNCandidates() const { return mNCandidates; }
167159
GPUd() float GetExtraRoadY() const { return mExtraRoadY; }
168160
GPUd() float GetRoadZ() const { return mRoadZ; }
@@ -215,13 +207,9 @@ class GPUTRDTracker_t : public GPUProcessor
215207
bool mDebugOutput; // store debug output
216208
float mTimeWindow; // max. deviation of the ITS-TPC track time w.r.t. TRD trigger record time stamp (in us, default is 100 ns)
217209
float mRadialOffset; // due to mis-calibration of t0
218-
float mMinPt; // min pt of TPC tracks for tracking
219210
float mMaxEta; // TPC tracks with higher eta are ignored
220211
float mExtraRoadY; // addition to search road in r-phi to account for not exact radial match of tracklets and tracks in first iteration
221212
float mRoadZ; // in z, a constant search road is used
222-
float mMaxChi2; // max chi2 for tracklets
223-
int mMaxMissingLy; // max number of missing layers per track
224-
float mChi2Penalty; // chi2 added to the track for no update
225213
float mZCorrCoefNRC; // tracklet z-position depends linearly on track dip angle
226214
AliMCEvent* mMCEvent; //! externaly supplied optional MC event
227215
GPUTRDTrackerDebug<TRDTRK>* mDebug; // debug output

0 commit comments

Comments
 (0)