From b9e41e249683d895cbba95d477122bd0322b14ab Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Mon, 21 Oct 2024 09:14:22 +0200 Subject: [PATCH] simplification and assuring of default names --- Modules/CTP/include/CTP/CTPTrendingTask.h | 19 +++--- Modules/CTP/src/CTPTrendingTask.cxx | 70 +++++------------------ 2 files changed, 23 insertions(+), 66 deletions(-) diff --git a/Modules/CTP/include/CTP/CTPTrendingTask.h b/Modules/CTP/include/CTP/CTPTrendingTask.h index 06286fece..56420831f 100644 --- a/Modules/CTP/include/CTP/CTPTrendingTask.h +++ b/Modules/CTP/include/CTP/CTPTrendingTask.h @@ -67,15 +67,16 @@ class CTPTrendingTask : public PostProcessingInterface std::string mTrendedClassNames[5] = { "classContentMinBias1:time", "classContentMinBias2:time", "classContentDMC:time", "classContentEMC:time", "classContentPHO:time" }; std::string mTrendedInputRatioNames[4] = { "inputContentMinBias2/inputs", "inputContentDMC/inputs", "inputContentEMC/inputs", "inputContentPHO/inputs" }; std::string mTrendedClassRatioNames[4] = { "classContentMinBias2/classes", "classContentDMC/classes", "classContentEMC/classes", "classContentPHO/classes" }; - std::string ctpinputs[49] = { "MT0A", "MT0C", "MTVX", "MTSC", "MTCE", "MVBA", "MVOR", "MVIR", "MVNC", "MVCH", "11", "12", "0UCE", "0DMC", "0USC", "0UVX", "0U0C", "0U0A", "COS", "LAS", "0EMC", "0PH0", "23", "24", "1ZED", "1ZNC", "1PHL", "1PHH", "1PHM", "30", "31", "32", "33", "34", "35", "36", "0EJ1", "0EG1", "0EJ2", "0EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "EMBA", "49" }; // all ctp input names - std::string mClassNamesDefault[5] = { "CMTVX-B-NOPF", "CMVBA-B-NOPF", "CTVXDMC-B-NOPF-EMC", "CTVXEMC-B-NOPF-EMC", "CTVXPH0-B-NOPF-PHSCPV" }; // ctp classes to be trended by default, unless modified in config.json - std::string mClassNames[5] = { "", "", "", "", "" }; // the trended ctp classes will be filled in this array, either default or from config - std::string mInputNames[5] = { "", "", "", "", "" }; // the trended ctp inputs will be filled in this array, either default or from config - const int mNumberOfClasses = 5; // number of thrended ctp classes - const int mNumberOfInputs = 5; // number of thrended ctp inputs - int mClassIndex[5] = { 65, 65, 65, 65, 65 }; // indices of trended ctp classes, found in CTPconfig - int mInputIndex[5] = { 49, 49, 49, 49, 49 }; // indices of trended ctp inputs, found in CTPconfig - bool mCTPconfigFound = false; // bool telling whether the CTPconfing was already found + std::string mClassNamesDefault[5] = { "CMTVX-B-NOPF", "CMVBA-B-NOPF", "CTVXDMC-B-NOPF-EMC", "CTVXEMC-B-NOPF-EMC", "CTVXPH0-B-NOPF-PHSCPV" }; // ctp classes to be trended by default, unless modified in config.json + std::string mClassNames[5] = { "", "", "", "", "" }; // the trended ctp classes will be filled in this array, either default or from config + std::string mInputNames[5] = { "", "", "", "", "" }; // the trended ctp inputs will be filled in this array, either default or from config + std::string mInputParameters[5] = { "minBias1Input", "minBias2Input", "minBisDMCInput", "minBiasEMCInput", "minBiasPHOInput" }; + std::string mClassParameters[5] = { "minBias1Class", "minBias2Class", "minBisDMCclass", "minBiasEMCclass", "minBiasPHOclass" }; + const int mNumberOfClasses = 5; // number of thrended ctp classes + const int mNumberOfInputs = 5; // number of thrended ctp inputs + int mClassIndex[5] = { 65, 65, 65, 65, 65 }; // indices of trended ctp classes, found in CTPconfig + int mInputIndex[5] = { 49, 49, 49, 49, 49 }; // indices of trended ctp inputs, found in CTPconfig + bool mCTPconfigFound = false; // bool telling whether the CTPconfing was already found std::map mPlots; diff --git a/Modules/CTP/src/CTPTrendingTask.cxx b/Modules/CTP/src/CTPTrendingTask.cxx index 521bfd61b..3e3494781 100644 --- a/Modules/CTP/src/CTPTrendingTask.cxx +++ b/Modules/CTP/src/CTPTrendingTask.cxx @@ -78,54 +78,15 @@ void CTPTrendingTask::initCTP(Trigger& t) mCTPconfigFound = true; } - mClassNames[0] = getFromExtendedConfig(t.activity, mCustomParameters, "minBias1Class", "CMTVX-B-NOPF"); - if (mClassNames[0] == "") { - mClassNames[0] = mClassNamesDefault[0]; - } - - mClassNames[1] = getFromExtendedConfig(t.activity, mCustomParameters, "minBias2Class", "CMVBA-B-NOPF"); - if (mClassNames[1] == "") { - mClassNames[1] = mClassNamesDefault[1]; - } - - mClassNames[2] = getFromExtendedConfig(t.activity, mCustomParameters, "minBisDMCclass", "CTVXDMC-B-NOPF-EMC"); - if (mClassNames[2] == "") { - mClassNames[2] = mClassNamesDefault[2]; - } - - mClassNames[3] = getFromExtendedConfig(t.activity, mCustomParameters, "minBiasEMCclass", "CTVXEMC-B-NOPF-EMC"); - if (mClassNames[3] == "") { - mClassNames[3] = mClassNamesDefault[3]; - } - - mClassNames[4] = getFromExtendedConfig(t.activity, mCustomParameters, "minBiasPHOclass", "CTVXPH0-B-NOPF-PHSCPV"); - if (mClassNames[4] == "") { - mClassNames[4] = mClassNamesDefault[4]; - } - - mInputNames[0] = getFromExtendedConfig(t.activity, mCustomParameters, "minBias1Input", "MTVX"); - if (mInputNames[0] == "") { - mInputNames[0] = mInputNamesDefault[0]; - } - - mInputNames[1] = getFromExtendedConfig(t.activity, mCustomParameters, "minBias2Input", "MVBA"); - if (mInputNames[1] == "") { - mInputNames[1] = mInputNamesDefault[1]; - } - - mInputNames[2] = getFromExtendedConfig(t.activity, mCustomParameters, "minBisDMCInput", "0DMC"); - if (mInputNames[2] == "") { - mInputNames[2] = mInputNamesDefault[2]; - } - - mInputNames[3] = getFromExtendedConfig(t.activity, mCustomParameters, "minBiasEMCInput", "0EMC"); - if (mInputNames[3] == "") { - mInputNames[3] = mInputNamesDefault[3]; - } - - mInputNames[4] = getFromExtendedConfig(t.activity, mCustomParameters, "minBiasPHOInput", "0PH0"); - if (mInputNames[4] == "") { - mInputNames[4] = mInputNamesDefault[4]; + for (int i = 0; i < 5; i++) { + mClassNames[i] = getFromExtendedConfig(t.activity, mCustomParameters, mClassParameters[i], mClassNamesDefault[i]); + if (mClassNames[i] == "") { + mClassNames[i] = mClassNamesDefault[i]; + } + mInputNames[i] = getFromExtendedConfig(t.activity, mCustomParameters, mInputParameters[i], mInputNamesDefault[i]); + if (mInputNames[i] == "") { + mInputNames[i] = mInputNamesDefault[i]; + } } // get the indices of the classes we want to trend @@ -142,13 +103,8 @@ void CTPTrendingTask::initCTP(Trigger& t) } } - for (size_t i = 0; i < sizeof(ctpinputs) / sizeof(std::string); i++) { - for (size_t j = 0; j < mNumberOfInputs; j++) { - if (ctpinputs[i].find(mInputNames[j]) != std::string::npos) { - mInputIndex[j] = i + 1; - break; - } - } + for (int i = 0; i < 5; i++) { + mInputIndex[i] = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(mInputNames[i]); } // Preparing data structure of TTree @@ -249,7 +205,7 @@ void CTPTrendingTask::generatePlots() indexClassRatio = -1; for (int i = 0; i < 5; i++) { if (plot.varexp.find(mTrendedInputNames[i]) != std::string::npos) { - if (mInputIndex[i] == 49) { + if (mInputIndex[i] == 255) { ILOG(Info, Support) << "Input " << mInputNames[i] << " is not trended." << ENDM; indexInput = -10; } else { @@ -266,7 +222,7 @@ void CTPTrendingTask::generatePlots() } if (i < 4) { if (plot.varexp.find(mTrendedInputRatioNames[i]) != std::string::npos) { - if (mInputIndex[i + 1] == 49 || mInputIndex[0] == 49) { + if (mInputIndex[i + 1] == 255 || mInputIndex[0] == 255) { ILOG(Info, Support) << "Input ratio " << mInputNames[i + 1] << " / " << mInputNames[0] << " is not trended." << ENDM; indexInputRatio = -10; } else {