Skip to content

Commit

Permalink
simplification and assuring of default names
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucia Anna Tarasovicova committed Oct 21, 2024
1 parent 6cc20b7 commit b9e41e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 66 deletions.
19 changes: 10 additions & 9 deletions Modules/CTP/include/CTP/CTPTrendingTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, TObject*> mPlots;

Expand Down
70 changes: 13 additions & 57 deletions Modules/CTP/src/CTPTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,54 +78,15 @@ void CTPTrendingTask::initCTP(Trigger& t)
mCTPconfigFound = true;
}

mClassNames[0] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBias1Class", "CMTVX-B-NOPF");
if (mClassNames[0] == "") {
mClassNames[0] = mClassNamesDefault[0];
}

mClassNames[1] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBias2Class", "CMVBA-B-NOPF");
if (mClassNames[1] == "") {
mClassNames[1] = mClassNamesDefault[1];
}

mClassNames[2] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBisDMCclass", "CTVXDMC-B-NOPF-EMC");
if (mClassNames[2] == "") {
mClassNames[2] = mClassNamesDefault[2];
}

mClassNames[3] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBiasEMCclass", "CTVXEMC-B-NOPF-EMC");
if (mClassNames[3] == "") {
mClassNames[3] = mClassNamesDefault[3];
}

mClassNames[4] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBiasPHOclass", "CTVXPH0-B-NOPF-PHSCPV");
if (mClassNames[4] == "") {
mClassNames[4] = mClassNamesDefault[4];
}

mInputNames[0] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBias1Input", "MTVX");
if (mInputNames[0] == "") {
mInputNames[0] = mInputNamesDefault[0];
}

mInputNames[1] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBias2Input", "MVBA");
if (mInputNames[1] == "") {
mInputNames[1] = mInputNamesDefault[1];
}

mInputNames[2] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBisDMCInput", "0DMC");
if (mInputNames[2] == "") {
mInputNames[2] = mInputNamesDefault[2];
}

mInputNames[3] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBiasEMCInput", "0EMC");
if (mInputNames[3] == "") {
mInputNames[3] = mInputNamesDefault[3];
}

mInputNames[4] = getFromExtendedConfig<string>(t.activity, mCustomParameters, "minBiasPHOInput", "0PH0");
if (mInputNames[4] == "") {
mInputNames[4] = mInputNamesDefault[4];
for (int i = 0; i < 5; i++) {
mClassNames[i] = getFromExtendedConfig<string>(t.activity, mCustomParameters, mClassParameters[i], mClassNamesDefault[i]);
if (mClassNames[i] == "") {
mClassNames[i] = mClassNamesDefault[i];
}
mInputNames[i] = getFromExtendedConfig<string>(t.activity, mCustomParameters, mInputParameters[i], mInputNamesDefault[i]);
if (mInputNames[i] == "") {
mInputNames[i] = mInputNamesDefault[i];
}
}

// get the indices of the classes we want to trend
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit b9e41e2

Please sign in to comment.