Skip to content

Conversation

@joachimckh
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the pwgcf label Aug 5, 2025
@github-actions
Copy link

github-actions bot commented Aug 5, 2025

O2 linter results: ❌ 1 errors, ⚠️ 0 warnings, 🔕 3 disabled

using namespace o2;
using namespace o2::framework;

#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
Copy link
Collaborator

Choose a reason for hiding this comment

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

@victor-gonzalez Why is this macro defined in 30 files?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it started with the first task in O2Physics (O2 at that time) Tasks/correlations.cxx and people started replicating it
I personally don't use it and didn't like it but I find it not harmful

Comment on lines 320 to 344
switch (cfgCentEstimator) {
case kCentFT0C:
sCentralityEstimator = "FT0C";
break;
case kCentFT0CVariant1:
sCentralityEstimator = "FT0C variant 1";
break;
case kCentFT0M:
sCentralityEstimator = "FT0M";
break;
case kCentFV0A:
sCentralityEstimator = "FV0A";
break;
case kCentNTPV:
sCentralityEstimator = "NTPV";
break;
case kCentNGlobal:
sCentralityEstimator = "NGlobals";
break;
case kCentMFT:
sCentralityEstimator = "MFT";
break;
default:
sCentralityEstimator = "FT0C";
break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use a map.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a very good suggestion for simplifying code in case you want to consider it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to use std::map instead,

Copy link
Collaborator

@victor-gonzalez victor-gonzalez left a comment

Choose a reason for hiding this comment

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

Please, have a look at my comments

// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file FlowGfwEse.cxx
Copy link
Collaborator

@victor-gonzalez victor-gonzalez Aug 6, 2025

Choose a reason for hiding this comment

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

If it matches to the actual file name the linter error will be gone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I could not figure out why it gave me the error here.. Completely missed the capital F. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The remaining linter errors should belong to different tasks now..


#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

namespace o2::analysis::gfw
Copy link
Collaborator

Choose a reason for hiding this comment

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

The task variables are not from the GFW namespace as such, use gfwflowese or something similar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Namespace should be changed now.


O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples")
O2_DEFINE_CONFIGURABLE(cfgMpar, int, 4, "Highest order of pt-pt correlations")
O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The documentation string is not correct.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess Vit is referring to not all the potential options considered in the documentation string

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed. One can just avoid listing all the options by referring to the CentEstimators enumerator instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should match now.

TF1* fPtDepDCAxy = nullptr;

o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ;
o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not use C-style casting, ever. Use static_cast instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@vkucera is right!
But shouldn't this have been a MegaLinter error?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should have. But for some reason cpplint does not see these issues inside filter declarations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the cast.

{kCentNGlobal, "NGlobals"},
{kCentMFT, "MFT"}};

sCentralityEstimator = centEstimatorMap.count(cfgCentEstimator) ? centEstimatorMap[cfgCentEstimator] : "FT0C";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't you want to throw fatal for invalid values?

Comment on lines 518 to 541
posRegionIndex = [&]() {
auto begin = cfgRegions->GetNames().begin();
auto end = cfgRegions->GetNames().end();
auto it = std::find(begin, end, "refP");
return (it != end) ? std::distance(begin, it) : -1;
}();
negRegionIndex = [&]() {
auto begin = cfgRegions->GetNames().begin();
auto end = cfgRegions->GetNames().end();
auto it = std::find(begin, end, "refN");
return (it != end) ? std::distance(begin, it) : -1;
}();
fullRegionIndex = [&]() {
auto begin = cfgRegions->GetNames().begin();
auto end = cfgRegions->GetNames().end();
auto it = std::find(begin, end, "refFull");
return (it != end) ? std::distance(begin, it) : -1;
}();
midRegionIndex = [&]() {
auto begin = cfgRegions->GetNames().begin();
auto end = cfgRegions->GetNames().end();
auto it = std::find(begin, end, "refMid");
return (it != end) ? std::distance(begin, it) : -1;
}();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would not be better to have a single one and pass as a parameter the string to find?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I have changed this expression now.

{kCentMFT, "MFT"}};

sCentralityEstimator = centEstimatorMap.count(cfgCentEstimator) ? centEstimatorMap[cfgCentEstimator] : "FT0C";
sCentralityEstimator = centEstimatorMap.at(cfgCentEstimator);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest a controlled fatal in which if the configured estimator is not supported an appropriate message is given to the user together with the fatal crash. In that way finding the reason for the crash does not relay in the back-trace which sometimes is not too trustable

Copy link
Collaborator

@victor-gonzalez victor-gonzalez left a comment

Choose a reason for hiding this comment

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

Thanks for addressing our comments!
Have a look at the latest one regarding the checking of a potential not found centrality estimator in case you want to consider it for future iterations

@victor-gonzalez victor-gonzalez enabled auto-merge (squash) August 11, 2025 09:33
@victor-gonzalez victor-gonzalez merged commit 2862a49 into AliceO2Group:master Aug 11, 2025
16 of 18 checks passed
jpxrk pushed a commit to jpxrk/O2Physics that referenced this pull request Aug 12, 2025
ThePhDane pushed a commit to ThePhDane/O2Physics that referenced this pull request Nov 3, 2025
jloemker pushed a commit to jloemker/O2Physics that referenced this pull request Nov 11, 2025
alibuild pushed a commit to alibuild/O2Physics that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants