Skip to content

Commit d1153e6

Browse files
committed
[PWGDQ] fixed configurable matching methods parameters
The commit fixes a bug that made the confgurable parameters related to the matching methods not accessible in the task configuration.
1 parent 1e6c13d commit d1153e6

File tree

1 file changed

+124
-63
lines changed

1 file changed

+124
-63
lines changed

PWGDQ/Tasks/qaMatching.cxx

Lines changed: 124 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -162,58 +162,119 @@ struct qaMatching {
162162
std::map<std::string, MatchingFunc_t> mMatchingFunctionMap; ///< MFT-MCH Matching function
163163

164164
// Chi2 matching interface
165-
static constexpr int sChi2FunctionsNum = 3;
165+
static constexpr int sChi2FunctionsNum = 5;
166166
struct : ConfigurableGroup {
167-
std::array<Configurable<std::string>, sChi2FunctionsNum> fFunctionLabel{{
168-
{"cfgChi2FunctionLabel_0", std::string{"ProdAll"}, "Text label identifying this chi2 matching method"},
169-
{"cfgChi2FunctionLabel_1", std::string{"MatchXYPhiTanlMom"}, "Text label identifying this chi2 matching method"},
170-
{"cfgChi2FunctionLabel_2", std::string{"MatchXYPhiTanl"}, "Text label identifying this chi2 matching method"},
171-
}};
172-
std::array<Configurable<std::string>, sChi2FunctionsNum> fFunctionName{{{"cfgChi2FunctionNames_0", std::string{"prod"}, "Name of the chi2 matching function"},
173-
{"cfgChi2FunctionNames_1", std::string{"matchALL"}, "Name of the chi2 matching function"},
174-
{"cfgChi2FunctionNames_2", std::string{"matchXYPhiTanl"}, "Name of the chi2 matching function"}}};
175-
std::array<Configurable<float>, sChi2FunctionsNum> fMatchingScoreCut{{
176-
{"cfgChi2FunctionMatchingScoreCut_0", 0.f, "Minimum score value for selecting good matches"},
177-
{"cfgChi2FunctionMatchingScoreCut_1", 0.5f, "Minimum score value for selecting good matches"},
178-
{"cfgChi2FunctionMatchingScoreCut_2", 0.5f, "Minimum score value for selecting good matches"},
179-
}};
180-
std::array<Configurable<float>, sChi2FunctionsNum> fMatchingPlaneZ{{
181-
{"cfgChi2FunctionMatchingPlaneZ_0", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"},
182-
{"cfgChi2FunctionMatchingPlaneZ_1", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"},
183-
{"cfgChi2FunctionMatchingPlaneZ_2", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"},
184-
}};
185-
std::array<Configurable<int>, sChi2FunctionsNum> fMatchingExtrapMethod{{
186-
{"cfgMatchingExtrapMethod_0", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"},
187-
{"cfgMatchingExtrapMethod_1", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"},
188-
{"cfgMatchingExtrapMethod_2", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"},
189-
}};
167+
Configurable<std::string> fFunctionLabel_1{"cfgChi2FunctionLabel_1", std::string{"ProdAll"}, "Text label identifying this chi2 matching method"};
168+
Configurable<std::string> fFunctionLabel_2{"cfgChi2FunctionLabel_2", std::string{"MatchXYPhiTanlMom"}, "Text label identifying this chi2 matching method"};
169+
Configurable<std::string> fFunctionLabel_3{"cfgChi2FunctionLabel_3", std::string{"MatchXYPhiTanl"}, "Text label identifying this chi2 matching method"};
170+
Configurable<std::string> fFunctionLabel_4{"cfgChi2FunctionLabel_4", std::string{""}, "Text label identifying this chi2 matching method"};
171+
Configurable<std::string> fFunctionLabel_5{"cfgChi2FunctionLabel_5", std::string{""}, "Text label identifying this chi2 matching method"};
172+
std::array<Configurable<std::string>*, sChi2FunctionsNum> fFunctionLabel{
173+
&fFunctionLabel_1, &fFunctionLabel_2, &fFunctionLabel_3, &fFunctionLabel_4, &fFunctionLabel_5
174+
};
175+
176+
Configurable<std::string> fFunctionNames_1{"cfgChi2FunctionNames_1", std::string{"prod"}, "Name of the chi2 matching function"};
177+
Configurable<std::string> fFunctionNames_2{"cfgChi2FunctionNames_2", std::string{"matchALL"}, "Name of the chi2 matching function"};
178+
Configurable<std::string> fFunctionNames_3{"cfgChi2FunctionNames_3", std::string{"matchXYPhiTanl"}, "Name of the chi2 matching function"};
179+
Configurable<std::string> fFunctionNames_4{"cfgChi2FunctionNames_4", std::string{""}, "Name of the chi2 matching function"};
180+
Configurable<std::string> fFunctionNames_5{"cfgChi2FunctionNames_5", std::string{""}, "Name of the chi2 matching function"};
181+
std::array<Configurable<std::string>*, sChi2FunctionsNum> fFunctionName{
182+
&fFunctionNames_1, &fFunctionNames_2, &fFunctionNames_3, &fFunctionNames_4, &fFunctionNames_5
183+
};
184+
185+
Configurable<float> fMatchingScoreCut_1{"cfgChi2FunctionMatchingScoreCut_1", 0.f, "Minimum score value for selecting good matches"};
186+
Configurable<float> fMatchingScoreCut_2{"cfgChi2FunctionMatchingScoreCut_2", 0.5f, "Minimum score value for selecting good matches"};
187+
Configurable<float> fMatchingScoreCut_3{"cfgChi2FunctionMatchingScoreCut_3", 0.5f, "Minimum score value for selecting good matches"};
188+
Configurable<float> fMatchingScoreCut_4{"cfgChi2FunctionMatchingScoreCut_4", 0.5f, "Minimum score value for selecting good matches"};
189+
Configurable<float> fMatchingScoreCut_5{"cfgChi2FunctionMatchingScoreCut_5", 0.5f, "Minimum score value for selecting good matches"};
190+
std::array<Configurable<float>*, sChi2FunctionsNum> fMatchingScoreCut{
191+
&fMatchingScoreCut_1, &fMatchingScoreCut_2, &fMatchingScoreCut_3, &fMatchingScoreCut_4, &fMatchingScoreCut_5
192+
};
193+
194+
Configurable<float> fMatchingPlaneZ_1{"cfgChi2FunctionMatchingPlaneZ_1", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
195+
Configurable<float> fMatchingPlaneZ_2{"cfgChi2FunctionMatchingPlaneZ_2", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
196+
Configurable<float> fMatchingPlaneZ_3{"cfgChi2FunctionMatchingPlaneZ_3", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
197+
Configurable<float> fMatchingPlaneZ_4{"cfgChi2FunctionMatchingPlaneZ_4", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
198+
Configurable<float> fMatchingPlaneZ_5{"cfgChi2FunctionMatchingPlaneZ_5", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
199+
std::array<Configurable<float>*, sChi2FunctionsNum> fMatchingPlaneZ{
200+
&fMatchingPlaneZ_1, &fMatchingPlaneZ_2, &fMatchingPlaneZ_3, &fMatchingPlaneZ_4, &fMatchingPlaneZ_5
201+
};
202+
203+
Configurable<int> fMatchingExtrapMethod_1{"cfgChi2MatchingExtrapMethod_1", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
204+
Configurable<int> fMatchingExtrapMethod_2{"cfgChi2MatchingExtrapMethod_2", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
205+
Configurable<int> fMatchingExtrapMethod_3{"cfgChi2MatchingExtrapMethod_3", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
206+
Configurable<int> fMatchingExtrapMethod_4{"cfgChi2MatchingExtrapMethod_4", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
207+
Configurable<int> fMatchingExtrapMethod_5{"cfgChi2MatchingExtrapMethod_5", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
208+
std::array<Configurable<int>*, sChi2FunctionsNum> fMatchingExtrapMethod{
209+
&fMatchingExtrapMethod_1, &fMatchingExtrapMethod_2, &fMatchingExtrapMethod_3, &fMatchingExtrapMethod_4, &fMatchingExtrapMethod_5
210+
};
190211
} fConfigChi2MatchingOptions;
191212

192213
// ML interface
193-
static constexpr int sMLModelsNum = 2;
214+
static constexpr int sMLModelsNum = 5;
194215
struct : ConfigurableGroup {
195-
std::array<Configurable<std::string>, sMLModelsNum> fModelLabel{{
196-
{"cfgMLModelLabel_0", std::string{""}, "Text label identifying this group of ML models"},
197-
{"cfgMLModelLabel_1", std::string{""}, "Text label identifying this group of ML models"},
198-
}};
199-
std::array<Configurable<std::vector<std::string>>, sMLModelsNum> fModelPathsCCDB{{{"cfgMLModelPathsCCDB_0", std::vector<std::string>{"Users/m/mcoquet/MLTest"}, "Paths of models on CCDB"},
200-
{"cfgMLModelPathsCCDB_1", std::vector<std::string>{}, "Paths of models on CCDB"}}};
201-
std::array<Configurable<std::vector<std::string>>, sMLModelsNum> fInputFeatures{{{"cfgMLInputFeatures_0", std::vector<std::string>{"chi2MCHMFT"}, "Names of ML model input features"},
202-
{"cfgMLInputFeatures_1", std::vector<std::string>{}, "Names of ML model input features"}}};
203-
std::array<Configurable<std::vector<std::string>>, sMLModelsNum> fModelNames{{{"cfgMLModelNames_0", std::vector<std::string>{"model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"},
204-
{"cfgMLModelNames_1", std::vector<std::string>{}, "ONNX file names for each pT bin (if not from CCDB full path)"}}};
205-
std::array<Configurable<float>, sMLModelsNum> fMatchingScoreCut{{
206-
{"cfgMLModelMatchingScoreCut_0", 0.f, "Minimum score value for selecting good matches"},
207-
{"cfgMLModelMatchingScoreCut_1", 0.f, "Minimum score value for selecting good matches"},
208-
}};
209-
std::array<Configurable<float>, sMLModelsNum> fMatchingPlaneZ{{
210-
{"cfgMLModelMatchingPlaneZ_0", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"},
211-
{"cfgMLModelMatchingPlaneZ_1", 0.f, "Z position of the matching plane"},
212-
}};
213-
std::array<Configurable<int>, sMLModelsNum> fMatchingExtrapMethod{{
214-
{"cfgMatchingExtrapMethod_0", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"},
215-
{"cfgMatchingExtrapMethod_1", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"},
216-
}};
216+
Configurable<std::string> fModelLabel_1{"cfgMLModelLabel_1", std::string{""}, "Text label identifying this group of ML models"};
217+
Configurable<std::string> fModelLabel_2{"cfgMLModelLabel_2", std::string{""}, "Text label identifying this group of ML models"};
218+
Configurable<std::string> fModelLabel_3{"cfgMLModelLabel_3", std::string{""}, "Text label identifying this group of ML models"};
219+
Configurable<std::string> fModelLabel_4{"cfgMLModelLabel_4", std::string{""}, "Text label identifying this group of ML models"};
220+
Configurable<std::string> fModelLabel_5{"cfgMLModelLabel_5", std::string{""}, "Text label identifying this group of ML models"};
221+
std::array<Configurable<std::string>*, sMLModelsNum> fModelLabel{
222+
&fModelLabel_1, &fModelLabel_2, &fModelLabel_3, &fModelLabel_4, &fModelLabel_5
223+
};
224+
225+
Configurable<std::string> fModelPathCCDB_1{"cfgMLModelPathCCDB_1", "Users/m/mcoquet/MLTest", "Paths of models on CCDB"};
226+
Configurable<std::string> fModelPathCCDB_2{"cfgMLModelPathsCCDB_2", std::string{""}, "Paths of models on CCDB"};
227+
Configurable<std::string> fModelPathCCDB_3{"cfgMLModelPathsCCDB_3", std::string{""}, "Paths of models on CCDB"};
228+
Configurable<std::string> fModelPathCCDB_4{"cfgMLModelPathsCCDB_4", std::string{""}, "Paths of models on CCDB"};
229+
Configurable<std::string> fModelPathCCDB_5{"cfgMLModelPathsCCDB_5", std::string{""}, "Paths of models on CCDB"};
230+
std::array<Configurable<std::string>*, sMLModelsNum> fModelPathCCDB{
231+
&fModelPathCCDB_1, &fModelPathCCDB_2, &fModelPathCCDB_3, &fModelPathCCDB_4, &fModelPathCCDB_5
232+
};
233+
234+
Configurable<std::string> fModelName_1{"cfgMLModelName_1", "model.onnx", "ONNX file names for each pT bin (if not from CCDB full path)"};
235+
Configurable<std::string> fModelName_2{"cfgMLModelNames_2", std::string{""}, "ONNX file names for each pT bin (if not from CCDB full path)"};
236+
Configurable<std::string> fModelName_3{"cfgMLModelNames_3", std::string{""}, "ONNX file names for each pT bin (if not from CCDB full path)"};
237+
Configurable<std::string> fModelName_4{"cfgMLModelNames_4", std::string{""}, "ONNX file names for each pT bin (if not from CCDB full path)"};
238+
Configurable<std::string> fModelName_5{"cfgMLModelNames_5", std::string{""}, "ONNX file names for each pT bin (if not from CCDB full path)"};
239+
std::array<Configurable<std::string>*, sMLModelsNum> fModelName{
240+
&fModelName_1, &fModelName_2, &fModelName_3, &fModelName_4, &fModelName_5
241+
};
242+
243+
Configurable<std::string> fInputFeatures_1{"cfgMLInputFeatures_1", "chi2MCHMFT", "Names of ML model input features"};
244+
Configurable<std::string> fInputFeatures_2{"cfgMLInputFeatures_2", std::string{""}, "Names of ML model input features"};
245+
Configurable<std::string> fInputFeatures_3{"cfgMLInputFeatures_3", std::string{""}, "Names of ML model input features"};
246+
Configurable<std::string> fInputFeatures_4{"cfgMLInputFeatures_4", std::string{""}, "Names of ML model input features"};
247+
Configurable<std::string> fInputFeatures_5{"cfgMLInputFeatures_5", std::string{""}, "Names of ML model input features"};
248+
std::array<Configurable<std::string>*, sMLModelsNum> fInputFeatures{
249+
&fInputFeatures_1, &fInputFeatures_2, &fInputFeatures_3, &fInputFeatures_4, &fInputFeatures_5
250+
};
251+
252+
Configurable<float> fMatchingScoreCut_1{"cfgMLModelMatchingScoreCut_1", 0.f, "Minimum score value for selecting good matches"};
253+
Configurable<float> fMatchingScoreCut_2{"cfgMLModelMatchingScoreCut_2", 0.f, "Minimum score value for selecting good matches"};
254+
Configurable<float> fMatchingScoreCut_3{"cfgMLModelMatchingScoreCut_3", 0.f, "Minimum score value for selecting good matches"};
255+
Configurable<float> fMatchingScoreCut_4{"cfgMLModelMatchingScoreCut_4", 0.f, "Minimum score value for selecting good matches"};
256+
Configurable<float> fMatchingScoreCut_5{"cfgMLModelMatchingScoreCut_5", 0.f, "Minimum score value for selecting good matches"};
257+
std::array<Configurable<float>*, sMLModelsNum> fMatchingScoreCut{
258+
&fMatchingScoreCut_1, &fMatchingScoreCut_2, &fMatchingScoreCut_3, &fMatchingScoreCut_4, &fMatchingScoreCut_5
259+
};
260+
261+
Configurable<float> fMatchingPlaneZ_1{"cfgMLModelMatchingPlaneZ_1", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
262+
Configurable<float> fMatchingPlaneZ_2{"cfgMLModelMatchingPlaneZ_2", 0.f, "Z position of the matching plane"};
263+
Configurable<float> fMatchingPlaneZ_3{"cfgMLModelMatchingPlaneZ_3", 0.f, "Z position of the matching plane"};
264+
Configurable<float> fMatchingPlaneZ_4{"cfgMLModelMatchingPlaneZ_4", 0.f, "Z position of the matching plane"};
265+
Configurable<float> fMatchingPlaneZ_5{"cfgMLModelMatchingPlaneZ_5", 0.f, "Z position of the matching plane"};
266+
std::array<Configurable<float>*, sMLModelsNum> fMatchingPlaneZ{
267+
&fMatchingPlaneZ_1, &fMatchingPlaneZ_2, &fMatchingPlaneZ_3, &fMatchingPlaneZ_4, &fMatchingPlaneZ_5
268+
};
269+
270+
Configurable<int> fMatchingExtrapMethod_1{"cfgMLMatchingExtrapMethod_1", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
271+
Configurable<int> fMatchingExtrapMethod_2{"cfgMLMatchingExtrapMethod_2", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
272+
Configurable<int> fMatchingExtrapMethod_3{"cfgMLMatchingExtrapMethod_3", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
273+
Configurable<int> fMatchingExtrapMethod_4{"cfgMLMatchingExtrapMethod_4", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
274+
Configurable<int> fMatchingExtrapMethod_5{"cfgMLMatchingExtrapMethod_5", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
275+
std::array<Configurable<int>*, sMLModelsNum> fMatchingExtrapMethod{
276+
&fMatchingExtrapMethod_1, &fMatchingExtrapMethod_2, &fMatchingExtrapMethod_3, &fMatchingExtrapMethod_4, &fMatchingExtrapMethod_5
277+
};
217278
} fConfigMlOptions;
218279

219280
std::vector<double> binsPtMl;
@@ -932,11 +993,11 @@ struct qaMatching {
932993
// Matching functions
933994
InitMatchingFunctions();
934995
for (size_t funcId = 0; funcId < sChi2FunctionsNum; funcId++) {
935-
auto label = fConfigChi2MatchingOptions.fFunctionLabel[funcId].value;
936-
auto funcName = fConfigChi2MatchingOptions.fFunctionName[funcId].value;
937-
auto scoreMin = fConfigChi2MatchingOptions.fMatchingScoreCut[funcId].value;
938-
auto matchingPlaneZ = fConfigChi2MatchingOptions.fMatchingPlaneZ[funcId].value;
939-
auto extrapMethod = fConfigChi2MatchingOptions.fMatchingExtrapMethod[funcId].value;
996+
auto label = fConfigChi2MatchingOptions.fFunctionLabel[funcId]->value;
997+
auto funcName = fConfigChi2MatchingOptions.fFunctionName[funcId]->value;
998+
auto scoreMin = fConfigChi2MatchingOptions.fMatchingScoreCut[funcId]->value;
999+
auto matchingPlaneZ = fConfigChi2MatchingOptions.fMatchingPlaneZ[funcId]->value;
1000+
auto extrapMethod = fConfigChi2MatchingOptions.fMatchingExtrapMethod[funcId]->value;
9401001

9411002
if (label == "" || funcName == "")
9421003
break;
@@ -956,20 +1017,20 @@ struct qaMatching {
9561017
o2::framework::LabeledArray<double> mycutsMl(cutValues.data(), 1, 1, std::vector<std::string>{"pT bin 0"}, std::vector<std::string>{"score"});
9571018

9581019
for (size_t modelId = 0; modelId < sMLModelsNum; modelId++) {
959-
auto label = fConfigMlOptions.fModelLabel[modelId].value;
960-
auto modelPaths = fConfigMlOptions.fModelPathsCCDB[modelId].value;
961-
auto inputFeatures = fConfigMlOptions.fInputFeatures[modelId].value;
962-
auto modelNames = fConfigMlOptions.fModelNames[modelId].value;
963-
auto scoreMin = fConfigMlOptions.fMatchingScoreCut[modelId].value;
964-
auto matchingPlaneZ = fConfigMlOptions.fMatchingPlaneZ[modelId].value;
965-
auto extrapMethod = fConfigMlOptions.fMatchingExtrapMethod[modelId].value;
966-
967-
if (label == "" || modelPaths.empty() || inputFeatures.empty() || modelNames.empty())
1020+
auto label = fConfigMlOptions.fModelLabel[modelId]->value;
1021+
auto modelPath = fConfigMlOptions.fModelPathCCDB[modelId]->value;
1022+
auto inputFeatures = fConfigMlOptions.fInputFeatures[modelId]->value;
1023+
auto modelName = fConfigMlOptions.fModelName[modelId]->value;
1024+
auto scoreMin = fConfigMlOptions.fMatchingScoreCut[modelId]->value;
1025+
auto matchingPlaneZ = fConfigMlOptions.fMatchingPlaneZ[modelId]->value;
1026+
auto extrapMethod = fConfigMlOptions.fMatchingExtrapMethod[modelId]->value;
1027+
1028+
if (label == "" || modelPath == "" || inputFeatures == "" || modelName == "")
9681029
break;
9691030

9701031
matchingMlResponses[label].configure(binsPtMl, mycutsMl, cutDirMl, 1);
971-
matchingMlResponses[label].setModelPathsCCDB(modelNames, fCCDBApi, modelPaths, fConfigCCDB.fConfigNoLaterThan.value);
972-
matchingMlResponses[label].cacheInputFeaturesIndices(inputFeatures);
1032+
matchingMlResponses[label].setModelPathsCCDB(std::vector<std::string>{modelName}, fCCDBApi, std::vector<std::string>{modelPath}, fConfigCCDB.fConfigNoLaterThan.value);
1033+
matchingMlResponses[label].cacheInputFeaturesIndices(std::vector<std::string>{inputFeatures});
9731034
matchingMlResponses[label].init();
9741035

9751036
matchingScoreCuts[label] = scoreMin;

0 commit comments

Comments
 (0)