Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:54

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4PDGCodeChecker
0027 
0028 // Author: Hisaya Kurashige, 17 August 1999
0029 // --------------------------------------------------------------------
0030 #ifndef G4PDGCodeChecker_hh
0031 #define G4PDGCodeChecker_hh 1
0032 
0033 #include "G4ios.hh"
0034 #include "globals.hh"
0035 
0036 class G4PDGCodeChecker
0037 {
0038   public:
0039     G4PDGCodeChecker();
0040     ~G4PDGCodeChecker() = default;
0041 
0042     G4int CheckPDGCode(G4int code, const G4String& type);
0043 
0044     inline G4int GetQuarkContent(G4int flavor) const;
0045     inline G4int GetAntiQuarkContent(G4int flavor) const;
0046 
0047     inline G4bool IsAntiParticle() const;
0048 
0049     inline G4int GetQuarkFlavor(G4int idx) const;
0050 
0051     inline G4int GetSpin() const;
0052     inline G4int GetExotic() const;
0053     inline G4int GetRadial() const;
0054     inline G4int GetMultiplet() const;
0055 
0056     G4bool CheckCharge(G4double charge) const;
0057 
0058     inline G4int GetVerboseLevel() const;
0059     inline void SetVerboseLevel(G4int verbose);
0060 
0061   protected:
0062     enum
0063     {
0064       NumberOfQuarkFlavor = 8
0065     };
0066 
0067   private:
0068     void GetDigits(G4int code);
0069     G4int CheckForQuarks();
0070     G4int CheckForDiQuarks();
0071     G4int CheckForMesons();
0072     G4int CheckForBaryons();
0073     G4int CheckForNuclei();
0074 
0075   private:
0076     G4int verboseLevel = 0;
0077 
0078     G4int code = 0;
0079     G4String theParticleType = "";
0080 
0081     G4int higherSpin = 0;
0082     G4int exotic = 0;
0083     G4int radial = 0;
0084     G4int multiplet = 0;
0085     G4int quark1 = 0;
0086     G4int quark2 = 0;
0087     G4int quark3 = 0;
0088     G4int spin = 0;
0089 
0090     G4int theQuarkContent[NumberOfQuarkFlavor];
0091     G4int theAntiQuarkContent[NumberOfQuarkFlavor];
0092     // The number of quark (minus Sign means anti-quark) contents
0093     // The value of flavor is assigned as follows
0094     //    0:d, 1:u, 2:s, 3:c,
0095     //    4:b, 5:t, 6:l(down type quark) 7:h(up type quark)
0096 };
0097 
0098 // ------------------------
0099 // Inline methods
0100 // ------------------------
0101 
0102 inline G4int G4PDGCodeChecker::GetQuarkContent(G4int flavor) const
0103 {
0104   G4int value = 0;
0105   if ((flavor >= 0) && (flavor < NumberOfQuarkFlavor)) {
0106     value = theQuarkContent[flavor];
0107   }
0108   return value;
0109 }
0110 
0111 inline G4int G4PDGCodeChecker::GetAntiQuarkContent(G4int flavor) const
0112 {
0113   G4int value = 0;
0114   if ((flavor >= 0) && (flavor < NumberOfQuarkFlavor)) {
0115     value = theAntiQuarkContent[flavor];
0116   }
0117   return value;
0118 }
0119 
0120 inline G4int G4PDGCodeChecker::GetQuarkFlavor(G4int idx) const
0121 {
0122   G4int value;
0123   if (idx == 0)
0124     value = quark1;
0125   else if (idx == 1)
0126     value = quark2;
0127   else if (idx == 2)
0128     value = quark3;
0129   else
0130     value = -1;
0131   return value;
0132 }
0133 
0134 inline G4int G4PDGCodeChecker::GetExotic() const
0135 {
0136   return exotic;
0137 }
0138 
0139 inline G4int G4PDGCodeChecker::GetRadial() const
0140 {
0141   return radial;
0142 }
0143 
0144 inline G4int G4PDGCodeChecker::GetMultiplet() const
0145 {
0146   return multiplet;
0147 }
0148 
0149 inline G4int G4PDGCodeChecker::GetSpin() const
0150 {
0151   return spin;
0152 }
0153 
0154 inline G4bool G4PDGCodeChecker::IsAntiParticle() const
0155 {
0156   return (code < 0);
0157 }
0158 
0159 inline void G4PDGCodeChecker::SetVerboseLevel(G4int value)
0160 {
0161   verboseLevel = value;
0162 }
0163 
0164 inline G4int G4PDGCodeChecker::GetVerboseLevel() const
0165 {
0166   return verboseLevel;
0167 }
0168 
0169 #endif