|
23 | 23 | #define COMMON_DATAMODEL_PIDRESPONSEITS_H_ |
24 | 24 |
|
25 | 25 | // O2 includes |
| 26 | +#include "TableHelper.h" |
| 27 | + |
26 | 28 | #include "Framework/ASoA.h" |
27 | 29 | #include "Framework/AnalysisDataModel.h" |
28 | | -#include "ReconstructionDataFormats/PID.h" |
29 | 30 | #include "Framework/Logger.h" |
| 31 | +#include "ReconstructionDataFormats/PID.h" |
30 | 32 |
|
31 | 33 | namespace o2::aod |
32 | 34 | { |
@@ -125,6 +127,40 @@ struct ITSResponse { |
125 | 127 | 0.09, -999., -999.); |
126 | 128 | } |
127 | 129 |
|
| 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 | + |
128 | 164 | private: |
129 | 165 | static std::array<float, 3> mITSRespParams; |
130 | 166 | static std::array<float, 3> mITSRespParamsZ2; |
|
0 commit comments