From 7d159eae3eda8c054b02e2a65c33d5d2902a4f18 Mon Sep 17 00:00:00 2001 From: shahoian Date: Fri, 14 Feb 2025 19:33:04 +0100 Subject: [PATCH] Modify CA async opts, possible set from config.param Print selected setthigs only once from the 1st pipeline. Rescale pT cutoffs by actual/nominal B-field. For this reason CA ITSTrackingInterface::initialise is moved inside ITSTrackingInterface::updateTimeDependentParams 1st call (during 1st TF processing). --- .../include/ITStracking/Configuration.h | 1 + .../include/ITStracking/TrackingConfigParam.h | 5 ++ .../include/ITStracking/TrackingInterface.h | 3 + .../ITSMFT/ITS/tracking/src/Configuration.cxx | 24 +++++++- Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx | 1 - .../ITS/tracking/src/TrackingInterface.cxx | 57 +++++++++++++++++-- .../ITSMFT/ITS/tracking/src/Vertexer.cxx | 1 - .../ITSMFT/ITS/workflow/src/TrackerSpec.cxx | 2 +- 8 files changed, 85 insertions(+), 9 deletions(-) diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h index e99f0c1f4d13f..b63a01cb8cd29 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h @@ -63,6 +63,7 @@ struct TrackingParameters { int CellMinimumLevel(); int CellsPerRoad() const { return NLayers - 2; } int TrackletsPerRoad() const { return NLayers - 1; } + std::string asString() const; int NLayers = 7; int DeltaROF = 0; diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h index 20e9a4362b77c..0cf44d08cac19 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h @@ -55,9 +55,14 @@ struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper { // Use TGeo for mat. budget + static const int MaxIter = 4; + static const int MinTrackLenght = 4; + static const int MaxTrackLenght = 7; bool useMatCorrTGeo = false; // use full geometry to corect for material budget accounting in the fits. Default is to use the material budget LUT. bool useFastMaterial = false; // use faster material approximation for material budget accounting in the fits. int deltaRof = 0; // configure the width of the window in ROFs to be considered for the tracking. + int minTrackLgtIter[MaxIter] = {}; // minimum track length at each iteration, used only if >0, otherwise use code defaults + float minPtIterLgt[MaxIter * (MaxTrackLenght - MinTrackLenght + 1)] = {}; // min.pT for given track length at this iteration, used only if >0, otherwise use code defaults float sysErrY2[7] = {0}; // systematic error^2 in Y per layer float sysErrZ2[7] = {0}; // systematic error^2 in Z per layer float maxChi2ClusterAttachment = -1.f; diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingInterface.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingInterface.h index 717ee892816ee..b584bf6b8008b 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingInterface.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingInterface.h @@ -70,6 +70,9 @@ class ITSTrackingInterface mMode = mode; } + auto getTracker() const { return mTracker.get(); } + auto getVertexer() const { return mVertexer.get(); } + TimeFrame* mTimeFrame = nullptr; protected: diff --git a/Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx b/Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx index 13cf6b472db9a..7d348505c61d3 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx @@ -28,9 +28,31 @@ std::string asString(TrackingMode mode) return "unknown"; } +std::string TrackingParameters::asString() const +{ + std::string str = fmt::format("NZb:{} NPhB:{} NROFIt:{} PerVtx:{} DropFail:{} ClSh:{} TtklMinPt:{:.2f} MinCl:{}", + ZBins, PhiBins, nROFsPerIterations, PerPrimaryVertexProcessing, DropTFUponFailure, ClusterSharing, TrackletMinPt, MinTrackLength); + bool first = true; + for (int il = NLayers; il >= MinTrackLength; il--) { + int slot = NLayers - il; + if (slot < (int)MinPt.size() && MinPt[slot] > 0) { + if (first) { + first = false; + str += " MinPt: "; + } + str += fmt::format("L{}:{:.2f} ", il, MinPt[slot]); + } + } + str += " SystErrY/Z:"; + for (size_t i = 0; i < SystErrorY2.size(); i++) { + str += fmt::format("{:.2e}/{:.2e} ", SystErrorY2[i], SystErrorZ2[i]); + } + return str; +} + std::ostream& operator<<(std::ostream& os, TrackingMode v) { os << asString(v); return os; } -} // namespace o2::its \ No newline at end of file +} // namespace o2::its diff --git a/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx b/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx index bc642015b1fcd..50dc1f5dfd039 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx @@ -481,7 +481,6 @@ void Tracker::rectifyClusterIndices() void Tracker::getGlobalConfiguration() { auto& tc = o2::its::TrackerParamConfig::Instance(); - tc.printKeyValues(true, true); if (tc.useMatCorrTGeo) { mTraits->setCorrType(o2::base::PropagatorImpl::MatCorrType::USEMatCorrTGeo); } else if (tc.useFastMaterial) { diff --git a/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx b/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx index 7305e205ecb3a..f625b77a013b0 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx @@ -23,6 +23,7 @@ #include "CommonDataFormat/IRFrame.h" #include "DetectorsBase/GRPGeomHelper.h" #include "ITStracking/TrackingConfigParam.h" +#include "Framework/DeviceSpec.h" namespace o2 { @@ -35,31 +36,55 @@ void ITSTrackingInterface::initialise() mCosmicsProcessing = false; std::vector vertParams; std::vector trackParams; + const auto& trackConf = o2::its::TrackerParamConfig::Instance(); + float bFactor = std::abs(o2::base::Propagator::Instance()->getNominalBz()) / 5.0066791; if (mMode == TrackingMode::Unset) { - mMode = (TrackingMode)(o2::its::TrackerParamConfig::Instance().trackingMode); + mMode = (TrackingMode)(trackConf.trackingMode); LOGP(info, "Tracking mode not set, trying to fetch it from configurable params to: {}", asString(mMode)); } if (mMode == TrackingMode::Async) { - trackParams.resize(o2::its::TrackerParamConfig::Instance().doUPCIteration ? 4 : 3); + trackParams.resize(trackConf.doUPCIteration ? 4 : 3); vertParams.resize(2); // The number of actual iterations will be set as a configKeyVal to allow for pp/PbPb choice trackParams[1].TrackletMinPt = 0.2f; trackParams[1].CellDeltaTanLambdaSigma *= 2.; trackParams[2].TrackletMinPt = 0.1f; trackParams[2].CellDeltaTanLambdaSigma *= 4.; + + trackParams[0].MinPt[0] = 1.f / 12; // 7cl + + trackParams[1].MinPt[0] = 1.f / 12; // 7cl + trackParams[2].MinTrackLength = 4; - trackParams[2].MinPt[3] = 0.2f; + trackParams[2].MinPt[0] = 1.f / 12; // 7cl + trackParams[2].MinPt[1] = 1.f / 5; // 6cl + trackParams[2].MinPt[2] = 1.f / 1; // 5cl + trackParams[2].MinPt[3] = 1.f / 6; // 4cl + trackParams[2].StartLayerMask = (1 << 6) + (1 << 3); if (o2::its::TrackerParamConfig::Instance().doUPCIteration) { + trackParams[3].MinTrackLength = 4; trackParams[3].TrackletMinPt = 0.1f; trackParams[3].CellDeltaTanLambdaSigma *= 4.; - trackParams[3].MinTrackLength = 4; trackParams[3].DeltaROF = 0; // UPC specific setting } - for (auto& param : trackParams) { + for (size_t ip = 0; ip < trackParams.size(); ip++) { + auto& param = trackParams[ip]; param.ZBins = 64; param.PhiBins = 32; param.CellsPerClusterLimit = 1.e3f; param.TrackletsPerClusterLimit = 1.e3f; + // check if something was overridden via configurable params + if (ip < trackConf.MaxIter) { + if (trackConf.minTrackLgtIter[ip] > 0) { + param.MinTrackLength = trackConf.minTrackLgtIter[ip]; + } + for (int ilg = trackConf.MaxTrackLenght; ilg >= trackConf.MinTrackLenght; ilg--) { + int lslot0 = (trackConf.MaxTrackLenght - ilg), lslot = lslot0 + ip * (trackConf.MaxTrackLenght - trackConf.MinTrackLenght + 1); + if (trackConf.minPtIterLgt[lslot] > 0.) { + param.MinPt[lslot0] = trackConf.minPtIterLgt[lslot]; + } + } + } } LOGP(info, "Initializing tracker in async. phase reconstruction with {} passes for tracking and {}/{} for vertexing", trackParams.size(), o2::its::VertexerParamConfig::Instance().nIterations, vertParams.size()); vertParams[1].phiCut = 0.015f; @@ -95,6 +120,17 @@ void ITSTrackingInterface::initialise() for (auto& params : trackParams) { params.CorrType = o2::base::PropagatorImpl::MatCorrType::USEMatCorrLUT; } + + // adjust pT settings to actual mag. field + for (size_t ip = 0; ip < trackParams.size(); ip++) { + auto& param = trackParams[ip]; + for (int ilg = trackConf.MaxTrackLenght; ilg >= trackConf.MinTrackLenght; ilg--) { + int lslot = trackConf.MaxTrackLenght - ilg; + param.MinPt[lslot] *= bFactor; + param.TrackletMinPt *= bFactor; + } + } + mTracker->setParameters(trackParams); mVertexer->setParameters(vertParams); } @@ -345,7 +381,18 @@ void ITSTrackingInterface::updateTimeDependentParams(framework::ProcessingContex } GeometryTGeo* geom = GeometryTGeo::Instance(); geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::T2G)); + initialise(); getConfiguration(pc); + // + if (pc.services().get().inputTimesliceId == 0) { // print settings only for the 1st pipeling + o2::its::VertexerParamConfig::Instance().printKeyValues(); + o2::its::TrackerParamConfig::Instance().printKeyValues(); + const auto& trParams = mTracker->getParameters(); + for (size_t it = 0; it < trParams.size(); it++) { + const auto& par = trParams[it]; + LOGP(info, "recoIter#{} : {}", it, par.asString()); + } + } } } diff --git a/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx b/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx index e87e2289b49e7..13ce03e9fba4f 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx @@ -103,7 +103,6 @@ float Vertexer::clustersToVerticesHybrid(std::function logg void Vertexer::getGlobalConfiguration() { auto& vc = o2::its::VertexerParamConfig::Instance(); - vc.printKeyValues(true, true); auto& grc = o2::its::ITSGpuTrackingParamConfig::Instance(); // This is odd: we override only the parameters for the first iteration. diff --git a/Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx b/Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx index ec0b0d26f873c..dd4c40a2141d9 100644 --- a/Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx +++ b/Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx @@ -44,7 +44,7 @@ void TrackerDPL::init(InitContext& ic) mITSTrackingInterface.setTraitsFromProvider(mChainITS->GetITSVertexerTraits(), mChainITS->GetITSTrackerTraits(), mChainITS->GetITSTimeframe()); - mITSTrackingInterface.initialise(); + // mITSTrackingInterface.initialise() will be called from the ITSTrackingInterface::updateTimeDependentParams at 1st initialization since it needs some run conditions } void TrackerDPL::stop()