Skip to content

Commit

Permalink
Fix j_spin for susy particle (#494)
Browse files Browse the repository at this point in the history
* fix j_spin for susy particle

* include gluion  chargino

* update test and code

* tests for chargino and neutralino

* add gravitino
  • Loading branch information
amanmdesai authored May 26, 2023
1 parent b769af1 commit c091083
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
32 changes: 21 additions & 11 deletions src/particle/pdgid/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,17 +703,27 @@ def j_spin(pdgid: PDGID_TYPE) -> int | None:
return None
if _fundamental_id(pdgid) > 0:
fund = _fundamental_id(pdgid)
if 0 < fund < 7: # 4th generation quarks not dealt with !
return 2
if (
fund == 9
): # Alternative ID for the gluon in codes for glueballs to allow a notation in close analogy with that of hadrons
return 3
if 10 < fund < 17: # 4th generation leptons not dealt with !
return 2
if 20 < fund < 25:
return 3
return None
if is_SUSY(pdgid): # susy particles
if 0 < fund < 17:
return 1
if fund == 21:
return 2
if 22 <= fund < 38:
return 2
if fund == 39:
return 4
else: # other particles
if 0 < fund < 7: # 4th generation quarks not dealt with !
return 2
if (
fund == 9
): # Alternative ID for the gluon in codes for glueballs to allow a notation in close analogy with that of hadrons
return 3
if 10 < fund < 17: # 4th generation leptons not dealt with !
return 2
if 20 < fund < 25:
return 3
return None
if abs(int(pdgid)) in {1000000010, 1000010010}: # neutron, proton
return 2
if _extra_bits(pdgid) > 0:
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class PDGIDsEnum(IntEnum):
Gravitino = 1000039
STildeL = 1000003
CTildeR = 2000004
Neutralino_1 = 1000022
Chargino_1 = 1000024
# R-hadrons
R0_1000017 = 1000017
RPlus_TTildeDbar = 1000612
Expand Down
13 changes: 9 additions & 4 deletions tests/pdgid/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ def test_is_SUSY(PDGIDs):
PDGIDs.Gravitino,
PDGIDs.STildeL,
PDGIDs.CTildeR,
PDGIDs.Chargino_1,
PDGIDs.Neutralino_1,
PDGIDs.R0_1000017,
)
_non_susy = [pid for pid in PDGIDs if pid not in _susy]
Expand Down Expand Up @@ -611,6 +613,7 @@ def test_has_fundamental_anti(PDGIDs):
PDGIDs.AntiElectronStar,
PDGIDs.STildeL,
PDGIDs.CTildeR,
PDGIDs.Chargino_1,
PDGIDs.AntiCHadron,
PDGIDs.R0_1000017,
)
Expand Down Expand Up @@ -767,7 +770,8 @@ def test_JSL_badly_known_mesons(PDGIDs):

def test_J_non_mesons(PDGIDs):
# TODO: test special particles, supersymmetric particles, R-hadrons, di-quarks, nuclei and pentaquarks
_J_eq_0 = ()
_J_eq_0 = (PDGIDs.STildeL, PDGIDs.CTildeR)

_J_eq_1 = (
PDGIDs.Gluon,
PDGIDs.Photon,
Expand Down Expand Up @@ -803,10 +807,11 @@ def test_J_non_mesons(PDGIDs):
PDGIDs.LcPlus,
PDGIDs.Lb,
PDGIDs.LtPlus,
PDGIDs.STildeL,
PDGIDs.CTildeR,
PDGIDs.Gluino,
PDGIDs.Neutralino_1,
PDGIDs.Chargino_1,
)
_J_eq_3over2 = (PDGIDs.OmegaMinus,)
_J_eq_3over2 = (PDGIDs.OmegaMinus, PDGIDs.Gravitino)
_invalid_pdgids = (PDGIDs.Invalid1, PDGIDs.Invalid2)
# cases not dealt with in the code, where None is returned
_J_eq_None = (PDGIDs.TauPrime, PDGIDs.BPrimeQuark, PDGIDs.TPrimeQuark)
Expand Down

0 comments on commit c091083

Please sign in to comment.