Geant4  10.02.p01
G4InuclParticleNames.hh
Go to the documentation of this file.
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 // $Id: G4InuclParticleNames.hh 72074 2013-07-06 06:28:53Z mkelsey $
27 //
28 // Defines enums to map G4InuclElementaryParticle type codes to human
29 // readable names. Meant to replace similar local enums scattered through
30 // the code.
31 //
32 // 20101029 M. Kelsey -- Move antinucleons to 50-series, add deuteron
33 // 20111007 M. Kelsey -- Change photon code to 9, for use in initial states
34 // 20130508 D. Wright -- Add leptons and electroweak bosons
35 // 20130627 M. Kelsey -- Add functions to convert enum to strings for printing
36 // 20130702 M. Kelsey -- Add type classifiers ported from G4InuclElemPart
37 
38 #ifndef G4INUCL_PARTICLE_NAMES_HH
39 #define G4INUCL_PARTICLE_NAMES_HH
40 
41 #include "globals.hh"
42 
44  enum Long { nuclei=0, proton=1, neutron=2,
48  xiZero=29, xiMinus=31, omegaMinus=33,
49  deuteron=41, triton=43, He3=45, alpha=47,
52  diproton=111, unboundPN=112, dineutron=122,
53  electronNu=-1, muonNu=-3, tauNu=-5,
55  WMinus=-13, WPlus=-15, Zzero=-17,
56  electron=-21, muonMinus=-23, tauMinus=-25,
57  positron=-27, muonPlus=-29, tauPlus=-31};
58 
59  // NOTE: "km" cannot be used as conflicts with "kilometers" unit!
73 
74  // Convert enum value to enum strings above for printing
75  const char* nameLong(G4int ptype);
76  const char* nameShort(G4int ptype);
77  inline const char* name(G4int ptype) { return nameLong(ptype); }
78 
79  // Classify particle types to reduce if-blocks in client code
80  inline G4bool isPhoton(G4int ityp) { return (ityp==photon); }
81 
82  inline G4bool isMuon(G4int ityp) { return (ityp==muonMinus||ityp==muonPlus); }
83 
84  inline G4bool isElectron(G4int ityp) { return (ityp==electron||ityp==positron); }
85 
86  inline G4bool isNeutrino(G4int ityp) {
87  return (ityp==electronNu || ityp==muonNu || ityp==tauNu ||
88  ityp==antiElectronNu || ityp==antiMuonNu || ityp==antiTauNu);
89  }
90 
91  inline G4bool pion(G4int ityp) {
92  return (ityp==pionPlus || ityp==pionMinus || ityp==pionZero);
93  }
94 
95  inline G4bool nucleon(G4int ityp) { return (ityp==proton || ityp==neutron); }
96 
97  inline G4bool antinucleon(G4int ityp) {
98  return (ityp==antiProton || ityp==antiNeutron);
99  }
100 
101  inline G4bool quasi_deutron(G4int ityp) { return (ityp > 100); }
102 
103  // Emulates G4PD::GetBaryonNumber(), rather than a simple bool
104  inline G4int baryon(G4int ityp) {
105  return ((ityp==pro || ityp==neu || ityp==lam || ityp==sp || ityp==s0 ||
106  ityp==sm || ityp==xi0 || ityp==xim || ityp==om) ? 1 :
107  (ityp==deu || ityp==pp || ityp==pn || ityp==nn) ? 2 :
108  (ityp==ap || ityp==an) ? -1 :
109  (ityp==ade) ? -2 :
110  (ityp==atr || ityp==ahe) ? -3 :
111  (ityp==aal) ? -4 : 0);
112  }
113 
114  inline G4bool antibaryon(G4int ityp) { return baryon(ityp) < 0; }
115 
116  inline G4bool hyperon(G4int ityp) {
117  return (ityp==lam || ityp==sp || ityp==s0 || ityp==sm || ityp==xi0 ||
118  ityp==xim || ityp==om);
119  }
120 }
121 
122 #endif /* G4INUCL_PARTICLE_NAMES_HH */
G4bool isElectron(G4int ityp)
G4bool pion(G4int ityp)
G4bool isNeutrino(G4int ityp)
const char * name(G4int ptype)
G4bool antibaryon(G4int ityp)
G4bool antinucleon(G4int ityp)
int G4int
Definition: G4Types.hh:78
const char * nameShort(G4int ptype)
G4bool nucleon(G4int ityp)
G4bool isMuon(G4int ityp)
G4bool isPhoton(G4int ityp)
bool G4bool
Definition: G4Types.hh:79
G4bool hyperon(G4int ityp)
const char * nameLong(G4int ptype)
G4bool quasi_deutron(G4int ityp)