Repository navigation
Conversation
|
O2 linter results: ❌ 0 errors, |
|
Error while checking build/O2Physics/code-check for d903174 at 2026-11-18 18:05: Full log here. |
axti98
left a comment
There was a problem hiding this comment.
Hi Jinjoo, thanks for the PR!
May you add those checks + failure messages? Otherwise it is good
| // mix only events in the same class of cfgMixingNSelEdges | ||
| if (mixingCategory >= 0 && !fMixNSelEdges.empty()) { | ||
| const int nSel = static_cast<int>(VarManager::fgValues[VarManager::kNSelTracksForPairing]); | ||
| const int nSelClassIndex = static_cast<int>(std::upper_bound(fMixNSelEdges.begin(), fMixNSelEdges.end(), nSel) - fMixNSelEdges.begin()) - 1; |
There was a problem hiding this comment.
I think std::upper_bound requires a sorted list, if the user enters something that unsorted in fConfigMixingNSelEdges, this might crash without a reasonable failure message.
Could you add a check that fConfigMixingNSelEdges contains at least two edges and that they all edges are sorted in strictly increasing order? I think std::is_sorted provides a check for that
Then add a proper failure message
There was a problem hiding this comment.
Thanks for the comments! I modified and added the failure messages to indicate that at least two integer edges are in strictly increasing order in init()
| if (!fConfigMixingNSelEdges.value.empty()) { | ||
| std::unique_ptr<TObjArray> edgeArr(TString(fConfigMixingNSelEdges.value).Tokenize(",")); | ||
| for (int ie = 0; ie < edgeArr->GetEntries(); ++ie) { | ||
| fMixNSelEdges.push_back(static_cast<TObjString*>(edgeArr->At(ie))->GetString().Atoi()); |
There was a problem hiding this comment.
I think ROOTs Atoi returns a 0 if the input string is not a valid ASCII numerical value, this is hard to check on.
Maybe you could use instead std::from_chars to convert to the integer, there you could check the validity and also provide a proper error message
There was a problem hiding this comment.
Now this is done in init() when the edges are validated. So std::upper_bound here only sees valid edges
|
Error while checking build/O2Physics/code-check for c9715dd at 2026-11-19 01:28: Full log here. |
c9715dd to
bd8e7a9
Compare
|
Error while checking build/O2Physics/code-check for bd8e7a9 at 2026-11-19 00:51: Full log here. |
Add mixing in classes of the selected pairing