ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4InuclParticleNames.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4InuclParticleNames.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // Defines enums to map G4InuclElementaryParticle type codes to human
28 // readable names. Meant to replace similar local enums scattered through
29 // the code.
30 //
31 // 20101029 M. Kelsey -- Move antinucleons to 50-series, add deuteron
32 // 20111007 M. Kelsey -- Change photon code to 9, for use in initial states
33 // 20130508 D. Wright -- Add leptons and electroweak bosons
34 // 20130627 M. Kelsey -- Add functions to convert enum to strings for printing
35 // 20130702 M. Kelsey -- Add type classifiers ported from G4InuclElemPart
36 
37 #ifndef G4INUCL_PARTICLE_NAMES_HH
38 #define G4INUCL_PARTICLE_NAMES_HH
39 
40 #include "globals.hh"
41 
42 namespace G4InuclParticleNames {
43  enum Long { nuclei=0, proton=1, neutron=2,
47  xiZero=29, xiMinus=31, omegaMinus=33,
48  deuteron=41, triton=43, He3=45, alpha=47,
51  diproton=111, unboundPN=112, dineutron=122,
52  electronNu=-1, muonNu=-3, tauNu=-5,
54  WMinus=-13, WPlus=-15, Zzero=-17,
55  electron=-21, muonMinus=-23, tauMinus=-25,
56  positron=-27, muonPlus=-29, tauPlus=-31};
57 
58  // NOTE: "km" cannot be used as conflicts with "kilometers" unit!
72 
73  // Convert enum value to enum strings above for printing
74  const char* nameLong(G4int ptype);
75  const char* nameShort(G4int ptype);
76  inline const char* name(G4int ptype) { return nameLong(ptype); }
77 
78  // Classify particle types to reduce if-blocks in client code
79  inline G4bool isPhoton(G4int ityp) { return (ityp==photon); }
80 
81  inline G4bool isMuon(G4int ityp) { return (ityp==muonMinus||ityp==muonPlus); }
82 
83  inline G4bool isElectron(G4int ityp) { return (ityp==electron||ityp==positron); }
84 
85  inline G4bool isNeutrino(G4int ityp) {
86  return (ityp==electronNu || ityp==muonNu || ityp==tauNu ||
87  ityp==antiElectronNu || ityp==antiMuonNu || ityp==antiTauNu);
88  }
89 
90  inline G4bool pion(G4int ityp) {
91  return (ityp==pionPlus || ityp==pionMinus || ityp==pionZero);
92  }
93 
94  inline G4bool nucleon(G4int ityp) { return (ityp==proton || ityp==neutron); }
95 
96  inline G4bool antinucleon(G4int ityp) {
97  return (ityp==antiProton || ityp==antiNeutron);
98  }
99 
100  inline G4bool quasi_deutron(G4int ityp) { return (ityp > 100); }
101 
102  // Emulates G4PD::GetBaryonNumber(), rather than a simple bool
103  inline G4int baryon(G4int ityp) {
104  return ((ityp==pro || ityp==neu || ityp==lam || ityp==sp || ityp==s0 ||
105  ityp==sm || ityp==xi0 || ityp==xim || ityp==om) ? 1 :
106  (ityp==deu || ityp==pp || ityp==pn || ityp==nn) ? 2 :
107  (ityp==ap || ityp==an) ? -1 :
108  (ityp==ade) ? -2 :
109  (ityp==atr || ityp==ahe) ? -3 :
110  (ityp==aal) ? -4 : 0);
111  }
112 
113  inline G4bool antibaryon(G4int ityp) { return baryon(ityp) < 0; }
114 
115  inline G4bool hyperon(G4int ityp) {
116  return (ityp==lam || ityp==sp || ityp==s0 || ityp==sm || ityp==xi0 ||
117  ityp==xim || ityp==om);
118  }
119 }
120 
121 #endif /* G4INUCL_PARTICLE_NAMES_HH */