2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
6 inline Trk::ParticleHypothesis
7 PdgToParticleHypothesis::convert(int pdg, double charge) const
10 return convert(pdg, stable, exiting, charge);
13 inline Trk::ParticleHypothesis
14 PdgToParticleHypothesis::convert(int pdg,
20 int pdgCode = abs(pdg);
25 Trk::ParticleHypothesis particleType;
27 // try to follow number of appearance
31 particleType = Trk::electron;
37 particleType = Trk::muon;
42 case 12: // e neutrino
43 case 14: // mu neutrino
44 case 16: { // tau neutrino
45 particleType = Trk::nonInteracting;
51 particleType = Trk::photon;
56 case 211: { // pi+/pi-
57 particleType = Trk::pion;
63 particleType = Trk::pi0;
68 case 2212: { // proton
69 particleType = Trk::proton;
74 case 2112: { // neutron
75 particleType = Trk::neutron;
81 particleType = Trk::kaon;
87 particleType = Trk::k0;
92 case 310: { // K_short
93 particleType = Trk::k0;
98 default: { // treat mesons as pions
99 particleType = charge != 0. ? Trk::pion : Trk::pi0;
105 // and all baryons as proton hypo
106 if (pdgCode > 999 && pdgCode != 2112) {
107 particleType = charge != 0. ? Trk::proton : Trk::neutron;
112 // ignore SUSY particles for now
113 if (pdgCode > 1000000) {
114 particleType = Trk::nonInteracting;
123 PdgToParticleHypothesis::convert(Trk::ParticleHypothesis particleHypo,
130 switch (particleHypo) {
132 case Trk::electron: {
134 pdg *= charge > 0. ? -1 : 1;
140 pdg *= charge > 0. ? -1 : 1;
146 pdg *= charge > 0. ? 1 : -1;
147 if (charge * charge < 0.0001)
148 pdg = dist ? 130 : 310;
154 pdg *= charge > 0. ? 1 : -1;
155 if (charge * charge < 0.0001)
156 pdg = dist ? 2112 : -2112;
169 // the neutral pion case
174 // the neutral kaon case
176 pdg = dist ? 130 : 310;
179 // the pion case - is the default
182 pdg *= charge > 0. ? 1 : -1;
183 if (charge * charge < 0.0001)