Skip to content

Commit a1df895

Browse files
authored
Update PIDResponseITS.h
1 parent 5b9c96d commit a1df895

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

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;

0 commit comments

Comments
 (0)