From 4865deaeed6b91ad83e9d5d8f24f47b0a845d7d0 Mon Sep 17 00:00:00 2001 From: Chiara Zampolli Date: Tue, 11 Jun 2024 16:43:30 +0200 Subject: [PATCH] Possibility to specify the track sources --- Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h | 5 ++- Detectors/GLOQC/src/MatchITSTPCQC.cxx | 6 +-- .../GlobalTrackingWorkflow/qc/CMakeLists.txt | 2 +- .../ITSTPCMatchingQCSpec.h | 5 ++- .../qc/src/ITSTPCMatchingQCSpec.cxx | 37 ++++++++++++++----- .../qc/src/itstpc-matching-qc-workflow.cxx | 7 ++-- 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h b/Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h index bfc9977c2af5c..ca4d2678722c6 100644 --- a/Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h +++ b/Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h @@ -232,7 +232,7 @@ class MatchITSTPCQC } } - void setSources(GID::mask_t src) { mSrc = src; } + void setTrkSources(GID::mask_t src) { mSrc = src; } void setUseTrkPID(bool b) { mUseTrkPID = b; } bool getUseTrkPID() const { return mUseTrkPID; } void setUseMC(bool b) { mUseMC = b; } @@ -273,8 +273,9 @@ class MatchITSTPCQC private: std::shared_ptr mDataRequest; o2::globaltracking::RecoContainer mRecoCont; + std::string mRequestedSources = "ITS,TPC,ITS-TPC"; GID::mask_t mSrc = GID::getSourcesMask("ITS,TPC,ITS-TPC"); - GID::mask_t mAllowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF"); + GID::mask_t mAllowedSources = GID::getSourcesMask("all"); // TPC gsl::span mTPCTracks; // ITS diff --git a/Detectors/GLOQC/src/MatchITSTPCQC.cxx b/Detectors/GLOQC/src/MatchITSTPCQC.cxx index 3d7d63c23c59f..f810a5d2d4ef2 100644 --- a/Detectors/GLOQC/src/MatchITSTPCQC.cxx +++ b/Detectors/GLOQC/src/MatchITSTPCQC.cxx @@ -390,9 +390,6 @@ void MatchITSTPCQC::initDataRequest() // initialize data request, if it was not already done - if (mDoK0QC) { - mSrc = GID::getSourcesMask("ITS,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF"); - } mSrc &= mAllowedSources; if (mSrc[GID::Source::ITSTPC] == 0 || mSrc[GID::Source::TPC] == 0 || mSrc[GID::Source::ITS] == 0) { @@ -958,6 +955,9 @@ bool MatchITSTPCQC::processV0(int iv, o2::globaltracking::RecoContainer& recoDat //__________________________________________________________ bool MatchITSTPCQC::refitV0(const o2::dataformats::V0Index& id, o2::dataformats::V0& v0, o2::globaltracking::RecoContainer& recoData) { + if (!recoData.isTrackSourceLoaded(id.getProngID(0).getSource()) || !recoData.isTrackSourceLoaded(id.getProngID(1).getSource())) { + return false; + } auto seedP = recoData.getTrackParam(id.getProngID(0)); auto seedN = recoData.getTrackParam(id.getProngID(1)); bool isTPConly = (id.getProngID(0).getSource() == o2::dataformats::GlobalTrackID::TPC) || (id.getProngID(1).getSource() == o2::dataformats::GlobalTrackID::TPC); diff --git a/Detectors/GlobalTrackingWorkflow/qc/CMakeLists.txt b/Detectors/GlobalTrackingWorkflow/qc/CMakeLists.txt index 45a66f8ce5b82..cca69282d20cf 100644 --- a/Detectors/GlobalTrackingWorkflow/qc/CMakeLists.txt +++ b/Detectors/GlobalTrackingWorkflow/qc/CMakeLists.txt @@ -17,7 +17,7 @@ o2_add_library(GlobalTrackingWorkflowQC O2::GLOQC ) -o2_add_executable(match-qc +o2_add_executable(matching-qc COMPONENT_NAME itstpc SOURCES src/itstpc-matching-qc-workflow.cxx PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflowQC diff --git a/Detectors/GlobalTrackingWorkflow/qc/include/GlobalTrackingWorkflowQC/ITSTPCMatchingQCSpec.h b/Detectors/GlobalTrackingWorkflow/qc/include/GlobalTrackingWorkflowQC/ITSTPCMatchingQCSpec.h index 1d76add46839a..6ffd38c8a1c1b 100644 --- a/Detectors/GlobalTrackingWorkflow/qc/include/GlobalTrackingWorkflowQC/ITSTPCMatchingQCSpec.h +++ b/Detectors/GlobalTrackingWorkflow/qc/include/GlobalTrackingWorkflowQC/ITSTPCMatchingQCSpec.h @@ -29,7 +29,7 @@ namespace globaltracking class ITSTPCMatchingQCDevice : public Task { public: - ITSTPCMatchingQCDevice(std::shared_ptr dr, std::shared_ptr req, bool useMC, bool doK0QC) : mDataRequest(dr), mCCDBRequest(req), mUseMC(useMC), mDoK0QC(doK0QC){}; + ITSTPCMatchingQCDevice(std::shared_ptr dr, std::shared_ptr req, bool useMC, bool doK0QC, std::string trkSources) : mDataRequest(dr), mCCDBRequest(req), mUseMC(useMC), mDoK0QC(doK0QC), mTrkSources(trkSources){}; void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; @@ -42,13 +42,14 @@ class ITSTPCMatchingQCDevice : public Task std::shared_ptr mCCDBRequest; bool mUseMC = true; bool mDoK0QC = true; + std::string mTrkSources = "ITS,TPC,ITS-TPC"; }; } // namespace globaltracking namespace framework { -DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC); +DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC, std::string trkSources); } // namespace framework } // namespace o2 diff --git a/Detectors/GlobalTrackingWorkflow/qc/src/ITSTPCMatchingQCSpec.cxx b/Detectors/GlobalTrackingWorkflow/qc/src/ITSTPCMatchingQCSpec.cxx index 9452c945435d9..f1de9698d9e70 100644 --- a/Detectors/GlobalTrackingWorkflow/qc/src/ITSTPCMatchingQCSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/qc/src/ITSTPCMatchingQCSpec.cxx @@ -18,7 +18,8 @@ #include "GLOQC/ITSTPCMatchingQCParams.h" #include "DataFormatsGlobalTracking/RecoContainer.h" #include "DetectorsBase/Propagator.h" - +#include "DetectorsVertexing/SVertexerParams.h" +#include "Framework/CCDBParamSpec.h" #include "CommonUtils/NameConf.h" #include @@ -34,8 +35,8 @@ void ITSTPCMatchingQCDevice::init(InitContext& /*ic*/) const o2::gloqc::ITSTPCMatchingQCParams& params = o2::gloqc::ITSTPCMatchingQCParams::Instance(); mMatchITSTPCQC = std::make_unique(); - mMatchITSTPCQC->init(); mMatchITSTPCQC->setDataRequest(mDataRequest); + mMatchITSTPCQC->setTrkSources(o2::dataformats::GlobalTrackID::getSourcesMask(mTrkSources)); mMatchITSTPCQC->setPtCut(params.minPtCut); mMatchITSTPCQC->setEtaCut(params.etaCut); mMatchITSTPCQC->setMinNTPCClustersCut(params.minNTPCClustersCut); @@ -50,6 +51,7 @@ void ITSTPCMatchingQCDevice::init(InitContext& /*ic*/) if (mDoK0QC) { mMatchITSTPCQC->setDoK0QC(mDoK0QC); } + mMatchITSTPCQC->init(); } //_____________________________________________________________ @@ -57,6 +59,11 @@ void ITSTPCMatchingQCDevice::init(InitContext& /*ic*/) void ITSTPCMatchingQCDevice::run(o2::framework::ProcessingContext& pc) { o2::base::GRPGeomHelper::instance().checkUpdates(pc); + static bool wasSVParamInitialized = false; + if (!wasSVParamInitialized) { + pc.inputs().get("SVParam"); + wasSVParamInitialized = true; + } mMatchITSTPCQC->run(pc); } @@ -92,6 +99,10 @@ void ITSTPCMatchingQCDevice::finaliseCCDB(ConcreteDataMatcher& matcher, void* ob if (o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) { return; } + if (matcher == ConcreteDataMatcher("GLO", "SVPARAM", 0)) { + LOG(info) << "SVertexer Params updated from ccdb - but it should not happen... PLEASE CHECK"; + return; + } } } // namespace globaltracking @@ -99,14 +110,18 @@ namespace framework { using GID = o2::dataformats::GlobalTrackID; -DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC) +DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC, std::string trkSources) { std::vector outputs; outputs.emplace_back("GLO", "ITSTPCMATCHQC", 0, Lifetime::Sporadic); auto dataRequest = std::make_shared(); - GID::mask_t mSrc = GID::getSourcesMask("TPC,ITS-TPC"); - dataRequest->requestTracks(mSrc, useMC); + GID::mask_t srcMask = GID::getSourcesMask(trkSources); + dataRequest->requestTracks(srcMask, useMC); + if (doK0QC) { + dataRequest->requestPrimaryVertices(useMC); + dataRequest->requestSecondaryVertices(useMC); + } auto ccdbRequest = std::make_shared(false, // orbitResetTime false, // GRPECS=true false, // GRPLHCIF @@ -114,12 +129,14 @@ DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC) false, // askMatLUT o2::base::GRPGeomRequest::None, // geometry dataRequest->inputs); + + dataRequest->inputs.emplace_back("SVParam", "GLO", "SVPARAM", 0, Lifetime::Condition, ccdbParamSpec("GLO/Config/SVertexerParam")); return DataProcessorSpec{ - "itstpc-matching-qc", - dataRequest->inputs, - outputs, - AlgorithmSpec{adaptFromTask(dataRequest, ccdbRequest, useMC, doK0QC)}, - Options{{}}}; + .name = "itstpc-matching-qc", + .inputs = dataRequest->inputs, + .outputs = outputs, + .algorithm = AlgorithmSpec{adaptFromTask(dataRequest, ccdbRequest, useMC, doK0QC, trkSources)}, + }; } } // namespace framework diff --git a/Detectors/GlobalTrackingWorkflow/qc/src/itstpc-matching-qc-workflow.cxx b/Detectors/GlobalTrackingWorkflow/qc/src/itstpc-matching-qc-workflow.cxx index 8ed9774a38b1a..e3107bedbf1d4 100644 --- a/Detectors/GlobalTrackingWorkflow/qc/src/itstpc-matching-qc-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/qc/src/itstpc-matching-qc-workflow.cxx @@ -22,6 +22,7 @@ void customize(std::vector& workflowOptions) std::vector options{ {"disable-mc", o2::framework::VariantType::Bool, false, {"disable use of MC information even if available"}}, {"disable-k0-qc", o2::framework::VariantType::Bool, false, {"disable K0 QC"}}, + {"track-sources", o2::framework::VariantType::String, "ITS,TPC,ITS-TPC", {"comma-separated list of track sources to use"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; std::swap(workflowOptions, options); } @@ -34,14 +35,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) { // Update the (declared) parameters if changed from the command line o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); - // write the configuration used for the workflow - o2::conf::ConfigurableParam::writeINI("o2-itstpc-matching-qc.ini"); LOG(info) << "ITSTPC matching QC: disable-mc = " << configcontext.options().get("disable-mc"); auto useMC = !configcontext.options().get("disable-mc"); LOG(info) << "ITSTPC matching QC: disable-k0-qc = " << configcontext.options().get("disable-k0-qc"); auto doK0QC = !configcontext.options().get("disable-k0-qc"); + LOG(info) << "ITSTPC matching QC: track-sources = " << configcontext.options().get("track-sources"); + std::string trkSources = configcontext.options().get("track-sources"); WorkflowSpec specs; - specs.emplace_back(getITSTPCMatchingQCDevice(useMC, doK0QC)); + specs.emplace_back(getITSTPCMatchingQCDevice(useMC, doK0QC, trkSources)); return specs; }