Repository navigation
[PWGEM] fix memory in builder run 2 - #18862
Conversation
|
O2 linter results: ❌ 0 errors, |
| } | ||
|
|
||
| // run 2: cache one table iterator per leg of this artificial event for the mixed-event photon pair analysis, to avoid repeated lookups in the legs table | ||
| template <typename TMixCollision, typename TMixLegs> |
There was a problem hiding this comment.
Could you please use c++ 20 concepts to help reduce compile time and make it more clear if these are stl containers or tables or iterators.
There was a problem hiding this comment.
I have changed it now
| const auto& ap = mLegIt[photons[i][0] - mLegItFirst]; | ||
| const auto& am = mLegIt[photons[i][1] - mLegItFirst]; | ||
| const auto& bp = mLegIt[photons[j][0] - mLegItFirst]; | ||
| const auto& bm = mLegIt[photons[j][1] - mLegItFirst]; |
There was a problem hiding this comment.
If I understand correctly mLegIt is a vector of iterators (so like a mini table).
Creation of iterators is quite expansive. It might be better to create iterators outside the double loop once and then just move the values to the corresponding iterator inside the loop.
There was a problem hiding this comment.
Yes, mLegIt is a vector of iterators. They are not created inside this loop: cacheLegsOf creates them once per artificial event (one per leg of that event) before the loops, and here I only take a const reference to the cached one. Before this PR the same cache was filled for all legs of the data frame at once, which is what took the memory. I kept a small vector instead of moving one iterator with setCursor because the pairing needs two to four legs at the same time and revisits them.
There was a problem hiding this comment.
Sorry the comment was a bit confusing, I meant the creation of ap, am, bp and bm within the double loop. I am not sure if this is the case since they are references tho. So maybe it's not a big issue.
The second builder run on the mixed-event tables kept one table iterator per leg row of the whole data frame.This PR fills the cache per artificial event instead.