From 0b3fa30141e56d0d796b6b2d0af48bdb28270b41 Mon Sep 17 00:00:00 2001 From: Matthias Kleiner <48915672+matthias-kleiner@users.noreply.github.com> Date: Sat, 18 Nov 2023 17:34:03 +0100 Subject: [PATCH] TPC: Fix usage of derivative map for scaling of space-charge corrections (#12264) * TPC: Fix usage of derivative map for scaling of space-charge corrections - add option to override lumi of reference map (reference map can be the derivative map) - changing definition of scaling when using the derivative map: The derivative map is defined as "map_high_IR - map_low_IR". The stored lumi of the derivative map should correspond to " - " - Changing condition when scaling is used: for the derivative map the scaling is negative, when the inst_lumi < mean_lumi * Helper to handle global scaling options, extend to all wfs with TPC corrections * Move CorrectionMapsLoader device options to TPCCorrMap.. configurable Former options --corrmap-lumi-mean, --corrmap-lumi-inst, --corrmap-lumi-ref, --ctp-lumi-factor, --ctp-lumi-source are moved to new configurable param CorrMapParam as TPCCorrMap.lumiMean, lumiInst, lumiMeanRef, lumiInstFactor and ctpLumiSource respectively. The object is not loaded from the CCDB (default uploaded) and can be modified from the command line as a usial configurable param. The dpl-workflow.sh parses TPC_CORR_SCALING env var. which is now a mix of options --lumi-type <0,1,2>, --corrmap-lumi-mode <0,1> abd TPCCorrMap... settings, e.g. TPCCorrMap=--lumi-type 2 --corrmap-lumi-mode 1 TPCCorrMap.lumiInstFactor=3.141 --------- Co-authored-by: shahoian --- .../AlignmentWorkflow/BarrelAlignmentSpec.h | 7 +- .../Workflow/src/BarrelAlignmentSpec.cxx | 4 +- .../src/barrel-alignment-workflow.cxx | 10 +- .../CosmicsMatchingSpec.h | 7 +- .../SecondaryVertexingSpec.h | 7 +- .../GlobalTrackingWorkflow/TOFMatcherSpec.h | 6 +- .../TPCITSMatchingSpec.h | 6 +- .../src/CosmicsMatchingSpec.cxx | 4 +- .../src/SecondaryVertexingSpec.cxx | 5 +- .../src/TOFMatcherSpec.cxx | 4 +- .../src/TPCITSMatchingSpec.cxx | 4 +- .../src/cosmics-match-workflow.cxx | 10 +- .../src/secondary-vertexing-workflow.cxx | 11 +-- .../src/tof-matcher-workflow.cxx | 9 +- .../src/tpcits-match-workflow.cxx | 10 +- .../GlobalTrackingStudy/TPCTrackStudy.h | 7 +- .../study/src/TPCTrackStudy.cxx | 4 +- .../study/src/tpc-track-study-workflow.cxx | 9 +- .../TPC/base/include/TPCBase/CDBInterface.h | 4 + Detectors/TPC/calibration/CMakeLists.txt | 4 +- .../include/TPCCalibration/CorrMapParam.h | 49 ++++++++++ .../TPCCalibration/CorrectionMapsLoader.h | 10 +- .../TPC/calibration/src/CorrMapParam.cxx | 18 ++++ .../calibration/src/CorrectionMapsLoader.cxx | 93 +++++++++++++------ .../calibration/src/TPCCalibrationLinkDef.h | 2 + .../include/TPCWorkflow/RecoWorkflow.h | 21 +++-- .../TPCWorkflow/TPCCalibPadGainTracksSpec.h | 7 +- Detectors/TPC/workflow/src/RecoWorkflow.cxx | 8 +- .../workflow/src/tpc-calib-gainmap-tracks.cxx | 9 +- .../TPC/workflow/src/tpc-reco-workflow.cxx | 8 +- .../TRDWorkflow/TRDGlobalTrackingSpec.h | 2 +- .../workflow/src/TRDGlobalTrackingSpec.cxx | 4 +- .../workflow/src/trd-tracking-workflow.cxx | 9 +- .../CorrectionMapsHelper.cxx | 3 +- .../CorrectionMapsHelper.h | 18 +++- GPU/TPCFastTransformation/TPCFastTransform.h | 22 ++++- GPU/Workflow/src/GPUWorkflowSpec.cxx | 3 +- GPU/Workflow/src/gpu-reco-workflow.cxx | 10 +- prodtests/full-system-test/dpl-workflow.sh | 25 ++--- 39 files changed, 320 insertions(+), 133 deletions(-) create mode 100644 Detectors/TPC/calibration/include/TPCCalibration/CorrMapParam.h create mode 100644 Detectors/TPC/calibration/src/CorrMapParam.cxx diff --git a/Detectors/Align/Workflow/include/AlignmentWorkflow/BarrelAlignmentSpec.h b/Detectors/Align/Workflow/include/AlignmentWorkflow/BarrelAlignmentSpec.h index d44ec0c995b13..197ace2bd9d20 100644 --- a/Detectors/Align/Workflow/include/AlignmentWorkflow/BarrelAlignmentSpec.h +++ b/Detectors/Align/Workflow/include/AlignmentWorkflow/BarrelAlignmentSpec.h @@ -21,12 +21,17 @@ using namespace o2::framework; namespace o2 { +namespace tpc +{ +struct CorrectionMapsLoaderGloOpts; +} + namespace align { /// create a processor spec framework::DataProcessorSpec getBarrelAlignmentSpec(o2::dataformats::GlobalTrackID::mask_t srcMP, o2::dataformats::GlobalTrackID::mask_t src, - o2::detectors::DetID::mask_t dets, o2::detectors::DetID::mask_t skipDetClusters, bool enableCosmic, int postproc, bool useMC, int lumiType); + o2::detectors::DetID::mask_t dets, o2::detectors::DetID::mask_t skipDetClusters, bool enableCosmic, int postproc, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace align } // namespace o2 diff --git a/Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx b/Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx index 870729d7422e2..a886611ad2730 100644 --- a/Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx +++ b/Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx @@ -358,7 +358,7 @@ void BarrelAlignmentSpec::endOfStream(EndOfStreamContext& ec) mDBGOut.reset(); } -DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_t src, DetID::mask_t dets, DetID::mask_t skipDetClusters, bool enableCosmic, int postprocess, bool useMC, int lumiType) +DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_t src, DetID::mask_t dets, DetID::mask_t skipDetClusters, bool enableCosmic, int postprocess, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; auto dataRequest = std::make_shared(); @@ -383,7 +383,7 @@ DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_ } if (src[DetID::TPC] && !skipDetClusters[DetID::TPC]) { o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); loadTPCCalib = true; } } diff --git a/Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx b/Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx index 9313c4e0a29e7..467e0af9d6de5 100644 --- a/Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx +++ b/Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx @@ -19,6 +19,7 @@ #include "TPCReaderWorkflow/TrackReaderSpec.h" #include "TPCReaderWorkflow/ClusterReaderSpec.h" #include "TPCWorkflow/ClusterSharingMapSpec.h" +#include "TPCCalibration/CorrectionMapsLoader.h" #include "TOFWorkflowIO/ClusterReaderSpec.h" #include "TOFWorkflowIO/TOFMatchedReaderSpec.h" #include "TOFWorkflowIO/ClusterReaderSpec.h" @@ -55,9 +56,9 @@ void customize(std::vector& workflowOptions) {"enable-tpc-tracks", VariantType::Bool, false, {"allow reading TPC tracks"}}, {"enable-tpc-clusters", VariantType::Bool, false, {"allow reading TPC clusters (will trigger TPC tracks reading)"}}, {"enable-cosmic", VariantType::Bool, false, {"enable cosmic tracks)"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"postprocessing", VariantType::Int, 0, {"postprocessing bits: 1 - extract alignment objects, 2 - check constraints, 4 - print mpParams/Constraints, 8 - relabel pede results"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -91,7 +92,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) bool loadTPCTracks = configcontext.options().get("enable-tpc-tracks"); bool enableCosmic = configcontext.options().get("enable-cosmic"); bool useMC = configcontext.options().get("enable-mc"); - auto lumiType = configcontext.options().get("lumi-type"); DetID::mask_t dets = allowedDets & DetID::getMask(configcontext.options().get("detectors")); DetID::mask_t skipDetClusters; // optionally skip automatically loaded clusters @@ -101,7 +101,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (dets[DetID::TPC]) { loadTPCClusters = loadTPCTracks = true; } - + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); if (!postprocess) { // this part is needed only if the data should be read if (GID::includesDet(DetID::ITS, src)) { src |= GID::getSourceMask(GID::ITS); @@ -140,14 +140,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) } LOG(info) << "adding TOF request"; } - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { src = src | GID::getSourcesMask("CTP"); } // write the configuration used for the workflow o2::conf::ConfigurableParam::writeINI("o2_barrel_alignment_configuration.ini"); } - specs.emplace_back(o2::align::getBarrelAlignmentSpec(srcMP, src, dets, skipDetClusters, enableCosmic, postprocess, useMC, lumiType)); + specs.emplace_back(o2::align::getBarrelAlignmentSpec(srcMP, src, dets, skipDetClusters, enableCosmic, postprocess, useMC, sclOpt)); // RS FIXME: check which clusters are really needed if (!postprocess) { GID::mask_t dummy; diff --git a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h index 6cdbd25fde289..e0e74c3058086 100644 --- a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h +++ b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h @@ -20,11 +20,16 @@ using namespace o2::framework; namespace o2 { +namespace tpc +{ +struct CorrectionMapsLoaderGloOpts; +} + namespace globaltracking { /// create a processor spec -framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, int lumiType); +framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace globaltracking } // namespace o2 diff --git a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/SecondaryVertexingSpec.h b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/SecondaryVertexingSpec.h index 2b458c4e25e10..7a3060e7f252a 100644 --- a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/SecondaryVertexingSpec.h +++ b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/SecondaryVertexingSpec.h @@ -20,11 +20,16 @@ namespace o2 { +namespace tpc +{ +struct CorrectionMapsLoaderGloOpts; +} + namespace vertexing { /// create a processor spec -o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, int lumiType); +o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace vertexing } // namespace o2 diff --git a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TOFMatcherSpec.h b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TOFMatcherSpec.h index a1fc7062a2fe9..b9874dab1cdd4 100644 --- a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TOFMatcherSpec.h +++ b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TOFMatcherSpec.h @@ -21,11 +21,15 @@ using namespace o2::framework; namespace o2 { +namespace tpc +{ +struct CorrectionMapsLoaderGloOpts; +} namespace globaltracking { /// create a processor spec -framework::DataProcessorSpec getTOFMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, int lumiType); +framework::DataProcessorSpec getTOFMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace globaltracking } // namespace o2 diff --git a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TPCITSMatchingSpec.h b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TPCITSMatchingSpec.h index 4ed0aee334919..f3b37cffb323a 100644 --- a/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TPCITSMatchingSpec.h +++ b/Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TPCITSMatchingSpec.h @@ -20,10 +20,14 @@ using namespace o2::framework; namespace o2 { +namespace tpc +{ +struct CorrectionMapsLoaderGloOpts; +} namespace globaltracking { /// create a processor spec -framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, int lumiType); +framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace globaltracking } // namespace o2 diff --git a/Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx index 102a30f8f94b0..d8242fc2ccd79 100644 --- a/Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx @@ -172,7 +172,7 @@ void CosmicsMatchingSpec::endOfStream(EndOfStreamContext& ec) mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1); } -DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, int lumiType) +DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; Options opts{ @@ -198,7 +198,7 @@ DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, int l dataRequest->inputs, true); o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); return DataProcessorSpec{ "cosmics-matcher", diff --git a/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx index 082ca6286c25f..5812087bae6b5 100644 --- a/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx @@ -33,6 +33,7 @@ #include "TPCCalibration/CorrectionMapsLoader.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/DeviceSpec.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; @@ -201,7 +202,7 @@ void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc) pc.inputs().get("meanvtx"); } -DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, int lumiType) +DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; Options opts{ @@ -231,7 +232,7 @@ DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCas true); if (src[GTrackID::TPC]) { o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); } outputs.emplace_back("GLO", "V0S_IDX", 0, Lifetime::Timeframe); // found V0s indices outputs.emplace_back("GLO", "V0S", 0, Lifetime::Timeframe); // found V0s diff --git a/Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx index 6453e79c635f8..35d1d5736f5ea 100644 --- a/Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx @@ -237,7 +237,7 @@ void TOFMatcherSpec::endOfStream(EndOfStreamContext& ec) mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1); } -DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, int lumiType) +DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard); Options opts; @@ -260,7 +260,7 @@ DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bo dataRequest->inputs, true); o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); std::vector outputs; if (GID::includesSource(GID::TPC, src)) { outputs.emplace_back(o2::header::gDataOriginTOF, "MTC_TPC", ss, Lifetime::Timeframe); diff --git a/Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx index bcaf0d1039f15..1a061ee9707f5 100644 --- a/Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx @@ -196,7 +196,7 @@ void TPCITSMatchingDPL::updateTimeDependentParams(ProcessingContext& pc) } } -DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, int lumiType) +DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; auto dataRequest = std::make_shared(); @@ -239,7 +239,7 @@ DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool {"debug-tree-flags", VariantType::Int, 0, {"DebugFlagTypes bit-pattern for debug tree"}}}; o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); return DataProcessorSpec{ "itstpc-track-matcher", diff --git a/Detectors/GlobalTrackingWorkflow/src/cosmics-match-workflow.cxx b/Detectors/GlobalTrackingWorkflow/src/cosmics-match-workflow.cxx index 147ea03175bb8..5adadcad3f0eb 100644 --- a/Detectors/GlobalTrackingWorkflow/src/cosmics-match-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/cosmics-match-workflow.cxx @@ -30,6 +30,7 @@ #include "DetectorsRaw/HBFUtilsInitializer.h" #include "Framework/CallbacksPolicy.h" #include "GlobalTrackingWorkflowHelpers/InputHelper.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using DetID = o2::detectors::DetID; @@ -49,8 +50,8 @@ void customize(std::vector& workflowOptions) {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}}, {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}}, {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -81,10 +82,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); // write the configuration used for the workflow o2::conf::ConfigurableParam::writeINI("o2match-cosmics-workflow_configuration.ini"); - + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); auto useMC = !configcontext.options().get("disable-mc"); auto disableRootOut = configcontext.options().get("disable-root-output"); - auto lumiType = configcontext.options().get("lumi-type"); GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get("track-sources")); if (GID::includesDet(DetID::TPC, src)) { @@ -96,12 +96,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (GID::includesDet(DetID::TOF, src)) { src |= GID::getSourceMask(GID::TOF); } - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { src = src | GID::getSourcesMask("CTP"); } GID::mask_t srcCl = src; GID::mask_t dummy; - specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(src, useMC, lumiType)); + specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(src, useMC, sclOpt)); o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, src, src, src, useMC, dummy); // clusters MC is not needed diff --git a/Detectors/GlobalTrackingWorkflow/src/secondary-vertexing-workflow.cxx b/Detectors/GlobalTrackingWorkflow/src/secondary-vertexing-workflow.cxx index ffb71129a6ecd..1fa7c58f1fa67 100644 --- a/Detectors/GlobalTrackingWorkflow/src/secondary-vertexing-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/secondary-vertexing-workflow.cxx @@ -28,6 +28,7 @@ #include "Framework/ConfigParamSpec.h" #include "Framework/CompletionPolicyHelpers.h" #include "DetectorsBase/DPLWorkflowUtils.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using GID = o2::dataformats::GlobalTrackID; @@ -56,10 +57,9 @@ void customize(std::vector& workflowOptions) {"disable-cascade-finder", o2::framework::VariantType::Bool, false, {"do not run cascade finder"}}, {"disable-3body-finder", o2::framework::VariantType::Bool, false, {"do not run 3 body finder"}}, {"disable-strangeness-tracker", o2::framework::VariantType::Bool, false, {"do not run strangeness tracker"}}, - {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"combine-source-devices", o2::framework::VariantType::Bool, false, {"merge DPL source devices"}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -81,8 +81,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto enableCasc = !configcontext.options().get("disable-cascade-finder"); auto enable3body = !configcontext.options().get("disable-3body-finder"); auto enableStrTr = !configcontext.options().get("disable-strangeness-tracker"); - auto lumiType = configcontext.options().get("lumi-type"); - + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); GID::mask_t src = allowedSources & GID::getSourcesMask(configcontext.options().get("vertexing-sources")); GID::mask_t dummy, srcClus = GID::includesDet(DetID::TOF, src) ? GID::getSourceMask(GID::TOF) : dummy; // eventually, TPC clusters will be needed for refit if (enableStrTr) { @@ -91,12 +90,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (src[GID::TPC]) { srcClus |= GID::getSourceMask(GID::TPC); } - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { src = src | GID::getSourcesMask("CTP"); } WorkflowSpec specs; - specs.emplace_back(o2::vertexing::getSecondaryVertexingSpec(src, enableCasc, enable3body, enableStrTr, useMC, lumiType)); + specs.emplace_back(o2::vertexing::getSecondaryVertexingSpec(src, enableCasc, enable3body, enableStrTr, useMC, sclOpt)); // only TOF clusters are needed if TOF is involved, no clusters MC needed WorkflowSpec inputspecs; diff --git a/Detectors/GlobalTrackingWorkflow/src/tof-matcher-workflow.cxx b/Detectors/GlobalTrackingWorkflow/src/tof-matcher-workflow.cxx index bfe65fe32eb19..ad009d266239b 100644 --- a/Detectors/GlobalTrackingWorkflow/src/tof-matcher-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/tof-matcher-workflow.cxx @@ -32,6 +32,7 @@ #include "Steer/MCKinematicsReader.h" #include "TSystem.h" #include "DetectorsBase/DPLWorkflowUtils.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using DetID = o2::detectors::DetID; @@ -64,9 +65,9 @@ void customize(std::vector& workflowOptions) {"enable-dia", o2::framework::VariantType::Bool, false, {"to require diagnostic freq and then write to calib outputs (obsolete since now default)"}}, {"trd-extra-tolerance", o2::framework::VariantType::Float, 500.0f, {"Extra time tolerance for TRD tracks in ns"}}, {"write-matchable", o2::framework::VariantType::Bool, false, {"write all matchable pairs in a file (o2matchable_tof.root)"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}, {"combine-devices", o2::framework::VariantType::Bool, false, {"merge DPL source/writer devices"}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -93,7 +94,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto diagnostic = configcontext.options().get("enable-dia"); auto extratolerancetrd = configcontext.options().get("trd-extra-tolerance"); auto writeMatchable = configcontext.options().get("write-matchable"); - auto lumiType = configcontext.options().get("lumi-type"); + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); bool writematching = 0; bool writecalib = 0; auto outputType = configcontext.options().get("output-type"); @@ -138,7 +139,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (useFIT) { clustermask |= GID::getSourceMask(GID::FT0); } - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { src = src | GID::getSourcesMask("CTP"); } if (useMC) { @@ -159,7 +160,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) } } - specs.emplace_back(o2::globaltracking::getTOFMatcherSpec(src, useMC, useFIT, false, strict, extratolerancetrd, writeMatchable, lumiType)); // doTPCrefit not yet supported (need to load TPC clusters?) + specs.emplace_back(o2::globaltracking::getTOFMatcherSpec(src, useMC, useFIT, false, strict, extratolerancetrd, writeMatchable, sclOpt)); // doTPCrefit not yet supported (need to load TPC clusters?) if (!disableRootOut) { std::vector writers; diff --git a/Detectors/GlobalTrackingWorkflow/src/tpcits-match-workflow.cxx b/Detectors/GlobalTrackingWorkflow/src/tpcits-match-workflow.cxx index 4f2eb1621ee85..4548e6988fac3 100644 --- a/Detectors/GlobalTrackingWorkflow/src/tpcits-match-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/tpcits-match-workflow.cxx @@ -23,6 +23,7 @@ #include "Framework/CallbacksPolicy.h" #include "Framework/ConfigContext.h" #include "Framework/CompletionPolicyHelpers.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using GID = o2::dataformats::GlobalTrackID; @@ -37,13 +38,13 @@ void customize(std::vector& workflowOptions) // option allowing to set parameters std::vector options{ {"use-ft0", o2::framework::VariantType::Bool, false, {"use FT0 in matching"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}}, {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}}, {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}}, {"track-sources", VariantType::String, "TPC", {"comma-separated list of sources to use: TPC,TPC-TOF,TPC-TRD,TPC-TRD-TOF"}}, {"produce-calibration-data", o2::framework::VariantType::Bool, false, {"produce output for TPC vdrift calibration"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -70,24 +71,23 @@ WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& configcont o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); // write the configuration used for the workflow o2::conf::ConfigurableParam::writeINI("o2matchtpcits-workflow_configuration.ini"); - GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,TPC-TOF"); GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get("track-sources")); bool needStrictTRDTOF = (src & GID::getSourcesMask("TPC-TRD,TPC-TOF,TPC-TRD-TOF")).any(); + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); auto useFT0 = configcontext.options().get("use-ft0"); if (useFT0) { src |= GID::getSourceMask(GID::FT0); } - auto lumiType = configcontext.options().get("lumi-type"); auto useMC = !configcontext.options().get("disable-mc"); auto calib = configcontext.options().get("produce-calibration-data"); auto srcL = src | GID::getSourcesMask("ITS,TPC"); // ITS is neadded always, TPC must be loaded even if bare TPC tracks are not used in matching - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { srcL = srcL | GID::getSourcesMask("CTP"); } o2::framework::WorkflowSpec specs; - specs.emplace_back(o2::globaltracking::getTPCITSMatchingSpec(srcL, useFT0, calib, !GID::includesSource(GID::TPC, src), useMC, lumiType)); + specs.emplace_back(o2::globaltracking::getTPCITSMatchingSpec(srcL, useFT0, calib, !GID::includesSource(GID::TPC, src), useMC, sclOpt)); if (!configcontext.options().get("disable-root-output")) { specs.emplace_back(o2::globaltracking::getTrackWriterTPCITSSpec(useMC)); diff --git a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TPCTrackStudy.h b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TPCTrackStudy.h index 3d41cca7d5202..47385f400ec01 100644 --- a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TPCTrackStudy.h +++ b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TPCTrackStudy.h @@ -19,10 +19,15 @@ #include "MathUtils/detail/Bracket.h" #include "DataFormatsTPC/ClusterNative.h" +namespace o2::tpc +{ +struct CorrectionMapsLoaderGloOpts; +} + namespace o2::trackstudy { /// create a processor spec -o2::framework::DataProcessorSpec getTPCTrackStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, bool useMC, int lumyType); +o2::framework::DataProcessorSpec getTPCTrackStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace o2::trackstudy diff --git a/Detectors/GlobalTrackingWorkflow/study/src/TPCTrackStudy.cxx b/Detectors/GlobalTrackingWorkflow/study/src/TPCTrackStudy.cxx index e9871c97a9f80..a6256aff9f30d 100644 --- a/Detectors/GlobalTrackingWorkflow/study/src/TPCTrackStudy.cxx +++ b/Detectors/GlobalTrackingWorkflow/study/src/TPCTrackStudy.cxx @@ -404,7 +404,7 @@ void TPCTrackStudySpec::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) } } -DataProcessorSpec getTPCTrackStudySpec(GTrackID::mask_t srcTracks, GTrackID::mask_t srcClusters, bool useMC, int lumyType) +DataProcessorSpec getTPCTrackStudySpec(GTrackID::mask_t srcTracks, GTrackID::mask_t srcClusters, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; Options opts{ @@ -428,7 +428,7 @@ DataProcessorSpec getTPCTrackStudySpec(GTrackID::mask_t srcTracks, GTrackID::mas dataRequest->inputs, true); o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumyType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts); return DataProcessorSpec{ "tpc-track-study", diff --git a/Detectors/GlobalTrackingWorkflow/study/src/tpc-track-study-workflow.cxx b/Detectors/GlobalTrackingWorkflow/study/src/tpc-track-study-workflow.cxx index 1823446502abd..10ee68d39e5e1 100644 --- a/Detectors/GlobalTrackingWorkflow/study/src/tpc-track-study-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/study/src/tpc-track-study-workflow.cxx @@ -20,6 +20,7 @@ #include "DetectorsBase/DPLWorkflowUtils.h" #include "GlobalTrackingWorkflowHelpers/InputHelper.h" #include "DetectorsRaw/HBFUtilsInitializer.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using GID = o2::dataformats::GlobalTrackID; @@ -39,9 +40,9 @@ void customize(std::vector& workflowOptions) {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation"}}, {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of track sources to use"}}, {"cluster-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of cluster sources to use"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"disable-root-input", VariantType::Bool, false, {"disable root-files input reader"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -59,17 +60,17 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // Update the (declared) parameters if changed from the command line o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); - auto lumiType = configcontext.options().get("lumi-type"); auto useMC = !configcontext.options().get("disable-mc"); + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); GID::mask_t srcTrc = allowedSourcesTrc & GID::getSourcesMask(configcontext.options().get("track-sources")); GID::mask_t srcCls = allowedSourcesClus & GID::getSourcesMask(configcontext.options().get("cluster-sources")); - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { srcTrc = srcTrc | GID::getSourcesMask("CTP"); srcCls = srcCls | GID::getSourcesMask("CTP"); } o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC); o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC); // P-vertex is always needed - specs.emplace_back(o2::trackstudy::getTPCTrackStudySpec(srcTrc, srcCls, useMC, lumiType)); + specs.emplace_back(o2::trackstudy::getTPCTrackStudySpec(srcTrc, srcCls, useMC, sclOpt)); // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs); diff --git a/Detectors/TPC/base/include/TPCBase/CDBInterface.h b/Detectors/TPC/base/include/TPCBase/CDBInterface.h index 8eccf540f3d22..4ad354e9676ee 100644 --- a/Detectors/TPC/base/include/TPCBase/CDBInterface.h +++ b/Detectors/TPC/base/include/TPCBase/CDBInterface.h @@ -89,6 +89,8 @@ enum class CDBType { /// CalTimeSeries, ///< integrated DCAs for longer time interval CalScaler, ///< Scaler from IDCs or combined estimator + /// + CorrMapParam, ///< parameters for CorrectionMapsLoader configuration }; /// Upload intervention type @@ -151,6 +153,8 @@ const std::unordered_map CDBTypeMap{ // time series {CDBType::CalTimeSeries, "TPC/Calib/TimeSeries"}, {CDBType::CalScaler, "TPC/Calib/Scaler"}, + // correction maps loader params + {CDBType::CorrMapParam, "TPC/Calib/CorrMapParam"}, }; /// Poor enum reflection ... diff --git a/Detectors/TPC/calibration/CMakeLists.txt b/Detectors/TPC/calibration/CMakeLists.txt index 5b5d2f03ade0b..20e72b28d62cc 100644 --- a/Detectors/TPC/calibration/CMakeLists.txt +++ b/Detectors/TPC/calibration/CMakeLists.txt @@ -53,6 +53,7 @@ o2_add_library(TPCCalibration src/TPCFastSpaceChargeCorrectionHelper.cxx src/CalculatedEdx.cxx src/TPCScaler.cxx + src/CorrMapParam.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC O2::TPCBase O2::TPCReconstruction ROOT::Minuit Microsoft.GSL::GSL @@ -105,7 +106,8 @@ o2_target_root_dictionary(TPCCalibration include/TPCCalibration/SACCCDBHelper.h include/TPCCalibration/TPCFastSpaceChargeCorrectionHelper.h include/TPCCalibration/CalculatedEdx.h - include/TPCCalibration/TPCScaler.h) + include/TPCCalibration/TPCScaler.h + include/TPCCalibration/CorrMapParam.h) o2_add_test_root_macro(macro/comparePedestalsAndNoise.C PUBLIC_LINK_LIBRARIES O2::TPCBase diff --git a/Detectors/TPC/calibration/include/TPCCalibration/CorrMapParam.h b/Detectors/TPC/calibration/include/TPCCalibration/CorrMapParam.h new file mode 100644 index 0000000000000..37945cebfa4a6 --- /dev/null +++ b/Detectors/TPC/calibration/include/TPCCalibration/CorrMapParam.h @@ -0,0 +1,49 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file CorrMapParam.h +/// \brief Implementation of the parameter class for the CorrectionMapsLoader options +/// \author ruben.shahoyan@cern.ch + +#ifndef ALICEO2_TPC_CORRMAP_PARAM_H_ +#define ALICEO2_TPC_CORRMAP_PARAM_H_ + +#include "CommonUtils/ConfigurableParam.h" +#include "CommonUtils/ConfigurableParamHelper.h" + +namespace o2 +{ +namespace tpc +{ + +struct CorrMapParam : public o2::conf::ConfigurableParamHelper { + float lumiInst = 0.; // override instantaneous lumi (if > 0) for TPC corr.map scaling, disable corrections if < 0" + float lumiMean = 0.; // override TPC corr.map mean lumi (if > 0), disable corrections if < 0 + float lumiMeanRef = 0.; // override TPC corr.mapRef mean lumi (if > 0)" + float lumiInstFactor = 1.; // scaling to apply to instantaneous lumi from CTP (but not corrmap-lumi-inst) + int ctpLumiSource = 0; // CTP lumi source: 0 = LumiInfo.getLumi(), 1 = LumiInfo.getLumiAlt() + + O2ParamDef(CorrMapParam, "TPCCorrMap"); +}; +} // namespace tpc + +namespace framework +{ +template +struct is_messageable; +template <> +struct is_messageable : std::true_type { +}; +} // namespace framework + +} // namespace o2 + +#endif // ALICEO2_TPC_CORRMAP_PARAM_H_ diff --git a/Detectors/TPC/calibration/include/TPCCalibration/CorrectionMapsLoader.h b/Detectors/TPC/calibration/include/TPCCalibration/CorrectionMapsLoader.h index a8fbe18619412..d72f69eeca422 100644 --- a/Detectors/TPC/calibration/include/TPCCalibration/CorrectionMapsLoader.h +++ b/Detectors/TPC/calibration/include/TPCCalibration/CorrectionMapsLoader.h @@ -30,12 +30,18 @@ class ProcessingContext; class ConcreteDataMatcher; class InputSpec; class ConfigParamSpec; +class ConfigParamRegistry; class InitContext; } // namespace framework namespace tpc { +struct CorrectionMapsLoaderGloOpts { + int lumiType = 0; + int lumiMode = 0; +}; + class CorrectionMapsLoader : public o2::gpu::CorrectionMapsHelper { public: @@ -50,8 +56,10 @@ class CorrectionMapsLoader : public o2::gpu::CorrectionMapsHelper void init(o2::framework::InitContext& ic); void copySettings(const CorrectionMapsLoader& src); - static void requestCCDBInputs(std::vector& inputs, std::vector& options, int lumiScaleType, int lumiScaleMode = 0); + static void requestCCDBInputs(std::vector& inputs, std::vector& options, const CorrectionMapsLoaderGloOpts& gloOpts); + static void addGlobalOptions(std::vector& options); static void addOptions(std::vector& options); + static CorrectionMapsLoaderGloOpts parseGlobalOptions(const o2::framework::ConfigParamRegistry& opts); protected: static void addOption(std::vector& options, o2::framework::ConfigParamSpec&& osp); diff --git a/Detectors/TPC/calibration/src/CorrMapParam.cxx b/Detectors/TPC/calibration/src/CorrMapParam.cxx new file mode 100644 index 0000000000000..940bd5e6d082d --- /dev/null +++ b/Detectors/TPC/calibration/src/CorrMapParam.cxx @@ -0,0 +1,18 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file CorrMapParam.cxx +/// \brief Implementation of the parameter class for the CorrectionMapsLoader options +/// \author ruben.shahoyan@cern.ch + +#include "TPCCalibration/CorrMapParam.h" + +O2ParamImpl(o2::tpc::CorrMapParam); diff --git a/Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx b/Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx index a86246e9c015f..9a2af80934a7e 100644 --- a/Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx +++ b/Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx @@ -10,6 +10,7 @@ // or submit itself to any jurisdiction. #include "TPCCalibration/CorrectionMapsLoader.h" +#include "TPCCalibration/CorrMapParam.h" #include "TPCReconstruction/TPCFastTransformHelperO2.h" #include "TPCBase/CDBInterface.h" #include "Framework/Logger.h" @@ -40,8 +41,9 @@ void CorrectionMapsLoader::updateVDrift(float vdriftCorr, float vdrifRef, float //________________________________________________________ void CorrectionMapsLoader::extractCCDBInputs(ProcessingContext& pc) { + pc.inputs().get("tpcCorrPar"); pc.inputs().get("tpcCorrMap"); - pc.inputs().get("tpcCorrMapRef"); // not used at the moment + pc.inputs().get("tpcCorrMapRef"); const int maxDumRep = 5; int dumRep = 0; o2::ctp::LumiInfo lumiObj; @@ -63,33 +65,50 @@ void CorrectionMapsLoader::extractCCDBInputs(ProcessingContext& pc) } //________________________________________________________ -void CorrectionMapsLoader::requestCCDBInputs(std::vector& inputs, std::vector& options, int lumiScaleType, int lumiScaleMode) +void CorrectionMapsLoader::requestCCDBInputs(std::vector& inputs, std::vector& options, const CorrectionMapsLoaderGloOpts& gloOpts) { addInput(inputs, {"tpcCorrMap", "TPC", "CorrMap", 0, Lifetime::Condition, ccdbParamSpec(CDBTypeMap.at(CDBType::CalCorrMap), {}, 1)}); // time-dependent - if (lumiScaleMode == 0) { + if (gloOpts.lumiMode == 0) { addInput(inputs, {"tpcCorrMapRef", "TPC", "CorrMapRef", 0, Lifetime::Condition, ccdbParamSpec(CDBTypeMap.at(CDBType::CalCorrMapRef), {}, 0)}); // load once - } else if (lumiScaleMode == 1) { + } else if (gloOpts.lumiMode == 1) { addInput(inputs, {"tpcCorrMapRef", "TPC", "CorrMapRef", 0, Lifetime::Condition, ccdbParamSpec(CDBTypeMap.at(CDBType::CalCorrDerivMap), {}, 1)}); // time-dependent } else { LOG(fatal) << "Correction mode unknown! Choose either 0 (default) or 1 (derivative map) for flag corrmap-lumi-mode."; } - if (lumiScaleType == 1) { + if (gloOpts.lumiType == 1) { addInput(inputs, {"CTPLumi", "CTP", "LUMI", 0, Lifetime::Timeframe}); - } else if (lumiScaleType == 2) { + } else if (gloOpts.lumiType == 2) { addInput(inputs, {"tpcscaler", o2::header::gDataOriginTPC, "TPCSCALER", 0, Lifetime::Timeframe}); } + + addInput(inputs, {"tpcCorrPar", "TPC", "CorrMapParam", 0, Lifetime::Condition, ccdbParamSpec(CDBTypeMap.at(CDBType::CorrMapParam), {}, 0)}); // load once + addOptions(options); } //________________________________________________________ void CorrectionMapsLoader::addOptions(std::vector& options) { - addOption(options, ConfigParamSpec{"corrmap-lumi-mean", VariantType::Float, 0.f, {"override TPC corr.map mean lumi (if > 0), disable corrections if < 0"}}); - addOption(options, ConfigParamSpec{"corrmap-lumi-inst", VariantType::Float, 0.f, {"override instantaneous CTP lumi (if > 0) for TPC corr.map scaling, disable corrections if < 0"}}); - addOption(options, ConfigParamSpec{"corrmap-lumi-mode", VariantType::Int, 0, {"scaling mode: (default) 0 = static + scale * full; 1 = full + scale * derivative"}}); - addOption(options, ConfigParamSpec{"ctp-lumi-factor", VariantType::Float, 1.0f, {"scaling to apply to instantaneous lumi from CTP (but not corrmap-lumi-inst)"}}); - addOption(options, ConfigParamSpec{"ctp-lumi-source", VariantType::Int, 0, {"CTP lumi source: 0 = LumiInfo.getLumi(), 1 = LumiInfo.getLumiAlt()"}}); + // these are options which should be added at the level of device using TPC corrections + // At the moment - nothing, all options are moved to configurable param CorrMapParam +} + +//________________________________________________________ +void CorrectionMapsLoader::addGlobalOptions(std::vector& options) +{ + // these are options which should be added at the workflow level, since they modify the inputs of the devices + addOption(options, ConfigParamSpec{"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}); + addOption(options, ConfigParamSpec{"corrmap-lumi-mode", o2::framework::VariantType::Int, 0, {"scaling mode: (default) 0 = static + scale * full; 1 = full + scale * derivative"}}); +} + +//________________________________________________________ +CorrectionMapsLoaderGloOpts CorrectionMapsLoader::parseGlobalOptions(const o2::framework::ConfigParamRegistry& opts) +{ + CorrectionMapsLoaderGloOpts tpcopt; + tpcopt.lumiType = opts.get("lumi-type"); + tpcopt.lumiMode = opts.get("corrmap-lumi-mode"); + return tpcopt; } //________________________________________________________ @@ -124,9 +143,39 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher, if (matcher == ConcreteDataMatcher("TPC", "CorrMapRef", 0)) { setCorrMapRef((o2::gpu::TPCFastTransform*)obj); mCorrMapRef->rectifyAfterReadingFromFile(); + if (getMeanLumiRefOverride() == 0 && mCorrMapRef->getLumi() > 0.) { + setMeanLumiRef(mCorrMapRef->getLumi()); + } + LOGP(debug, "MeanLumiRefOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiRefOverride(), mCorrMapRef->getLumi(), getMeanLumiRef()); setUpdatedMapRef(); return true; } + if (matcher == ConcreteDataMatcher("TPC", "CorrMapParam", 0)) { + const auto& par = o2::tpc::CorrMapParam::Instance(); + mMeanLumiOverride = par.lumiMean; + mMeanLumiRefOverride = par.lumiMeanRef; + mInstLumiOverride = par.lumiInst; + mInstLumiFactor = par.lumiInstFactor; + mCTPLumiSource = par.ctpLumiSource; + + if (mMeanLumiOverride != 0.) { + setMeanLumi(mMeanLumiOverride, false); + } + if (mMeanLumiRefOverride != 0.) { + setMeanLumiRef(mMeanLumiRefOverride); + } + if (mInstLumiOverride != 0.) { + setInstLumi(mInstLumiOverride, false); + } + setUpdatedLumi(); + int scaleType = getLumiScaleType(); + const std::array lumiS{"OFF", "CTP", "TPC scaler"}; + if (scaleType >= lumiS.size()) { + LOGP(fatal, "Wrong lumi-scale-type provided!"); + } + LOGP(info, "TPC correction map params updated (corr.map scaling type={}): override values: lumiMean={} lumiRefMean={} lumiInst={} lumiScaleMode={}, LumiInst scale={}, CTP Lumi source={}", + lumiS[scaleType], mMeanLumiOverride, mMeanLumiRefOverride, mInstLumiOverride, mLumiScaleMode, mInstLumiFactor, mCTPLumiSource); + } return false; } @@ -142,25 +191,6 @@ void CorrectionMapsLoader::init(o2::framework::InitContext& ic) setLumiScaleType(2); } } - mMeanLumiOverride = ic.options().get("corrmap-lumi-mean"); - mInstLumiOverride = ic.options().get("corrmap-lumi-inst"); - mLumiScaleMode = ic.options().get("corrmap-lumi-mode"); - mInstLumiFactor = ic.options().get("ctp-lumi-factor"); - mCTPLumiSource = ic.options().get("ctp-lumi-source"); - if (mMeanLumiOverride != 0.) { - setMeanLumi(mMeanLumiOverride); - } - if (mInstLumiOverride != 0.) { - setInstLumi(mInstLumiOverride); - } - const std::array lumiS{"OFF", "CTP", "TPC scaler"}; - int scaleType = getLumiScaleType(); - if (scaleType >= lumiS.size()) { - LOGP(fatal, "Wrong lumi-scale-type provided!"); - } - - LOGP(info, "Scaling for TPC corr.map scaling={}, override values: lumiMean={} lumiInst={} lumiScaleMode={}, LumiInst scale={}, CTP Lumi source={}", - lumiS[scaleType], mMeanLumiOverride, mInstLumiOverride, mLumiScaleMode, mInstLumiFactor, mCTPLumiSource); } //________________________________________________________ @@ -168,12 +198,15 @@ void CorrectionMapsLoader::copySettings(const CorrectionMapsLoader& src) { setInstLumi(src.getInstLumi(), false); setMeanLumi(src.getMeanLumi(), false); + setMeanLumiRef(src.getMeanLumiRef()); setLumiScaleType(src.getLumiScaleType()); setMeanLumiOverride(src.getMeanLumiOverride()); + setMeanLumiRefOverride(src.getMeanLumiRefOverride()); setInstLumiOverride(src.getInstLumiOverride()); setLumiScaleMode(src.getLumiScaleMode()); mInstLumiFactor = src.mInstLumiFactor; mCTPLumiSource = src.mCTPLumiSource; + mLumiScaleMode = src.mLumiScaleMode; } #endif // #ifndef GPUCA_GPUCODE_DEVICE diff --git a/Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h b/Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h index a59772256a309..238482b6f8687 100644 --- a/Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h +++ b/Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h @@ -26,6 +26,8 @@ #pragma link C++ class o2::tpc::DigitDump; #pragma link C++ class o2::tpc::DigitDumpParam; #pragma link C++ class o2::conf::ConfigurableParamHelper < o2::tpc::DigitDumpParam> + ; +#pragma link C++ class o2::tpc::CorrMapParam + ; +#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::tpc::CorrMapParam> + ; #pragma link C++ class o2::tpc::CalibPadGainTracks + ; #pragma link C++ class o2::tpc::FastHisto < float> + ; #pragma link C++ class o2::tpc::FastHisto < unsigned int> + ; diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h b/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h index a7f0f66a11fd9..768376ffe4e57 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h @@ -30,6 +30,7 @@ struct InputSpec; } namespace tpc { +struct CorrectionMapsLoaderGloOpts; namespace reco_workflow { @@ -71,20 +72,20 @@ enum struct OutputType { Digits, using CompletionPolicyData = std::vector; /// create the workflow for TPC reconstruction -framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, // - std::vector const& tpcSectors, // - unsigned long tpcSectorMask, // - std::vector const& laneConfiguration, // - bool propagateMC = true, unsigned nLanes = 1, // - std::string const& cfgInput = "digitizer", // - std::string const& cfgOutput = "tracks", // - bool disableRootInput = false, // - int caClusterer = 0, // +framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, // + std::vector const& tpcSectors, // + unsigned long tpcSectorMask, // + std::vector const& laneConfiguration, // + const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, // + bool propagateMC = true, unsigned nLanes = 1, // + std::string const& cfgInput = "digitizer", // + std::string const& cfgOutput = "tracks", // + bool disableRootInput = false, // + int caClusterer = 0, // int zsOnTheFly = 0, bool askDISTSTF = true, bool selIR = false, bool filteredInp = false, - int lumiScaleType = 0, int deadMapSources = -1); void cleanupCallback(); diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCCalibPadGainTracksSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCCalibPadGainTracksSpec.h index 9d6004b113823..43418be4613e0 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCCalibPadGainTracksSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCCalibPadGainTracksSpec.h @@ -240,12 +240,15 @@ class TPCCalibPadGainTracksDevice : public o2::framework::Task } }; -DataProcessorSpec getTPCCalibPadGainTracksSpec(const uint32_t publishAfterTFs, const bool debug, const bool useLastExtractedMapAsReference, const std::string polynomialsFile, bool disablePolynomialsCCDB, int lumiType) +DataProcessorSpec getTPCCalibPadGainTracksSpec(const uint32_t publishAfterTFs, const bool debug, const bool useLastExtractedMapAsReference, const std::string polynomialsFile, bool disablePolynomialsCCDB, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector inputs; inputs.emplace_back("trackTPC", gDataOriginTPC, "TRACKS", 0, Lifetime::Timeframe); inputs.emplace_back("trackTPCClRefs", gDataOriginTPC, "CLUSREFS", 0, Lifetime::Timeframe); inputs.emplace_back("clusTPC", ConcreteDataTypeMatcher{gDataOriginTPC, "CLUSTERNATIVE"}, Lifetime::Timeframe); + if (sclOpts.lumiType == 1) { + inputs.emplace_back("CTPLumi", "CTP", "LUMI", 0, Lifetime::Timeframe); + } if (!polynomialsFile.empty()) { disablePolynomialsCCDB = true; @@ -282,7 +285,7 @@ DataProcessorSpec getTPCCalibPadGainTracksSpec(const uint32_t publishAfterTFs, c {"useEveryNthTF", VariantType::Int, 10, {"Using only a fraction of the data: 1: Use every TF, 10: Use only every tenth TF."}}, {"maxTracksPerTF", VariantType::Int, 10000, {"Maximum number of processed tracks per TF (-1 for processing all tracks)"}}, }; - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(inputs, opts, sclOpts); auto ccdbRequest = std::make_shared(false, // orbitResetTime false, // GRPECS=true diff --git a/Detectors/TPC/workflow/src/RecoWorkflow.cxx b/Detectors/TPC/workflow/src/RecoWorkflow.cxx index f5c1afd42acfc..33b8f96416cd9 100644 --- a/Detectors/TPC/workflow/src/RecoWorkflow.cxx +++ b/Detectors/TPC/workflow/src/RecoWorkflow.cxx @@ -42,6 +42,7 @@ #include "DataFormatsTPC/ZeroSuppression.h" #include "TPCReaderWorkflow/ClusterReaderSpec.h" #include "TPCReaderWorkflow/TriggerReaderSpec.h" +#include "TPCCalibration/CorrectionMapsLoader.h" #include #include @@ -97,8 +98,8 @@ const std::unordered_map OutputMap{ {"tpc-triggers", OutputType::TPCTriggers}}; framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vector const& tpcSectors, unsigned long tpcSectorMask, std::vector const& laneConfiguration, - bool propagateMC, unsigned nLanes, std::string const& cfgInput, std::string const& cfgOutput, bool disableRootInput, - int caClusterer, int zsOnTheFly, bool askDISTSTF, bool selIR, bool filteredInp, int lumiScaleType, int deadMapSources) + const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool propagateMC, unsigned nLanes, std::string const& cfgInput, std::string const& cfgOutput, bool disableRootInput, + int caClusterer, int zsOnTheFly, bool askDISTSTF, bool selIR, bool filteredInp, int deadMapSources) { InputType inputType; try { @@ -440,7 +441,8 @@ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vecto if (runGPUReco) { o2::gpu::GPURecoWorkflowSpec::Config cfg; cfg.runTPCTracking = true; - cfg.lumiScaleType = lumiScaleType; + cfg.lumiScaleType = sclOpts.lumiType; + cfg.lumiScaleMode = sclOpts.lumiMode; cfg.decompressTPC = decompressTPC; cfg.decompressTPCFromROOT = decompressTPC && inputType == InputType::CompClusters; cfg.caClusterer = caClusterer; diff --git a/Detectors/TPC/workflow/src/tpc-calib-gainmap-tracks.cxx b/Detectors/TPC/workflow/src/tpc-calib-gainmap-tracks.cxx index 1dfdaf34276ca..90dd77391661d 100644 --- a/Detectors/TPC/workflow/src/tpc-calib-gainmap-tracks.cxx +++ b/Detectors/TPC/workflow/src/tpc-calib-gainmap-tracks.cxx @@ -20,6 +20,7 @@ #include "CommonUtils/ConfigurableParam.h" #include "TPCWorkflow/TPCCalibPadGainTracksSpec.h" #include "TPCReaderWorkflow/TPCSectorCompletionPolicy.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; @@ -41,9 +42,8 @@ void customize(std::vector& workflowOptions) {"useLastExtractedMapAsReference", VariantType::Bool, false, {"enabling iterative extraction of the gain map: Using the extracted gain map from the previous iteration to correct the cluster charge"}}, {"polynomialsFile", VariantType::String, "", {"file containing the polynomials for the track topology correction"}}, {"disablePolynomialsCCDB", VariantType::Bool, false, {"Do not load the polynomials from the CCDB"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}}; - + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); std::swap(workflowOptions, options); } @@ -57,13 +57,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) o2::conf::ConfigurableParam::updateFromFile(config.options().get("configFile")); o2::conf::ConfigurableParam::updateFromString(config.options().get("configKeyValues")); o2::conf::ConfigurableParam::writeINI("o2tpcpadgaintrackscalibrator_configuration.ini"); - auto lumiType = config.options().get("lumi-type"); const auto debug = config.options().get("debug"); const auto publishAfterTFs = (uint32_t)config.options().get("publish-after-tfs"); const bool useLastExtractedMapAsReference = config.options().get("useLastExtractedMapAsReference"); const std::string polynomialsFile = config.options().get("polynomialsFile"); const auto disablePolynomialsCCDB = config.options().get("disablePolynomialsCCDB"); - - WorkflowSpec workflow{getTPCCalibPadGainTracksSpec(publishAfterTFs, debug, useLastExtractedMapAsReference, polynomialsFile, disablePolynomialsCCDB, lumiType)}; + const auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(config.options()); + WorkflowSpec workflow{getTPCCalibPadGainTracksSpec(publishAfterTFs, debug, useLastExtractedMapAsReference, polynomialsFile, disablePolynomialsCCDB, sclOpt)}; return workflow; } diff --git a/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx b/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx index 3aca0353289a9..33b9de1143434 100644 --- a/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx +++ b/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx @@ -23,6 +23,7 @@ #include "Framework/ConcreteDataMatcher.h" #include "TPCWorkflow/RecoWorkflow.h" #include "TPCReaderWorkflow/TPCSectorCompletionPolicy.h" +#include "TPCCalibration/CorrectionMapsLoader.h" #include "Framework/CustomWorkflowTerminationHook.h" #include "DataFormatsTPC/TPCSectorHeader.h" #include "Algorithm/RangeTokenizer.h" @@ -68,10 +69,10 @@ void customize(std::vector& workflowOptions) {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g.: 'TPCHwClusterer.peakChargeThreshold=4;...')"}}, {"configFile", VariantType::String, "", {"configuration file for configurable parameters"}}, {"filtered-input", VariantType::Bool, false, {"Filtered tracks, clusters input, prefix dataDescriptors with F"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"select-ir-frames", VariantType::Bool, false, {"Subscribe and filter according to external IR Frames"}}, {"tpc-deadMap-sources", VariantType::Int, -1, {"Sources to consider for TPC dead channel map creation; -1=all, 0=deactivated"}}, }; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -140,7 +141,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) std::vector laneConfiguration = tpcSectors; // Currently just a copy of the tpcSectors, why? auto nLanes = cfgc.options().get("tpc-lanes"); auto inputType = cfgc.options().get("input-type"); - auto lumiType = cfgc.options().get("lumi-type"); + // depending on whether to dispatch early (prompt) and on the input type, we // set the matcher. Note that this has to be in accordance with the OutputSpecs // configured for the PublisherSpec @@ -167,10 +168,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) gTpcSectorMask |= (1ul << s); } bool doMC = not cfgc.options().get("disable-mc"); + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(cfgc.options()); auto wf = o2::tpc::reco_workflow::getWorkflow(&gPolicyData, // tpcSectors, // sector configuration gTpcSectorMask, // same as bitmask laneConfiguration, // lane configuration + sclOpt, // scaling options doMC, // nLanes, // inputType, // @@ -181,7 +184,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) !cfgc.options().get("ignore-dist-stf"), // cfgc.options().get("select-ir-frames"), cfgc.options().get("filtered-input"), - lumiType, cfgc.options().get("tpc-deadMap-sources")); // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit diff --git a/Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h b/Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h index a7351b221def1..60490e9a9950a 100644 --- a/Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h +++ b/Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h @@ -101,7 +101,7 @@ class TRDGlobalTracking : public o2::framework::Task }; /// create a processor spec -framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, int lumiType /* = 0*/); +framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts); } // namespace trd } // namespace o2 diff --git a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx index 3b3946bbf56e8..8ea4d67572976 100644 --- a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx +++ b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx @@ -800,7 +800,7 @@ void TRDGlobalTracking::endOfStream(EndOfStreamContext& ec) mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1); } -DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, int lumiType) +DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts) { std::vector outputs; uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard); @@ -829,7 +829,7 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, boo true); o2::tpc::VDriftHelper::requestCCDBInputs(inputs); Options opts; - o2::tpc::CorrectionMapsLoader::requestCCDBInputs(inputs, opts, lumiType); + o2::tpc::CorrectionMapsLoader::requestCCDBInputs(inputs, opts, sclOpts); // Request PID policy data if (withPID) { diff --git a/Detectors/TRD/workflow/src/trd-tracking-workflow.cxx b/Detectors/TRD/workflow/src/trd-tracking-workflow.cxx index 277d8efb78a2b..c7a489b0fa6e1 100644 --- a/Detectors/TRD/workflow/src/trd-tracking-workflow.cxx +++ b/Detectors/TRD/workflow/src/trd-tracking-workflow.cxx @@ -24,6 +24,7 @@ #include "TRDWorkflow/TRDGlobalTrackingQCSpec.h" #include "TRDWorkflow/TRDPulseHeightSpec.h" #include "GlobalTrackingWorkflowHelpers/InputHelper.h" +#include "TPCCalibration/CorrectionMapsLoader.h" using namespace o2::framework; using GTrackID = o2::dataformats::GlobalTrackID; @@ -58,9 +59,9 @@ void customize(std::vector& workflowOptions) {"filter-trigrec", VariantType::Bool, false, {"ignore interaction records without ITS data"}}, {"strict-matching", VariantType::Bool, false, {"High purity preliminary matching"}}, {"disable-ft0-pileup-tagging", VariantType::Bool, false, {"Do not request FT0 for pile-up determination"}}, - {"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, {"policy", VariantType::String, "default", {"Pick PID policy (=default)"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}}; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -80,11 +81,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto pid = configcontext.options().get("enable-pid"); auto strict = configcontext.options().get("strict-matching"); auto trigRecFilterActive = configcontext.options().get("filter-trigrec"); - auto lumiType = configcontext.options().get("lumi-type"); auto vdexb = configcontext.options().get("enable-vdexb-calib"); auto gain = configcontext.options().get("enable-gain-calib"); auto pulseHeight = configcontext.options().get("enable-ph"); auto digitsSpec = configcontext.options().get("trd-digits-spec"); + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options()); bool rootInput = !configcontext.options().get("disable-root-input"); GTrackID::mask_t srcTRD = allowedSources & GTrackID::getSourcesMask(configcontext.options().get("track-sources")); if (strict && (srcTRD & ~GTrackID::getSourcesMask("TPC")).any()) { @@ -94,7 +95,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (!configcontext.options().get("disable-ft0-pileup-tagging")) { srcTRD |= GTrackID::getSourcesMask("FT0"); } - if (lumiType == 1) { + if (sclOpt.lumiType == 1) { srcTRD = srcTRD | GTrackID::getSourcesMask("CTP"); } // Parse PID policy string @@ -111,7 +112,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // processing devices o2::framework::WorkflowSpec specs; - specs.emplace_back(o2::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, lumiType)); + specs.emplace_back(o2::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, sclOpt)); if (vdexb || gain) { specs.emplace_back(o2::trd::getTRDTrackBasedCalibSpec(srcTRD, vdexb, gain)); } diff --git a/GPU/TPCFastTransformation/CorrectionMapsHelper.cxx b/GPU/TPCFastTransformation/CorrectionMapsHelper.cxx index 91439c587f63a..cf7fdd8370f78 100644 --- a/GPU/TPCFastTransformation/CorrectionMapsHelper.cxx +++ b/GPU/TPCFastTransformation/CorrectionMapsHelper.cxx @@ -26,6 +26,7 @@ void CorrectionMapsHelper::clear() mUpdatedFlags = 0; mInstLumi = 0.f; mMeanLumi = 0.f; + mMeanLumiRef = 0.f; } void CorrectionMapsHelper::setOwner(bool v) @@ -77,5 +78,5 @@ void CorrectionMapsHelper::setCorrMapRef(std::unique_ptr&& m) //________________________________________________________ void CorrectionMapsHelper::reportScaling() { - LOGP(info, "InstLumiOverride={}, LumiScaleType={} -> instLumi={}, meanLumi={} -> LumiScale={}, lumiScaleMode={}", getInstLumiOverride(), getLumiScaleType(), getInstLumi(), getMeanLumi(), getLumiScale(), getLumiScaleMode()); + LOGP(info, "Map scaling update: InstLumiOverride={}, LumiScaleType={} -> instLumi={}, meanLumi={} -> LumiScale={}, lumiScaleMode={}", getInstLumiOverride(), getLumiScaleType(), getInstLumi(), getMeanLumi(), getLumiScale(), getLumiScaleMode()); } diff --git a/GPU/TPCFastTransformation/CorrectionMapsHelper.h b/GPU/TPCFastTransformation/CorrectionMapsHelper.h index 88e00eec419ce..75d194bef63cb 100644 --- a/GPU/TPCFastTransformation/CorrectionMapsHelper.h +++ b/GPU/TPCFastTransformation/CorrectionMapsHelper.h @@ -80,6 +80,13 @@ class CorrectionMapsHelper } } + void setMeanLumiRef(float v) + { + if (v != mMeanLumi) { + mMeanLumiRef = v; + } + } + void setLumiScaleMode(int v) { if (v != mLumiScaleMode) { @@ -93,7 +100,8 @@ class CorrectionMapsHelper if (mMeanLumi < 0.f || mInstLumi < 0.f) { mLumiScale = -1.f; } else if (mLumiScaleMode == 1) { - mLumiScale = mMeanLumi ? mInstLumi / mMeanLumi - 1. : 0.f; + mLumiScale = mMeanLumiRef ? (mInstLumi - mMeanLumi) / mMeanLumiRef : 0.f; + LOGP(debug, "mInstLumi: {} mMeanLumi: {} mMeanLumiRef: {}", mInstLumi, mMeanLumi, mMeanLumiRef); } else { mLumiScale = mMeanLumi ? mInstLumi / mMeanLumi : 0.f; } @@ -105,6 +113,8 @@ class CorrectionMapsHelper GPUd() float getInstLumi() const { return mInstLumi; } GPUd() float getMeanLumi() const { return mMeanLumi; } + GPUd() float getMeanLumiRef() const { return mMeanLumiRef; } + GPUd() float getLumiScale() const { return mLumiScale; } GPUd() int getLumiScaleMode() const { return mLumiScaleMode; } @@ -127,7 +137,9 @@ class CorrectionMapsHelper int getLumiScaleType() const { return mLumiScaleType; } void setMeanLumiOverride(float f) { mMeanLumiOverride = f; } + void setMeanLumiRefOverride(float f) { mMeanLumiRefOverride = f; } float getMeanLumiOverride() const { return mMeanLumiOverride; } + float getMeanLumiRefOverride() const { return mMeanLumiRefOverride; } void setInstLumiOverride(float f) { mInstLumiOverride = f; } float getInstLumiOverride() const { return mInstLumiOverride; } @@ -143,14 +155,16 @@ class CorrectionMapsHelper int mUpdatedFlags = 0; float mInstLumi = 0.; // instanteneous luminosity (a.u) float mMeanLumi = 0.; // mean luminosity of the map (a.u) + float mMeanLumiRef = 0.; // mean luminosity of the ref map (a.u) float mLumiScale = 0.; // precalculated mInstLumi/mMeanLumi int mLumiScaleMode = 0; // scaling-mode of the correciton maps float mMeanLumiOverride = -1.f; // optional value to override mean lumi + float mMeanLumiRefOverride = -1.f; // optional value to override ref mean lumi float mInstLumiOverride = -1.f; // optional value to override inst lumi GPUCA_NAMESPACE::gpu::TPCFastTransform* mCorrMap{nullptr}; // current transform GPUCA_NAMESPACE::gpu::TPCFastTransform* mCorrMapRef{nullptr}; // reference transform #ifndef GPUCA_ALIROOT_LIB - ClassDefNV(CorrectionMapsHelper, 3); + ClassDefNV(CorrectionMapsHelper, 4); #endif }; diff --git a/GPU/TPCFastTransformation/TPCFastTransform.h b/GPU/TPCFastTransformation/TPCFastTransform.h index 4c07873df3f38..956ae13646ff6 100644 --- a/GPU/TPCFastTransformation/TPCFastTransform.h +++ b/GPU/TPCFastTransformation/TPCFastTransform.h @@ -442,7 +442,7 @@ GPUdi() void TPCFastTransform::TransformInternal(int slice, int row, float& u, f { if (mApplyCorrection) { float dx = 0.f, du = 0.f, dv = 0.f; - if (scale >= 0.f) { + if ((scale >= 0.f) || (scaleMode == 1)) { #ifndef GPUCA_GPUCODE if (mCorrectionSlow) { float ly, lz; @@ -463,14 +463,14 @@ GPUdi() void TPCFastTransform::TransformInternal(int slice, int row, float& u, f #endif // GPUCA_GPUCODE { mCorrection.getCorrection(slice, row, u, v, dx, du, dv); - if (ref && scale > 0.f) { // scaling was requested - if (scaleMode == 0) { + if (ref) { + if ((scale > 0.f) && (scaleMode == 0)) { // scaling was requested float dxRef, duRef, dvRef; ref->mCorrection.getCorrection(slice, row, u, v, dxRef, duRef, dvRef); dx = (dx - dxRef) * scale + dxRef; du = (du - duRef) * scale + duRef; dv = (dv - dvRef) * scale + dvRef; - } else if (scaleMode == 1) { + } else if ((scale != 0.f) && (scaleMode == 1)) { float dxRef, duRef, dvRef; ref->mCorrection.getCorrection(slice, row, u, v, dxRef, duRef, dvRef); dx = dxRef * scale + dx; @@ -499,8 +499,21 @@ GPUdi() void TPCFastTransform::TransformInternal(int slice, int row, float& u, f float YZtoNominalY; float YZtoNominalZ; InverseTransformYZtoNominalYZ(slice, row, ly, lz, YZtoNominalY, YZtoNominalZ); + + float dxRef, duRef, dvRef; + ref->mCorrection.getCorrection(slice, row, u, v, dxRef, duRef, dvRef); + + float dxOrig, duOrig, dvOrig; + mCorrection.getCorrection(slice, row, u, v, dxOrig, duOrig, dvOrig); + o2::utils::DebugStreamer::instance()->getStreamer("debug_fasttransform", "UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName("tree_Transform").data() // corrections in x, u, v + << "dxOrig=" << dxOrig + << "duOrig=" << duOrig + << "dvOrig=" << dvOrig + << "dxRef=" << dxRef + << "duRef=" << duRef + << "dvRef=" << dvRef << "dx=" << dx << "du=" << du << "dv=" << dv @@ -525,6 +538,7 @@ GPUdi() void TPCFastTransform::TransformInternal(int slice, int row, float& u, f << "invYZtoX=" << invYZtoX << "YZtoNominalY=" << YZtoNominalY << "YZtoNominalZ=" << YZtoNominalZ + << "scaleMode=" << scaleMode << "\n"; }) diff --git a/GPU/Workflow/src/GPUWorkflowSpec.cxx b/GPU/Workflow/src/GPUWorkflowSpec.cxx index 7132d7281a22d..40b6c13495a66 100644 --- a/GPU/Workflow/src/GPUWorkflowSpec.cxx +++ b/GPU/Workflow/src/GPUWorkflowSpec.cxx @@ -1088,7 +1088,8 @@ Inputs GPURecoWorkflowSpec::inputs() inputs.emplace_back("tpcthreshold", gDataOriginTPC, "PADTHRESHOLD", 0, Lifetime::Condition, ccdbParamSpec("TPC/Config/FEEPad")); o2::tpc::VDriftHelper::requestCCDBInputs(inputs); Options optsDummy; - mCalibObjects.mFastTransformHelper->requestCCDBInputs(inputs, optsDummy, mSpecConfig.lumiScaleType, mSpecConfig.lumiScaleMode); // option filled here is lost + o2::tpc::CorrectionMapsLoaderGloOpts gloOpts{mSpecConfig.lumiScaleType, mSpecConfig.lumiScaleMode}; + mCalibObjects.mFastTransformHelper->requestCCDBInputs(inputs, optsDummy, gloOpts); // option filled here is lost } if (mSpecConfig.decompressTPC) { inputs.emplace_back(InputSpec{"input", ConcreteDataTypeMatcher{gDataOriginTPC, mSpecConfig.decompressTPCFromROOT ? o2::header::DataDescription("COMPCLUSTERS") : o2::header::DataDescription("COMPCLUSTERSFLAT")}, Lifetime::Timeframe}); diff --git a/GPU/Workflow/src/gpu-reco-workflow.cxx b/GPU/Workflow/src/gpu-reco-workflow.cxx index 8474d9eb8d30d..d3572f1e6873a 100644 --- a/GPU/Workflow/src/gpu-reco-workflow.cxx +++ b/GPU/Workflow/src/gpu-reco-workflow.cxx @@ -28,6 +28,7 @@ #include "Algorithm/RangeTokenizer.h" #include "GlobalTrackingWorkflowHelpers/InputHelper.h" #include "ReconstructionDataFormats/GlobalTrackID.h" +#include "TPCCalibration/CorrectionMapsLoader.h" #include #include @@ -52,7 +53,7 @@ void customize(std::vector& workflowOptions) std::vector options{ {"input-type", VariantType::String, "digits", {"digitizer, digits, zsraw, zsonthefly, clustersnative, compressed-clusters-root, compressed-clusters-ctf, trd-tracklets"}}, {"output-type", VariantType::String, "tracks", {"clustersnative, tracks, compressed-clusters-ctf, qa, no-shared-cluster-map, send-clusters-per-sector, trd-tracks, error-qa, tpc-triggers"}}, - {"lumi-type", VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}}, + {"corrmap-lumi-mode", VariantType::Int, 0, {"scaling mode: (default) 0 = static + scale * full; 1 = full + scale * derivative"}}, {"disable-root-input", VariantType::Bool, true, {"disable root-files input reader"}}, {"disable-mc", VariantType::Bool, false, {"disable sending of MC information"}}, {"ignore-dist-stf", VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}}, @@ -61,6 +62,7 @@ void customize(std::vector& workflowOptions) {"enableDoublePipeline", VariantType::Bool, false, {"enable GPU double pipeline mode"}}, {"tpc-deadMap-sources", VariantType::Int, -1, {"Sources to consider for TPC dead channel map creation; -1=all, 0=deactivated"}}, }; + o2::tpc::CorrectionMapsLoader::addGlobalOptions(options); o2::raw::HBFUtilsInitializer::addConfigOption(options); std::swap(workflowOptions, options); } @@ -136,9 +138,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) std::iota(tpcSectors.begin(), tpcSectors.end(), 0); auto inputType = cfgc.options().get("input-type"); - auto lumiType = cfgc.options().get("lumi-type"); bool doMC = !cfgc.options().get("disable-mc"); - + auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(cfgc.options()); o2::conf::ConfigurableParam::updateFromFile(cfgc.options().get("configFile")); o2::conf::ConfigurableParam::updateFromString(cfgc.options().get("configKeyValues")); o2::conf::ConfigurableParam::writeINI("o2gpurecoworkflow_configuration.ini"); @@ -157,7 +158,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) GPURecoWorkflowSpec::Config cfg; cfg.runTPCTracking = true; - cfg.lumiScaleType = lumiType; + cfg.lumiScaleType = sclOpt.lumiType; + cfg.lumiScaleMode = sclOpt.lumiMode; cfg.decompressTPC = isEnabled(inputTypes, ioType::CompClustCTF); cfg.decompressTPCFromROOT = isEnabled(inputTypes, ioType::CompClustROOT); cfg.zsDecoder = isEnabled(inputTypes, ioType::ZSRaw); diff --git a/prodtests/full-system-test/dpl-workflow.sh b/prodtests/full-system-test/dpl-workflow.sh index e75966be6b204..a5416204e27fa 100755 --- a/prodtests/full-system-test/dpl-workflow.sh +++ b/prodtests/full-system-test/dpl-workflow.sh @@ -88,6 +88,8 @@ EMCRAW2C_CONFIG= PHS_CONFIG= MCH_CONFIG_KEY= CTP_CONFIG= +TPC_CORR_OPT= +TPC_CORR_KEY= INTERACTION_TAG_CONFIG_KEY= : ${STRTRACKING:=} : ${ITSEXTRAERR:=} @@ -269,20 +271,19 @@ GPU_CONFIG_SELF="--severity $SEVERITY_TPC" parse_TPC_CORR_SCALING() { -ASK_CTP_LUMI_GPU= -local restOpt= while [[ $# -gt 0 ]]; do + echo $1 case "$1" in - --lumi-type=*) ASK_CTP_LUMI_GPU=" --lumi-type ${1#*=}"; [[ ${1#*=} == "2" ]] && NEED_TPC_SCALERS_WF=1; shift 1;; - --lumi-type) ASK_CTP_LUMI_GPU=" --lumi-type ${2}"; [[ ${2} == "2" ]] && NEED_TPC_SCALERS_WF=1; shift 2;; - *) restOpt+=" $1"; shift 1;; + --lumi-type=*) TPC_CORR_OPT+=" --lumi-type ${1#*=}"; shift 1;; + --lumi-type) TPC_CORR_OPT+=" --lumi-type ${2}"; shift 2;; + --corrmap-lumi-mode=*) TPC_CORR_OPT+=" --corrmap-lumi-mode ${1#*=}"; shift 1;; + --corrmap-lumi-mode) TPC_CORR_OPT+=" --corrmap-lumi-mode ${2}"; shift 2;; + *) TPC_CORR_KEY+="$1;"; shift 1;; esac done -TPC_CORR_SCALING_GPU=$restOpt } parse_TPC_CORR_SCALING $TPC_CORR_SCALING -GPU_CONFIG_SELF+=" $TPC_CORR_SCALING_GPU " if [[ $GPUTYPE != "CPU" && $(ulimit -e) -ge 25 && ${O2_GPU_WORKFLOW_NICE:-} == 1 ]]; then GPU_CONFIG_SELF+=" --child-driver 'nice -n -5'" @@ -472,14 +473,14 @@ fi # --------------------------------------------------------------------------------------------------------------------- # Common reconstruction workflows -(has_detector_reco TPC || has_detector_ctf TPC) && ! has_detector_from_global_reader TPC && add_W o2-gpu-reco-workflow "--gpu-reconstruction \"$GPU_CONFIG_SELF\" $ASK_CTP_LUMI_GPU --input-type=$GPU_INPUT $DISABLE_MC --output-type $GPU_OUTPUT --pipeline gpu-reconstruction:${N_TPCTRK:-1},gpu-reconstruction-prepare:${N_TPCTRK:-1} $GPU_CONFIG" "GPU_global.deviceType=$GPUTYPE;GPU_proc.debugLevel=0;$GPU_CONFIG_KEY;$TRACKTUNETPCINNER" +(has_detector_reco TPC || has_detector_ctf TPC) && ! has_detector_from_global_reader TPC && add_W o2-gpu-reco-workflow "--gpu-reconstruction \"$GPU_CONFIG_SELF\" --input-type=$GPU_INPUT $DISABLE_MC --output-type $GPU_OUTPUT $TPC_CORR_OPT --pipeline gpu-reconstruction:${N_TPCTRK:-1},gpu-reconstruction-prepare:${N_TPCTRK:-1} $GPU_CONFIG" "GPU_global.deviceType=$GPUTYPE;GPU_proc.debugLevel=0;$GPU_CONFIG_KEY;$TRACKTUNETPCINNER;$TPC_CORR_KEY" (has_detector_reco TOF || has_detector_ctf TOF) && ! has_detector_from_global_reader TOF && add_W o2-tof-reco-workflow "$TOF_CONFIG --input-type $TOF_INPUT --output-type $TOF_OUTPUT $DISABLE_DIGIT_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC --pipeline $(get_N tof-compressed-decoder TOF RAW 1),$(get_N TOFClusterer TOF REST 1)" has_detector_reco ITS && ! has_detector_from_global_reader ITS && add_W o2-its-reco-workflow "--trackerCA $ITS_CONFIG $DISABLE_MC $DISABLE_DIGIT_CLUSTER_INPUT $DISABLE_ROOT_OUTPUT --pipeline $(get_N its-tracker ITS REST 1 ITSTRK)" "$ITS_CONFIG_KEY;$ITSMFT_STROBES;$ITSEXTRAERR" has_detector_reco FT0 && ! has_detector_from_global_reader FT0 && add_W o2-ft0-reco-workflow "$DISABLE_DIGIT_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC --pipeline $(get_N ft0-reconstructor FT0 REST 1)" has_detector_reco TRD && ! has_detector_from_global_reader TRD && add_W o2-trd-tracklet-transformer "--disable-irframe-reader $DISABLE_DIGIT_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $TRD_FILTER_CONFIG --pipeline $(get_N TRDTRACKLETTRANSFORMER TRD REST 1 TRDTRKTRANS)" -has_detectors_reco ITS TPC && has_detector_matching ITSTPC && add_W o2-tpcits-match-workflow "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $SEND_ITSTPC_DTGL $TPC_CORR_SCALING --nthreads $ITSTPC_THREADS --pipeline $(get_N itstpc-track-matcher MATCH REST $ITSTPC_THREADS TPCITS)" "$ITSTPC_CONFIG_KEY;$INTERACTION_TAG_CONFIG_KEY;$ITSMFT_STROBES;$ITSEXTRAERR" -has_detector_reco TRD && [[ ! -z "$TRD_SOURCES" ]] && add_W o2-trd-global-tracking "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $TRD_CONFIG $TRD_FILTER_CONFIG $TPC_CORR_SCALING --track-sources $TRD_SOURCES --pipeline $(get_N trd-globaltracking_TPC_ITS-TPC_ TRD REST 1 TRDTRK),$(get_N trd-globaltracking_TPC_FT0_ITS-TPC_ TRD REST 1 TRDTRK),$(get_N trd-globaltracking_TPC_FT0_ITS-TPC_CTP_ TRD REST 1 TRDTRK)" "$TRD_CONFIG_KEY;$INTERACTION_TAG_CONFIG_KEY;$ITSMFT_STROBES;$ITSEXTRAERR" -has_detector_reco TOF && [[ ! -z "$TOF_SOURCES" ]] && add_W o2-tof-matcher-workflow "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $TPC_CORR_SCALING --track-sources $TOF_SOURCES --pipeline $(get_N tof-matcher TOF REST 1 TOFMATCH)" "$ITSMFT_STROBES;$ITSEXTRAERR" +has_detectors_reco ITS TPC && has_detector_matching ITSTPC && add_W o2-tpcits-match-workflow "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $SEND_ITSTPC_DTGL $TPC_CORR_OPT --nthreads $ITSTPC_THREADS --pipeline $(get_N itstpc-track-matcher MATCH REST $ITSTPC_THREADS TPCITS)" "$ITSTPC_CONFIG_KEY;$INTERACTION_TAG_CONFIG_KEY;$ITSMFT_STROBES;$ITSEXTRAERR;$TPC_CORR_KEY" +has_detector_reco TRD && [[ ! -z "$TRD_SOURCES" ]] && add_W o2-trd-global-tracking "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $TRD_CONFIG $TRD_FILTER_CONFIG $TPC_CORR_OPT --track-sources $TRD_SOURCES --pipeline $(get_N trd-globaltracking_TPC_ITS-TPC_ TRD REST 1 TRDTRK),$(get_N trd-globaltracking_TPC_FT0_ITS-TPC_ TRD REST 1 TRDTRK),$(get_N trd-globaltracking_TPC_FT0_ITS-TPC_CTP_ TRD REST 1 TRDTRK)" "$TRD_CONFIG_KEY;$INTERACTION_TAG_CONFIG_KEY;$ITSMFT_STROBES;$ITSEXTRAERR;$TPC_CORR_KEY" +has_detector_reco TOF && [[ ! -z "$TOF_SOURCES" ]] && add_W o2-tof-matcher-workflow "$DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $DISABLE_MC $TPC_CORR_OPT --track-sources $TOF_SOURCES --pipeline $(get_N tof-matcher TOF REST 1 TOFMATCH)" "$ITSMFT_STROBES;$ITSEXTRAERR;$TPC_CORR_KEY" has_detectors TPC && [[ -z "$DISABLE_ROOT_OUTPUT" && "${SKIP_TPC_CLUSTERSTRACKS_OUTPUT:-}" != 1 ]] && ! has_detector_from_global_reader TPC && add_W o2-tpc-reco-workflow "--input-type pass-through --output-type clusters,tpc-triggers,tracks,send-clusters-per-sector $DISABLE_MC" # --------------------------------------------------------------------------------------------------------------------- @@ -524,7 +525,7 @@ has_detector_reco MCH && ( [[ -z "$DISABLE_ROOT_OUTPUT" ]] || needs_root_output has_detector_matching PRIMVTX && [[ ! -z "$VERTEXING_SOURCES" ]] && add_W o2-primary-vertexing-workflow "$DISABLE_MC $DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $PVERTEX_CONFIG --pipeline $(get_N primary-vertexing MATCH REST 1 PRIMVTX),$(get_N pvertex-track-matching MATCH REST 1 PRIMVTXMATCH)" "${PVERTEXING_CONFIG_KEY};${INTERACTION_TAG_CONFIG_KEY};" if [[ $BEAMTYPE != "cosmic" ]] && has_detectors_reco ITS && has_detector_matching SECVTX && [[ ! -z "$SVERTEXING_SOURCES" ]]; then - add_W o2-secondary-vertexing-workflow "$DISABLE_MC $STRTRACKING $DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $TPC_CORR_SCALING --vertexing-sources $SVERTEXING_SOURCES --threads $SVERTEX_THREADS --pipeline $(get_N secondary-vertexing MATCH REST $SVERTEX_THREADS SECVTX)" + add_W o2-secondary-vertexing-workflow "$DISABLE_MC $STRTRACKING $DISABLE_ROOT_INPUT $DISABLE_ROOT_OUTPUT $TPC_CORR_OPT --vertexing-sources $SVERTEXING_SOURCES --threads $SVERTEX_THREADS --pipeline $(get_N secondary-vertexing MATCH REST $SVERTEX_THREADS SECVTX)" "$TPC_CORR_KEY" SECTVTX_ON="1" else SECTVTX_ON="0"