diff --git a/Modules/TPC/include/TPC/Tracks.h b/Modules/TPC/include/TPC/Tracks.h index 0f76b8167..08d234c58 100644 --- a/Modules/TPC/include/TPC/Tracks.h +++ b/Modules/TPC/include/TPC/Tracks.h @@ -50,6 +50,7 @@ class Tracks final : public TaskInterface private: o2::tpc::qc::Tracks mQCTracks{}; ///< TPC QC class from o2 + bool usePVfromCCDB = false; }; } // namespace o2::quality_control_modules::tpc diff --git a/Modules/TPC/run/tpcQCTracks_sampled.json b/Modules/TPC/run/tpcQCTracks_sampled.json index 4a20c21ea..0240d34a3 100644 --- a/Modules/TPC/run/tpcQCTracks_sampled.json +++ b/Modules/TPC/run/tpcQCTracks_sampled.json @@ -29,14 +29,20 @@ "detectorName": "TPC", "cycleDurationSeconds": "10", "dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.", - "dataSource": { - "type": "dataSamplingPolicy", - "name": "tpc-tracks" - }, + "dataSources": [ + { "type": "dataSamplingPolicy", "name": "tpc-tracks" }, + { + "type": "direct", + "query": "meanvertex:CTP/MEANVERTEX/0?lifetime=condition&ccdb-path=CTP/Calib/MeanVertex" + } + ], "taskParameters": { - "cutAbsEta": "1.", "cutMinNCluster": "60", "cutMindEdxTot": "20." + "cutAbsEta": "1.", + "cutMinNCluster": "60", + "cutMindEdxTot": "20.", + "usePVfromCCDB": "true" }, - "grpGeomRequest" : { + "grpGeomRequest": { "geomRequest": "None", "askGRPECS": "false", "askGRPLHCIF": "false", @@ -44,7 +50,7 @@ "askMatLUT": "true", "askTime": "false", "askOnceAllButField": "true", - "needPropagatorD": "false" + "needPropagatorD": "false" }, "location": "remote" } @@ -56,11 +62,13 @@ "moduleName": "QcSkeleton", "policy": "OnAny", "detectorName": "TPC", - "dataSource": [{ - "type": "Task", - "name": "Tracks", - "MOs": ["example"] - }] + "dataSource": [ + { + "type": "Task", + "name": "Tracks", + "MOs": ["example"] + } + ] } } }, diff --git a/Modules/TPC/src/Tracks.cxx b/Modules/TPC/src/Tracks.cxx index 76f8f1074..0e711c515 100644 --- a/Modules/TPC/src/Tracks.cxx +++ b/Modules/TPC/src/Tracks.cxx @@ -22,6 +22,7 @@ // O2 includes #include "Framework/ProcessingContext.h" #include "DataFormatsTPC/TrackTPC.h" +#include "DataFormatsCalibration/MeanVertexObject.h" #include "TPCQC/Helpers.h" #include @@ -46,6 +47,8 @@ void Tracks::initialize(o2::framework::InitContext& /*ctx*/) const float cutMaxAbsDCAr = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "cutMaxAbsDCAr", 0.1); const bool useCutMaxAbsDCArOnHistos = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "useCutMaxAbsDCArOnHistos"); + usePVfromCCDB = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "usePVfromCCDB"); + // set track cuts defaults are (AbsEta = 1.0, nCluster = 60, MindEdxTot = 20) mQCTracks.setTrackCuts(cutAbsEta, cutMinNCluster, cutMindEdxTot, cutPtForDCAr, samplingFractionDCAr, runAsyncAndTurnOffSomeHistos, cutMaxAbsDCAr, useCutMaxAbsDCArOnHistos); @@ -70,6 +73,16 @@ void Tracks::startOfCycle() void Tracks::monitorData(o2::framework::ProcessingContext& ctx) { + // set the coordinates of the PV (extracted from CCDB) + if (usePVfromCCDB) { + auto coordinatesOfPV = ctx.inputs().get("CTP/Calib/MeanVertex"); + if (!coordinatesOfPV) { + LOGP(error, "Failed to retrieve MeanVertexObject, using default (0,0,0) instead!"); + } else { + mQCTracks.setPVposition(coordinatesOfPV->getPos()); + } + } + using TrackType = std::vector; auto tracks = ctx.inputs().get("inputTracks");