Skip to content
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

PWGCF: FemtoUniverse track-V0 task -- fix for track nSigma binning #7192

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

Eloviyo
Copy link
Contributor

@Eloviyo Eloviyo commented Aug 6, 2024

No description provided.

@jaelpark jaelpark enabled auto-merge (squash) August 7, 2024 06:30
@@ -1051,7 +1051,7 @@ struct femtoUniverseProducerTask {
}

template <typename TrackType, bool transientLabels = false>
void fillParticles(TrackType const& tracks)
void fillParticles(TrackType const& tracks, std::set<int>* recoMcIds = 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Don't use raw pointers in modern C++ and in O2Physics! They are rarely justified
  2. 0 is not a proper default value for a pointer in C++.
  3. Option 1: You should rather use std::optional with default value std::nullopt. Use reference to avoid copying, and use const to mark that the set is not changed in fillParticles(). Like:
void fillParticles(..., std::optional<std::reference_wrapper<const std::set<int>>> recoMcIds = std::nullopt)

line 1077: if(recoMcIds && recoMcIds->get().contains(...))
line 1299: you pas recoMcIds without the &.
4. Option 2, a much better one: would it be a big design change to iterate over tracks in fillParticles(), take MC particle corresponding to the track, and do the rest of fillParticles() with the properties of the obtained MC particle?
You would have no need to create the recoMcIds set, which would also consume a lot of memory and potentially slow down the task, if you overfill CPU cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for the review, comments and suggestions. I have implemented the option 1 for now as I am in a hurry to produce results for the approval. Option 2 may require me to consult with the group before making a PR, so I shall take a look at it after the approval period.

auto-merge was automatically disabled August 7, 2024 15:48

Head branch was pushed to by a user without write access

@saganatt saganatt enabled auto-merge (squash) August 7, 2024 16:45
@saganatt saganatt merged commit 9e1c91c into AliceO2Group:master Aug 8, 2024
10 of 11 checks passed
Luca610 pushed a commit to Luca610/O2Physics that referenced this pull request Aug 13, 2024
…liceO2Group#7192)

* fix for track nSigma binning

* added a check if reco particles have corresponding mcparticles

* requested modification applied

* clang fix

---------

Co-authored-by: Shirajum Monira <shirajum.monira@cernch>
joonsukbae pushed a commit to joonsukbae/O2Physics that referenced this pull request Aug 27, 2024
…liceO2Group#7192)

* fix for track nSigma binning

* added a check if reco particles have corresponding mcparticles

* requested modification applied

* clang fix

---------

Co-authored-by: Shirajum Monira <shirajum.monira@cernch>
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.

2 participants