Skip to content

Conversation

@bghanley1995
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the pwgcf label Apr 16, 2025
@github-actions github-actions bot changed the title PWGCF: Identified BF Added purity histograms for genereated particles, added track time histograms [PWGCF] Identified BF Added purity histograms for genereated particles, added track time histograms Apr 16, 2025
bghanley1995 added a commit to bghanley1995/O2Physics that referenced this pull request Apr 16, 2025
[PWGCF] Please consider the following formatting changes to AliceO2Group#10890
bghanley1995 added a commit to bghanley1995/O2Physics that referenced this pull request Apr 16, 2025
[PWGCF] Please consider the following formatting changes to AliceO2Group#10890
@bghanley1995
Copy link
Contributor Author

I have fixed the code that is giving the "Magic Number" O2 Linter error, and when I run O2 Linter locally it doesn't find any issues, but here it does.

@vkucera
Copy link
Collaborator

vkucera commented Apr 17, 2025

I have fixed the code that is giving the "Magic Number" O2 Linter error, and when I run O2 Linter locally it doesn't find any issues, but here it does.

Because your branch is outdated.

bghanley1995 added a commit to bghanley1995/O2Physics that referenced this pull request Apr 17, 2025
[PWGCF] Please consider the following formatting changes to AliceO2Group#10890

std::vector<int> recoIdMethods = {0, 1, 2}; // Reconstructed PID Methods, 0 is no PID, 1 is calculated PID, 2 is MC PID
std::vector<int> trackTypes = {0, 1, 2, 3};
int two = 2;
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 does not help to understand what is the meaning of the value.

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 am doing a check using remainder in integer division of the particle ID value by 2. Even ID values are positive charged particles and odd ID values are negative charged particles. The error was specifically that I was doing the division by the integer 2 instead of a variable. I am unsure what I should name this variable to make it more descriptive as it is just the number 2 used for this check. Is there a standard naming convention for this situation?

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 the point @vkucera wanted to make is, there is the same magic in using 0 than in using trackType[0]
Both have the same opacity when reading the code and are prone to errors, difficult to maintain and hard to evolve

What about, for example,

constexpr int kEvenOddBase = 2;
constexpr int kPositiveTrackId = 0;
constexpr int kNegativeTrackId = 1;

and then

          if (pid % kEvenOddBase == kPositiveTrackId) {
          .......
          }

Have in mind that if the constexpr variables are defined in the scope of a struct they have to be declared as static

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.

Have a look at my comment for the future iterations

@victor-gonzalez victor-gonzalez merged commit bed2daa into AliceO2Group:master Apr 17, 2025
13 checks passed
prottayCMT pushed a commit to prottayCMT/O2Physics2024 that referenced this pull request May 17, 2025
…s, added track time histograms (AliceO2Group#10890)

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
ariedel-cern pushed a commit to ariedel-cern/O2Physics that referenced this pull request May 23, 2025
…s, added track time histograms (AliceO2Group#10890)

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
smaff92 pushed a commit to smaff92/O2Physics that referenced this pull request Jun 17, 2025
…s, added track time histograms (AliceO2Group#10890)

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
alibuild added a commit to alibuild/O2Physics that referenced this pull request Aug 11, 2025
…s, added track time histograms (AliceO2Group#10890)

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
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.

4 participants