Add ParticleID::isQuark method
Adds method ParticleID::isQuark
that returns true
if the absolute ID of the particle is less than 11. Also updates a test to print the value of this property, and adds a reference file for that test.
These changes represent my proposal for fixing LHCBPS-1718. (I'll create a separate MR in Analysis for Phys/DaVinciMCTools if this is approved.)
/cc @gcorti @gligorov (as cc'd in the issue) and @ibelyaev (as the author of the test)
Merge request reports
Activity
@apearce
Hi Alex,- The current method evaluates to
true
for invalid particle ID (0).. I think it is not good - at least it is not very logical. for invalid ID, it is better to returnfalse
for "isQuark"-method. - To be more consistent, I woudd also sugest to modify the method
hasQuarks
: :return isQuark() || ( .... ) ;
- I have some worries about magic appearence of 11.. Does 10 corresponds to quark? Would it be better to code
isQuark
in terms of only 6 quarks?
const unnsigned int ia = abspid() ; return up == ia || down == ia || .... || top == ia ;
- The current method evaluates to
Thanks a lot for the feedback @ibelyaev! On your points:
- Agreed.
- This is something I wondered about in LHCBPS-1718. I can't decide if it makes sense for a method called
hasQuarks
, plural, to returntrue
for a single quark. Maybe it does, and if so, then we don't need the additional method, as the modifiedhasQuarks
would be sufficient on its own. - The PDG MC numbering scheme document has this to say:
Quarks and leptons are numbered consecutively starting from 1 and 11 respectively
To me, that says any ID in the range 1–10, inclusive, is considered a quark ID. Currently, the listings use IDs 7 and 8 for 'b prime' and 't prime' quarks. But still, maybe we want to be more specific than the PDG.
@apearce if 10 is allowed ID for quark, we could have some problem: there are many places in the code that relies on the fact that the quark id fits into single decimal digit..- and we have inherited this from PDG scheme, that meand that PDG scheme is not self-consistent. It is a pity, but we can do nothing here.
Or I suppose I could hide the magic numbers a little more:
return LHCb::ParticleID::up <= abspid() && abspid <= LHCb::ParticleID::top_prime;
Edited by Alex Pearceadded 2 commits