Skip to content

Commit 266bc26

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 266bc26

File tree

1 file changed

+112
-63
lines changed

1 file changed

+112
-63
lines changed

PWGDQ/Tasks/qaMatching.cxx

Lines changed: 112 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -162,58 +162,107 @@ 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+
Configurable<std::string> fFunctionNames_1{"cfgChi2FunctionNames_1", std::string{"prod"}, "Name of the chi2 matching function"};
176+
Configurable<std::string> fFunctionNames_2{"cfgChi2FunctionNames_2", std::string{"matchALL"}, "Name of the chi2 matching function"};
177+
Configurable<std::string> fFunctionNames_3{"cfgChi2FunctionNames_3", std::string{"matchXYPhiTanl"}, "Name of the chi2 matching function"};
178+
Configurable<std::string> fFunctionNames_4{"cfgChi2FunctionNames_4", std::string{""}, "Name of the chi2 matching function"};
179+
Configurable<std::string> fFunctionNames_5{"cfgChi2FunctionNames_5", std::string{""}, "Name of the chi2 matching function"};
180+
std::array<Configurable<std::string>*, sChi2FunctionsNum> fFunctionName{
181+
&fFunctionNames_1, &fFunctionNames_2, &fFunctionNames_3, &fFunctionNames_4, &fFunctionNames_5};
182+
183+
Configurable<float> fMatchingScoreCut_1{"cfgChi2FunctionMatchingScoreCut_1", 0.f, "Minimum score value for selecting good matches"};
184+
Configurable<float> fMatchingScoreCut_2{"cfgChi2FunctionMatchingScoreCut_2", 0.5f, "Minimum score value for selecting good matches"};
185+
Configurable<float> fMatchingScoreCut_3{"cfgChi2FunctionMatchingScoreCut_3", 0.5f, "Minimum score value for selecting good matches"};
186+
Configurable<float> fMatchingScoreCut_4{"cfgChi2FunctionMatchingScoreCut_4", 0.5f, "Minimum score value for selecting good matches"};
187+
Configurable<float> fMatchingScoreCut_5{"cfgChi2FunctionMatchingScoreCut_5", 0.5f, "Minimum score value for selecting good matches"};
188+
std::array<Configurable<float>*, sChi2FunctionsNum> fMatchingScoreCut{
189+
&fMatchingScoreCut_1, &fMatchingScoreCut_2, &fMatchingScoreCut_3, &fMatchingScoreCut_4, &fMatchingScoreCut_5};
190+
191+
Configurable<float> fMatchingPlaneZ_1{"cfgChi2FunctionMatchingPlaneZ_1", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
192+
Configurable<float> fMatchingPlaneZ_2{"cfgChi2FunctionMatchingPlaneZ_2", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
193+
Configurable<float> fMatchingPlaneZ_3{"cfgChi2FunctionMatchingPlaneZ_3", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
194+
Configurable<float> fMatchingPlaneZ_4{"cfgChi2FunctionMatchingPlaneZ_4", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
195+
Configurable<float> fMatchingPlaneZ_5{"cfgChi2FunctionMatchingPlaneZ_5", static_cast<float>(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"};
196+
std::array<Configurable<float>*, sChi2FunctionsNum> fMatchingPlaneZ{
197+
&fMatchingPlaneZ_1, &fMatchingPlaneZ_2, &fMatchingPlaneZ_3, &fMatchingPlaneZ_4, &fMatchingPlaneZ_5};
198+
199+
Configurable<int> fMatchingExtrapMethod_1{"cfgChi2MatchingExtrapMethod_1", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
200+
Configurable<int> fMatchingExtrapMethod_2{"cfgChi2MatchingExtrapMethod_2", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
201+
Configurable<int> fMatchingExtrapMethod_3{"cfgChi2MatchingExtrapMethod_3", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
202+
Configurable<int> fMatchingExtrapMethod_4{"cfgChi2MatchingExtrapMethod_4", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
203+
Configurable<int> fMatchingExtrapMethod_5{"cfgChi2MatchingExtrapMethod_5", static_cast<int>(0), "Method for MCH track extrapolation to maching plane"};
204+
std::array<Configurable<int>*, sChi2FunctionsNum> fMatchingExtrapMethod{
205+
&fMatchingExtrapMethod_1, &fMatchingExtrapMethod_2, &fMatchingExtrapMethod_3, &fMatchingExtrapMethod_4, &fMatchingExtrapMethod_5};
190206
} fConfigChi2MatchingOptions;
191207

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

219268
std::vector<double> binsPtMl;
@@ -932,11 +981,11 @@ struct qaMatching {
932981
// Matching functions
933982
InitMatchingFunctions();
934983
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;
984+
auto label = fConfigChi2MatchingOptions.fFunctionLabel[funcId]->value;
985+
auto funcName = fConfigChi2MatchingOptions.fFunctionName[funcId]->value;
986+
auto scoreMin = fConfigChi2MatchingOptions.fMatchingScoreCut[funcId]->value;
987+
auto matchingPlaneZ = fConfigChi2MatchingOptions.fMatchingPlaneZ[funcId]->value;
988+
auto extrapMethod = fConfigChi2MatchingOptions.fMatchingExtrapMethod[funcId]->value;
940989

941990
if (label == "" || funcName == "")
942991
break;
@@ -956,20 +1005,20 @@ struct qaMatching {
9561005
o2::framework::LabeledArray<double> mycutsMl(cutValues.data(), 1, 1, std::vector<std::string>{"pT bin 0"}, std::vector<std::string>{"score"});
9571006

9581007
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())
1008+
auto label = fConfigMlOptions.fModelLabel[modelId]->value;
1009+
auto modelPath = fConfigMlOptions.fModelPathCCDB[modelId]->value;
1010+
auto inputFeatures = fConfigMlOptions.fInputFeatures[modelId]->value;
1011+
auto modelName = fConfigMlOptions.fModelName[modelId]->value;
1012+
auto scoreMin = fConfigMlOptions.fMatchingScoreCut[modelId]->value;
1013+
auto matchingPlaneZ = fConfigMlOptions.fMatchingPlaneZ[modelId]->value;
1014+
auto extrapMethod = fConfigMlOptions.fMatchingExtrapMethod[modelId]->value;
1015+
1016+
if (label == "" || modelPath == "" || inputFeatures == "" || modelName == "")
9681017
break;
9691018

9701019
matchingMlResponses[label].configure(binsPtMl, mycutsMl, cutDirMl, 1);
971-
matchingMlResponses[label].setModelPathsCCDB(modelNames, fCCDBApi, modelPaths, fConfigCCDB.fConfigNoLaterThan.value);
972-
matchingMlResponses[label].cacheInputFeaturesIndices(inputFeatures);
1020+
matchingMlResponses[label].setModelPathsCCDB(std::vector<std::string>{modelName}, fCCDBApi, std::vector<std::string>{modelPath}, fConfigCCDB.fConfigNoLaterThan.value);
1021+
matchingMlResponses[label].cacheInputFeaturesIndices(std::vector<std::string>{inputFeatures});
9731022
matchingMlResponses[label].init();
9741023

9751024
matchingScoreCuts[label] = scoreMin;

0 commit comments

Comments
 (0)