diff --git a/Common/Core/TableHelper.h b/Common/Core/TableHelper.h index f4faf9dc8c8..afb42c5669a 100644 --- a/Common/Core/TableHelper.h +++ b/Common/Core/TableHelper.h @@ -18,12 +18,12 @@ #ifndef COMMON_CORE_TABLEHELPER_H_ #define COMMON_CORE_TABLEHELPER_H_ -#include - #include "Framework/Configurable.h" #include "Framework/InitContext.h" #include "Framework/RunningWorkflowInfo.h" +#include + /// Function to print the table required in the full workflow /// @param initContext initContext of the init function void printTablesInWorkflow(o2::framework::InitContext& initContext); @@ -76,14 +76,16 @@ bool getTaskOptionValue(o2::framework::InitContext& initContext, const std::stri } if (device.name == taskName) { // Found the mother task int optionCounter = 0; - for (auto const& option : device.options) { + for (const o2::framework::ConfigParamSpec& option : device.options) { if (verbose) { - LOG(info) << " Option " << optionCounter++ << " " << option.name << " = '" << option.defaultValue.asString() << "'"; + LOG(info) << " Option " << optionCounter++ << " " << option.name << " of type " << static_cast(option.type) << " = '" << option.defaultValue.asString() << "'"; } if (option.name == optName) { value = option.defaultValue.get(); if (verbose) { - LOG(info) << " Found option '" << optName << "' with value '" << value << "'"; + if constexpr (!std::is_same_v>) { + LOG(info) << " Found option '" << optName << "' with value '" << value << "'"; + } found = true; } else { return true; diff --git a/Common/DataModel/PIDResponseITS.h b/Common/DataModel/PIDResponseITS.h index 6a6afdc8827..1eca2bd164d 100644 --- a/Common/DataModel/PIDResponseITS.h +++ b/Common/DataModel/PIDResponseITS.h @@ -23,10 +23,12 @@ #define COMMON_DATAMODEL_PIDRESPONSEITS_H_ // O2 includes +#include "TableHelper.h" + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include "ReconstructionDataFormats/PID.h" #include "Framework/Logger.h" +#include "ReconstructionDataFormats/PID.h" namespace o2::aod { @@ -125,6 +127,40 @@ struct ITSResponse { 0.09, -999., -999.); } + /// Initialize the TOF response parameters in the init function of each task + /// \param initContext Initialization context. Gets the configuration parameters from the pidITS task + static void setParameters(o2::framework::InitContext& initContext, bool isMC = false) + { + float p0 = 0, p1 = 0, p2 = 0; + float p0_Z2 = 0, p1_Z2 = 0, p2_Z2 = 0; + float p0_res = 0, p1_res = 0, p2_res = 0; + float p0_res_Z2 = 0, p1_res_Z2 = 0, p2_res_Z2 = 0; + o2::framework::LabeledArray itsParams; + getTaskOptionValue(initContext, "its-pid", "itsParams", itsParams, true); + auto data = itsParams.getData(); + const int col = isMC ? 1 : 0; // 0 for Data, 1 for MC + if (data.rows != 2 || data.cols != 12) { + LOG(fatal) << "ITSResponse parameters not initialized, check the itsParams configuration"; + } + p0 = data(col, 0); + p1 = data(col, 1); + p2 = data(col, 2); + p0_Z2 = data(col, 3); + p1_Z2 = data(col, 4); + p2_Z2 = data(col, 5); + p0_res = data(col, 6); + p1_res = data(col, 7); + p2_res = data(col, 8); + p0_res_Z2 = data(col, 9); + p1_res_Z2 = data(col, 10); + p2_res_Z2 = data(col, 11); + + setParameters(p0, p1, p2, + p0_Z2, p1_Z2, p2_Z2, + p0_res, p1_res, p2_res, + p0_res_Z2, p1_res_Z2, p2_res_Z2); + } + private: static std::array mITSRespParams; static std::array mITSRespParamsZ2; diff --git a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx index c93d5980498..f247426df34 100644 --- a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx +++ b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx @@ -14,17 +14,18 @@ /// \brief Implementation for QA tasks of the ITS PID quantities /// -#include -#include +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" #include "Framework/StaticFor.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/PIDResponseITS.h" +#include "Framework/runDataProcessing.h" + +#include +#include using namespace o2; using namespace o2::framework; @@ -183,8 +184,9 @@ struct itsPidQa { return averageClusterSizePerCoslInv(track.itsClusterSizes(), track.eta()); } - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + o2::aod::ITSResponse::setParameters(context); const AxisSpec vtxZAxis{100, -20, 20, "Vtx_{z} (cm)"}; const AxisSpec etaAxis{etaBins, "#it{#eta}"}; const AxisSpec phiAxis{phiBins, "#it{#phi}"};