-
Notifications
You must be signed in to change notification settings - Fork 613
[PWGCF] ESE flow task for GFW #12440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
O2 linter results: ❌ 1 errors, |
| using namespace o2; | ||
| using namespace o2::framework; | ||
|
|
||
| #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP}; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a map.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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,
victor-gonzalez
left a comment
There was a problem hiding this 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
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| /// \file FlowGfwEse.cxx |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. :)
There was a problem hiding this comment.
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..
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
|
|
||
| #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP}; | ||
|
|
||
| namespace o2::analysis::gfw |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
|
|
||
| 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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should match now.
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
| 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the cast.
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
| {kCentNGlobal, "NGlobals"}, | ||
| {kCentMFT, "MFT"}}; | ||
|
|
||
| sCentralityEstimator = centEstimatorMap.count(cfgCentEstimator) ? centEstimatorMap[cfgCentEstimator] : "FT0C"; |
There was a problem hiding this comment.
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?
PWGCF/Flow/Tasks/flowGfwEse.cxx
Outdated
| 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; | ||
| }(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
victor-gonzalez
left a comment
There was a problem hiding this 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
No description provided.