@@ -71,7 +71,8 @@ TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
7171 bool isMC,
7272 const std::string& hitRecoConfigFileName,
7373 const std::string& clusterRecoConfigFileName,
74- o2::gpu::gpudatatypes::DeviceType dType)
74+ o2::gpu::gpudatatypes::DeviceType dType,
75+ int trackingThreads)
7576{
7677 if (!hitRecoConfigFileName.empty ()) {
7778 std::ifstream configFile (hitRecoConfigFileName);
@@ -83,6 +84,7 @@ TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
8384 }
8485 mIsMC = isMC;
8586 mDeviceType = dType;
87+ mTrackingThreads = std::max (1 , trackingThreads);
8688}
8789
8890void TrackerDPL::init (InitContext& ic)
@@ -103,6 +105,15 @@ std::vector<o2::its::TrackingParameters> TrackerDPL::createTrackingParamsFromCon
103105 auto loadTrackingParamsFromJson = [](std::vector<o2::its::TrackingParameters>& trackingParams, const nlohmann::json& paramConfigJson) {
104106 for (const auto & paramConfig : paramConfigJson) {
105107 o2::its::TrackingParameters params;
108+ auto applyPassFlag = [&](const char * name, o2::its::IterationStep step) {
109+ if (paramConfig.contains (name)) {
110+ if (paramConfig[name].get <bool >()) {
111+ params.PassFlags .set (step);
112+ } else {
113+ params.PassFlags .reset (step);
114+ }
115+ }
116+ };
106117
107118 if (paramConfig.contains (" NLayers" )) {
108119 params.NLayers = paramConfig[" NLayers" ].get <int >();
@@ -172,6 +183,37 @@ std::vector<o2::its::TrackingParameters> TrackerDPL::createTrackingParamsFromCon
172183 if (paramConfig.contains (" CreateArtefactLabels" )) {
173184 params.CreateArtefactLabels = paramConfig[" CreateArtefactLabels" ].get <bool >();
174185 }
186+ if (paramConfig.contains (" TrackFollower" )) {
187+ const auto mode = paramConfig[" TrackFollower" ].get <std::string>();
188+ if (mode == " top" || mode == " outward" ) {
189+ params.PassFlags .set (o2::its::IterationStep::TrackFollowerTop);
190+ } else if (mode == " bot" || mode == " bottom" || mode == " inward" ) {
191+ params.PassFlags .set (o2::its::IterationStep::TrackFollowerBot);
192+ } else if (mode == " mix" || mode == " both" ) {
193+ params.PassFlags .set (o2::its::IterationStep::TrackFollowerTop);
194+ params.PassFlags .set (o2::its::IterationStep::TrackFollowerBot);
195+ } else if (mode != " off" ) {
196+ LOGP (fatal, " Invalid ALICE3 TRK tracking parameter TrackFollower: {}" , mode);
197+ }
198+ }
199+ if (paramConfig.contains (" TrackFollowerNSigmaCutZ" )) {
200+ params.TrackFollowerNSigmaCutZ = paramConfig[" TrackFollowerNSigmaCutZ" ].get <float >();
201+ }
202+ if (paramConfig.contains (" TrackFollowerNSigmaCutPhi" )) {
203+ params.TrackFollowerNSigmaCutPhi = paramConfig[" TrackFollowerNSigmaCutPhi" ].get <float >();
204+ }
205+ if (paramConfig.contains (" TrackFollowerMaxHypotheses" )) {
206+ params.TrackFollowerMaxHypotheses = std::max (1 , paramConfig[" TrackFollowerMaxHypotheses" ].get <int >());
207+ }
208+ applyPassFlag (" FirstPass" , o2::its::IterationStep::FirstPass);
209+ applyPassFlag (" RebuildClusterLUT" , o2::its::IterationStep::RebuildClusterLUT);
210+ applyPassFlag (" UseUPCMask" , o2::its::IterationStep::UseUPCMask);
211+ applyPassFlag (" SelectUPCVertices" , o2::its::IterationStep::SelectUPCVertices);
212+ applyPassFlag (" ResetVertices" , o2::its::IterationStep::ResetVertices);
213+ applyPassFlag (" SkipROFsAboveThreshold" , o2::its::IterationStep::SkipROFsAboveThreshold);
214+ applyPassFlag (" MarkVerticesAsUPC" , o2::its::IterationStep::MarkVerticesAsUPC);
215+ applyPassFlag (" TrackFollowerTop" , o2::its::IterationStep::TrackFollowerTop);
216+ applyPassFlag (" TrackFollowerBot" , o2::its::IterationStep::TrackFollowerBot);
175217 if (paramConfig.contains (" PrintMemory" )) {
176218 params.PrintMemory = paramConfig[" PrintMemory" ].get <bool >();
177219 }
@@ -255,7 +297,7 @@ void TrackerDPL::run(ProcessingContext& pc)
255297 mMemoryPool = std::make_shared<its::BoundedMemoryResource>();
256298 }
257299 if (mTaskArena .get () == nullptr ) {
258- mTaskArena = std::make_shared<tbb::task_arena>(1 ); // / TODO: make it configurable
300+ mTaskArena = std::make_shared<tbb::task_arena>(mTrackingThreads );
259301 }
260302
261303 mTrackingParams = createTrackingParamsFromConfig ();
@@ -309,7 +351,7 @@ void TrackerDPL::endOfStream(EndOfStreamContext& ec)
309351 LOGF (info, " TRK CA-Tracker total timing: Cpu: %.3e Real: %.3e s in %d slots" , mTimer .CpuTime (), mTimer .RealTime (), mTimer .Counter () - 1 );
310352}
311353
312- DataProcessorSpec getTrackerSpec (bool useMC, const std::string& hitRecoConfig, const std::string& clusterRecoConfig, o2::gpu::gpudatatypes::DeviceType dType)
354+ DataProcessorSpec getTrackerSpec (bool useMC, const std::string& hitRecoConfig, const std::string& clusterRecoConfig, o2::gpu::gpudatatypes::DeviceType dType, int trackingThreads )
313355{
314356 std::vector<InputSpec> inputs;
315357 std::vector<OutputSpec> outputs;
@@ -337,7 +379,8 @@ DataProcessorSpec getTrackerSpec(bool useMC, const std::string& hitRecoConfig, c
337379 useMC,
338380 hitRecoConfig,
339381 clusterRecoConfig,
340- dType)},
382+ dType,
383+ trackingThreads)},
341384 Options{ConfigParamSpec{" max-loops" , VariantType::Int, 1 , {" max number of loops" }}
342385#ifdef O2_WITH_ACTS
343386 ,
@@ -373,7 +416,8 @@ DataProcessorSpec getTrackerSpec(bool useMC, const std::string& hitRecoConfig, c
373416 useMC,
374417 hitRecoConfig,
375418 clusterRecoConfig,
376- dType)},
419+ dType,
420+ trackingThreads)},
377421 Options{}};
378422}
379423
0 commit comments