Skip to content

Commit 5d40191

Browse files
authored
[Common,DPG] PIDResponseITS inherit parameters from base task, manage arrays in TableHelper, align QA (#11777)
1 parent 4b0527d commit 5d40191

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
lines changed

Common/Core/TableHelper.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
#ifndef COMMON_CORE_TABLEHELPER_H_
1919
#define COMMON_CORE_TABLEHELPER_H_
2020

21-
#include <string>
22-
2321
#include "Framework/Configurable.h"
2422
#include "Framework/InitContext.h"
2523
#include "Framework/RunningWorkflowInfo.h"
2624

25+
#include <string>
26+
2727
/// Function to print the table required in the full workflow
2828
/// @param initContext initContext of the init function
2929
void printTablesInWorkflow(o2::framework::InitContext& initContext);
@@ -76,14 +76,16 @@ bool getTaskOptionValue(o2::framework::InitContext& initContext, const std::stri
7676
}
7777
if (device.name == taskName) { // Found the mother task
7878
int optionCounter = 0;
79-
for (auto const& option : device.options) {
79+
for (const o2::framework::ConfigParamSpec& option : device.options) {
8080
if (verbose) {
81-
LOG(info) << " Option " << optionCounter++ << " " << option.name << " = '" << option.defaultValue.asString() << "'";
81+
LOG(info) << " Option " << optionCounter++ << " " << option.name << " of type " << static_cast<int>(option.type) << " = '" << option.defaultValue.asString() << "'";
8282
}
8383
if (option.name == optName) {
8484
value = option.defaultValue.get<ValueType>();
8585
if (verbose) {
86-
LOG(info) << " Found option '" << optName << "' with value '" << value << "'";
86+
if constexpr (!std::is_same_v<ValueType, o2::framework::LabeledArray<float>>) {
87+
LOG(info) << " Found option '" << optName << "' with value '" << value << "'";
88+
}
8789
found = true;
8890
} else {
8991
return true;

Common/DataModel/PIDResponseITS.h

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
#define COMMON_DATAMODEL_PIDRESPONSEITS_H_
2424

2525
// O2 includes
26+
#include "TableHelper.h"
27+
2628
#include "Framework/ASoA.h"
2729
#include "Framework/AnalysisDataModel.h"
28-
#include "ReconstructionDataFormats/PID.h"
2930
#include "Framework/Logger.h"
31+
#include "ReconstructionDataFormats/PID.h"
3032

3133
namespace o2::aod
3234
{
@@ -125,6 +127,40 @@ struct ITSResponse {
125127
0.09, -999., -999.);
126128
}
127129

130+
/// Initialize the TOF response parameters in the init function of each task
131+
/// \param initContext Initialization context. Gets the configuration parameters from the pidITS task
132+
static void setParameters(o2::framework::InitContext& initContext, bool isMC = false)
133+
{
134+
float p0 = 0, p1 = 0, p2 = 0;
135+
float p0_Z2 = 0, p1_Z2 = 0, p2_Z2 = 0;
136+
float p0_res = 0, p1_res = 0, p2_res = 0;
137+
float p0_res_Z2 = 0, p1_res_Z2 = 0, p2_res_Z2 = 0;
138+
o2::framework::LabeledArray<float> itsParams;
139+
getTaskOptionValue(initContext, "its-pid", "itsParams", itsParams, true);
140+
auto data = itsParams.getData();
141+
const int col = isMC ? 1 : 0; // 0 for Data, 1 for MC
142+
if (data.rows != 2 || data.cols != 12) {
143+
LOG(fatal) << "ITSResponse parameters not initialized, check the itsParams configuration";
144+
}
145+
p0 = data(col, 0);
146+
p1 = data(col, 1);
147+
p2 = data(col, 2);
148+
p0_Z2 = data(col, 3);
149+
p1_Z2 = data(col, 4);
150+
p2_Z2 = data(col, 5);
151+
p0_res = data(col, 6);
152+
p1_res = data(col, 7);
153+
p2_res = data(col, 8);
154+
p0_res_Z2 = data(col, 9);
155+
p1_res_Z2 = data(col, 10);
156+
p2_res_Z2 = data(col, 11);
157+
158+
setParameters(p0, p1, p2,
159+
p0_Z2, p1_Z2, p2_Z2,
160+
p0_res, p1_res, p2_res,
161+
p0_res_Z2, p1_res_Z2, p2_res_Z2);
162+
}
163+
128164
private:
129165
static std::array<float, 3> mITSRespParams;
130166
static std::array<float, 3> mITSRespParamsZ2;

DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
/// \brief Implementation for QA tasks of the ITS PID quantities
1515
///
1616

17-
#include <string>
18-
#include <vector>
17+
#include "Common/DataModel/EventSelection.h"
18+
#include "Common/DataModel/PIDResponse.h"
19+
#include "Common/DataModel/PIDResponseITS.h"
20+
#include "Common/DataModel/TrackSelectionTables.h"
1921

2022
#include "Framework/AnalysisTask.h"
21-
#include "Framework/runDataProcessing.h"
2223
#include "Framework/HistogramRegistry.h"
2324
#include "Framework/StaticFor.h"
24-
#include "Common/DataModel/TrackSelectionTables.h"
25-
#include "Common/DataModel/EventSelection.h"
26-
#include "Common/DataModel/PIDResponse.h"
27-
#include "Common/DataModel/PIDResponseITS.h"
25+
#include "Framework/runDataProcessing.h"
26+
27+
#include <string>
28+
#include <vector>
2829

2930
using namespace o2;
3031
using namespace o2::framework;
@@ -183,8 +184,9 @@ struct itsPidQa {
183184
return averageClusterSizePerCoslInv(track.itsClusterSizes(), track.eta());
184185
}
185186

186-
void init(o2::framework::InitContext&)
187+
void init(o2::framework::InitContext& context)
187188
{
189+
o2::aod::ITSResponse::setParameters(context);
188190
const AxisSpec vtxZAxis{100, -20, 20, "Vtx_{z} (cm)"};
189191
const AxisSpec etaAxis{etaBins, "#it{#eta}"};
190192
const AxisSpec phiAxis{phiBins, "#it{#phi}"};

0 commit comments

Comments
 (0)