Skip to content

Conversation

@andreasmolander
Copy link
Collaborator

No description provided.

@andreasmolander andreasmolander requested a review from afurs as a code owner May 14, 2025 13:34
@andreasmolander
Copy link
Collaborator Author

@afurs, regarding vector<bool>, I agree that a bitset would be technically better. But I think that from the user/dev perspective it's nicer to use vector<bool> so that the check code becomes more unified and easier to read/understand/develop, also for more novice developers. In practice I guess this increases the used memory with ~1 byte per list parameter, so I wouldn't say it's a problem.

Copy link
Collaborator

@afurs afurs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afurs, regarding vector<bool>, I agree that a bitset would be technically better. But I think that from the user/dev perspective it's nicer to use vector<bool> so that the check code becomes more unified and easier to read/understand/develop, also for more novice developers. In practice I guess this increases the used memory with ~1 byte per list parameter, so I wouldn't say it's a problem.

@andreasmolander I fully disagree, memory increase is the less problem. As I sad before, std::vector<bool> is bad practice due to several reasons. For example (this is not an only problem which may raise), try:

std::vector<bool> vec{true,false,true};
auto &el= vec[0];

I dont know, if for other reviewers(@knopers8 @Barthelemy ) it is ok, then no problem, lets merge it. But I strongly recommend to replace it by bitsetor boost::dynamic_bitset

Copy link
Collaborator

@afurs afurs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreasmolander ok, anyway it is in dedicated task, so in case of problems it can be turned off.

Comment on lines +65 to +105
parseableParam = mCustomParameters.atOrDefaultValue("gausParamsSigma", "3.0, 7.0");
mGausParamsSigmas = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("meanWarningsLow", "");
mMeanWarningsLow = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("meanWarningsHigh", "");
mMeanWarningsHigh = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("meanErrorsLow", "");
mMeanErrorsLow = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("meanErrorsHigh", "");
mMeanErrorsHigh = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("sigmaWarnings", "");
mSigmaWarnings = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("sigmaErrors", "");
mSigmaErrors = helper::parseParameters<float>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawMeanWarningsLow", "false, false");
mDrawMeanWarningsLow = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawMeanWarningsHigh", "false, false");
mDrawMeanWarningsHigh = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawMeanErrorsLow", "true, true");
mDrawMeanErrorsLow = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawMeanErrorsHigh", "true, true");
mDrawMeanErrorsHigh = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawSigmaWarnings", "false, false");
mDrawSigmaWarnings = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("drawSigmaErrors", "false, false");
mDrawSigmaErrors = helper::parseParameters<bool>(parseableParam, ",");

parseableParam = mCustomParameters.atOrDefaultValue("labelPos", "0.15, 0.2, 0.85, 0.45");
mVecLabelPos = helper::parseParameters<double>(parseableParam, ",");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, you can patch parseParameters method and use mCustomParameters.atOrDefaultValue inside. Less code lines

Comment on lines +48 to +59
"meanWarningsLow": "12, 26",
"meanWarningsHigh": "16, 30",
"meanErrorsLow": "10, 24",
"meanErrorsHigh": "18, 32",
"sigmaWarnings": "4, -1",
"sigmaErrors": "5, -1",
"drawMeanWarningsLow": "false, false",
"drawMeanWarningsHigh": "false, false",
"drawMeanErrorsLow": "true, true",
"drawMeanErrorsHigh": "true, true",
"drawSigmaWarnings": "false, false",
"drawSigmaErrors": "fasle, false",
Copy link
Collaborator

@afurs afurs May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but maybe it is better to use and parse list of json entities, smth like:

"peaks": [
  {
     "meanWarningsLow": 12,
     "meanWarningsHigh": 16,
     ....
      "draw_options": ["drawMeanErrorsLow", "drawSigmaWarnings"]
  },
  {
      ...
   }
]

and parse it via boost property tree or RapidJSON. Then no need in vec of bools, you will just need to enumerate list of drawing options

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that might be a good idea, let me think about it for the next iteration. One benefit (maybe?) of the current approach is that one can tell what the options are, just by looking at the config, and not having to jump over to the documentation...

@jotwinow
Copy link
Contributor

I approved. The rest will come later, we need this task urgently...

@Barthelemy Barthelemy merged commit 6fa3c61 into AliceO2Group:master May 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants