G4QPDGCode.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //      ---------------- G4QPDGCode ----------------
00030 //             by Mikhail Kossov, Sept 1999.
00031 //  class header for Hadron definition in CHIPS Model
00032 // ------------------------------------------------------------
00033 // Short description: The PDG Code is made on the basis of the Quark
00034 // Content (G4QuarkContent) of the hadronic state (including nuclear
00035 // fragments). The PDG code of the ground state (e.g. pi, N, etc.) is
00036 // calculated. It includes a complicated algortithm of the G.S. mass
00037 // calculation for nuclear fragments (now it is synchronised with the
00038 // G4 nuclear massess).
00039 // -------------------------------------------------------------------
00040 
00041 #ifndef G4QPDGCode_h
00042 #define G4QPDGCode_h 1
00043 
00044 #include <iostream>
00045 #include "globals.hh"
00046 // Geant4 particles for consistency of masses only
00047 // Leptons
00048 #include "G4MuonPlus.hh"
00049 #include "G4MuonMinus.hh"
00050 #include "G4TauMinus.hh"
00051 #include "G4TauPlus.hh"
00052 #include "G4Electron.hh"
00053 #include "G4Positron.hh"
00054 #include "G4NeutrinoTau.hh"
00055 #include "G4AntiNeutrinoTau.hh"
00056 #include "G4NeutrinoMu.hh"
00057 #include "G4AntiNeutrinoMu.hh"
00058 #include "G4NeutrinoE.hh"
00059 #include "G4AntiNeutrinoE.hh"
00060 // Mesons
00061 #include "G4PionPlus.hh"
00062 #include "G4PionMinus.hh"
00063 #include "G4PionZero.hh"
00064 #include "G4Eta.hh"
00065 #include "G4EtaPrime.hh"
00066 
00067 #include "G4KaonPlus.hh"
00068 #include "G4KaonMinus.hh"
00069 #include "G4KaonZero.hh"
00070 #include "G4AntiKaonZero.hh"
00071 #include "G4KaonZeroLong.hh"
00072 #include "G4KaonZeroShort.hh"
00073 
00074 #include "G4DMesonPlus.hh"
00075 #include "G4DMesonMinus.hh"
00076 #include "G4DMesonZero.hh"
00077 #include "G4AntiDMesonZero.hh"
00078 #include "G4DsMesonPlus.hh"
00079 #include "G4DsMesonMinus.hh"
00080 #include "G4JPsi.hh"
00081 
00082 #include "G4BMesonPlus.hh"
00083 #include "G4BMesonMinus.hh"
00084 #include "G4BMesonZero.hh"
00085 #include "G4AntiBMesonZero.hh"
00086 #include "G4BsMesonZero.hh"
00087 #include "G4AntiBsMesonZero.hh"
00088 
00089 
00090 // Barions
00091 #include "G4Proton.hh"
00092 #include "G4AntiProton.hh"
00093 #include "G4Neutron.hh"
00094 #include "G4AntiNeutron.hh"
00095 
00096 #include "G4Lambda.hh"
00097 #include "G4SigmaPlus.hh"
00098 #include "G4SigmaZero.hh"
00099 #include "G4SigmaMinus.hh"
00100 #include "G4XiMinus.hh"
00101 #include "G4XiZero.hh"
00102 #include "G4OmegaMinus.hh"
00103 
00104 #include "G4AntiLambda.hh"
00105 #include "G4AntiSigmaPlus.hh"
00106 #include "G4AntiSigmaZero.hh"
00107 #include "G4AntiSigmaMinus.hh"
00108 #include "G4AntiXiMinus.hh"
00109 #include "G4AntiXiZero.hh"
00110 #include "G4AntiOmegaMinus.hh"
00111 
00112 #include "G4LambdacPlus.hh"
00113 #include "G4SigmacPlusPlus.hh"
00114 #include "G4SigmacPlus.hh"
00115 #include "G4SigmacZero.hh"
00116 #include "G4XicPlus.hh"
00117 #include "G4XicZero.hh"
00118 #include "G4OmegacZero.hh"
00119 
00120 #include "G4AntiLambdacPlus.hh"
00121 #include "G4AntiSigmacPlusPlus.hh"
00122 #include "G4AntiSigmacPlus.hh"
00123 #include "G4AntiSigmacZero.hh"
00124 #include "G4AntiXicPlus.hh"
00125 #include "G4AntiXicZero.hh"
00126 #include "G4AntiOmegacZero.hh"
00127 
00128 // Nuclei
00129 #include "G4Alpha.hh"
00130 #include "G4Deuteron.hh"
00131 #include "G4He3.hh"
00132 #include "G4Triton.hh"
00133 
00134 //ions
00135 #include "G4GenericIon.hh"
00136 #include "G4NucleiProperties.hh"
00137 // --- End of consistency headers ---
00138 
00139 #include "G4QContent.hh"
00140 
00141 class G4QPDGCode
00142 {
00143 public:
00144   // Constructors
00145   G4QPDGCode(G4int PDGCode = 0);                     // Construction by PDGCode
00146   G4QPDGCode(G4bool f, G4int QCode);                 // Construction by QCode, f-verb
00147   G4QPDGCode(G4QContent QCont);                      // Construction by Quark Content
00148   G4QPDGCode(const G4QPDGCode& rhs);                 // Copy Constructor by value
00149   G4QPDGCode(G4QPDGCode* rhs);                       // Copy Constructor by pointer
00150 
00151   ~G4QPDGCode();                                     // Public Destructor
00152 
00153   // Operators
00154   const G4QPDGCode& operator=(const G4QPDGCode& rhs);
00155   G4bool            operator==(const G4QPDGCode& rhs) const;
00156   G4bool            operator==(const G4int& rhs) const;
00157   G4bool            operator!=(const G4QPDGCode& rhs) const;
00158   G4bool            operator!=(const G4int& rhs) const;
00159   G4QPDGCode        operator+=(const G4int& rhs);
00160   G4QPDGCode        operator+=(const G4QPDGCode& rhs);
00161   G4QPDGCode        operator-=(const G4int& rhs);
00162   G4QPDGCode        operator-=(const G4QPDGCode& rhs);
00163   G4QPDGCode        operator*=(const G4int& rhs);
00164   G4QPDGCode        operator/=(const G4int& rhs);
00165 
00166   // Selectors
00167   G4int      GetNQHadr();                              // Return # of predefined hadrons
00168   G4double   GetMass();                                // GS Mass for the QHadron
00169   G4double   GetMass2();                               // Squared GS Mass for the QHadron
00170   G4double   GetWidth();                               // Width for the QHadron
00171   G4double   GetNuclMass(G4int Z, G4int N, G4int S);   // Wrapper forNuclearMassCalculation
00172   G4double   GetNuclMass(G4int PDGCode);               // Wrapper forNuclearMassCalculation
00173   G4QContent GetQuarkContent()                  const; // Get QC for the particle
00174   G4int      GetBaryNum()                       const; // Get Baryon Number of the Hadron
00175   G4int      GetSpin()                          const; // Returns 2s+1 for hadrons, 1 for A
00176   G4int      GetCharge()                        const; // Get Charge of the Hadron
00177   G4int      GetPDGCode()                       const; // Get PDG code of the Hadron
00178   G4int      GetQCode()                         const; // Get Q code of the Hadron
00179   G4QContent GetExQContent(G4int i, G4int o)    const; // Get Q Content for Quark Exchange
00180   G4int      GetRelCrossIndex(G4int i, G4int o) const; // Relative Cross Index for q_i->q_o
00181   G4int      GetNumOfComb(G4int i, G4int o)     const; // Get #ofCombinations for q_i->q_o
00182   G4int      GetTotNumOfComb(G4int i)           const; // Get total#ofCombinations for q_i 
00183 
00184   // Modifiers
00185   void       SetPDGCode(G4int newPDGCode);             // Set PDG code of the Hadron
00186   void       InitByQCont(G4QContent QCont);            // Init ExistingQPDG by QuarkContent
00187   void       InitByQCode(G4int QCode);                 // Init ExistingQPDG by Q Code
00188 
00189   // General
00190   G4bool     TestRealNeutral();
00191 
00192   void       NegPDGCode();
00193   void       ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s);
00194   std::pair<G4int,G4int> MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2);
00195 
00196 private:
00197   // Encapsulated functions
00198   G4bool   TestRealNeutral(const G4int& PDGCode);
00199   G4int    MakeQCode(const G4int& PDGCode);              // Make Q Code, using PDG Code
00200   G4int    MakePDGCode(const G4int& QCode);              // Make PDG Code, using Q Code
00201   G4double CalculateNuclMass(G4int Z, G4int N, G4int S); // Nuclear Mass Calculation
00202   G4double QHaM(G4int nQ);                      // Definition of hadronic masses in Q-order
00203 private:
00204   // Static parameter
00205   //static const G4int nQHM=90;
00206   static const G4int nQHM=53; // Reduced CHIPS
00207   // the Body
00208   G4int              thePDGCode;
00209   G4int              theQCode;
00210 };
00211 
00212 // Not member operators
00213 std::ostream&   operator<<(std::ostream& lhs, G4QPDGCode& rhs);
00214 std::ostream&   operator<<(std::ostream& lhs, const G4QPDGCode& rhs);
00215 G4int      operator+(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
00216 G4int      operator+(const G4QPDGCode& lhs, const G4int&      rhs);
00217 G4int      operator+(const G4int&      lhs, const G4QPDGCode& rhs);
00218 G4int      operator-(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
00219 G4int      operator-(const G4QPDGCode& lhs, const G4int&      rhs);
00220 G4int      operator-(const G4int&      lhs, const G4QPDGCode& rhs);
00221 G4int      operator*(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
00222 G4int      operator*(const G4QPDGCode& lhs, const G4int&      rhs);
00223 G4int      operator*(const G4int&      lhs, const G4QPDGCode& rhs);
00224 G4int      operator/(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
00225 G4int      operator/(const G4QPDGCode& lhs, const G4int&      rhs);
00226 G4int      operator/(const G4int&      lhs, const G4QPDGCode& rhs);
00227 G4int      operator%(const G4QPDGCode& lhs, const G4int&      rhs);
00228 // Not member functions
00229 //----------------------------------------------------------------------------------------
00230 
00231 inline G4bool G4QPDGCode::operator==(const G4QPDGCode& rhs) const {return this==&rhs;}
00232 inline G4bool G4QPDGCode::operator==(const G4int&      rhs) const {return thePDGCode==rhs;}
00233 inline G4bool G4QPDGCode::operator!=(const G4QPDGCode& rhs) const {return this!=&rhs;}
00234 inline G4bool G4QPDGCode::operator!=(const G4int&      rhs) const {return thePDGCode!=rhs;}
00235 
00236 inline G4int  G4QPDGCode::GetNQHadr() {return nQHM;} // Return # of predefined hadrons
00237 
00238 inline G4QPDGCode G4QPDGCode::operator+=(const G4QPDGCode& rhs)
00239 {
00240   thePDGCode+=rhs.GetPDGCode();
00241   if(!thePDGCode) theQCode = -2;
00242   else theQCode = MakeQCode(thePDGCode);
00243   return *this;
00244 }
00245 inline G4QPDGCode G4QPDGCode::operator+=(const G4int& rhs)
00246 {
00247   thePDGCode+=rhs;
00248   if(!thePDGCode) theQCode = -2;
00249   else theQCode = MakeQCode(thePDGCode);
00250   return *this;
00251 }
00252 inline G4QPDGCode G4QPDGCode::operator-=(const G4QPDGCode& rhs)
00253 {
00254   thePDGCode-=rhs.GetPDGCode();
00255   if(!thePDGCode) theQCode = -2;
00256   else theQCode = MakeQCode(thePDGCode);
00257   return *this;
00258 }
00259 inline G4QPDGCode G4QPDGCode::operator-=(const G4int& rhs)
00260 {
00261   thePDGCode-=rhs;
00262   if(!thePDGCode) theQCode = -2;
00263   else theQCode = MakeQCode(thePDGCode);
00264   return *this;
00265 }
00266 inline G4QPDGCode G4QPDGCode::operator*=(const G4int& rhs)
00267 {
00268   thePDGCode*=rhs;
00269   if(!thePDGCode) theQCode = -2;
00270   else theQCode = MakeQCode(thePDGCode);
00271   return *this;
00272 }
00273 inline G4QPDGCode G4QPDGCode::operator/=(const G4int& rhs)
00274 {
00275   thePDGCode/=rhs;
00276   if(!thePDGCode) theQCode = -2;
00277   else theQCode = MakeQCode(thePDGCode);
00278   return *this;
00279 }
00280  
00281 inline G4double G4QPDGCode::GetMass2() {G4double mass=GetMass(); return mass*mass;}
00282 inline G4double G4QPDGCode::GetNuclMass(G4int PDG)
00283 {
00284   if(PDG>80000000)
00285   {
00286     G4int szn=PDG-90000000;
00287     G4int ds=0;
00288     G4int dz=0;
00289     G4int dn=0;
00290     if(szn<-100000)
00291     {
00292       G4int ns_value=(-szn)/1000000+1;
00293       szn+=ns_value*1000000;
00294       ds+=ns_value;
00295     }
00296     else if(szn<-100)
00297     {
00298       G4int nz=(-szn)/1000+1;
00299       szn+=nz*1000;
00300       dz+=nz;
00301     }
00302     else if(szn<0)
00303     {
00304       G4int nn=-szn;
00305       szn=0;
00306       dn+=nn;
00307     }
00308     G4int sz =szn/1000;
00309     G4int n  =szn%1000;
00310     if(n>700)
00311     {
00312       n-=1000;
00313       dz--;
00314     }
00315     G4int z  =sz%1000-dz;
00316     if(z>700)
00317     {
00318       z-=1000;
00319       ds--;
00320     }
00321     G4int s_value  =sz/1000-ds;
00322     return GetNuclMass(z,n,s_value);
00323   }
00324   return 0.;
00325 }
00326 inline G4int   G4QPDGCode::GetPDGCode() const {return thePDGCode;}
00327 inline G4int   G4QPDGCode::GetQCode()   const {return theQCode;}
00328 inline G4int   G4QPDGCode::GetCharge()  const {return GetQuarkContent().GetCharge();}
00329 inline G4int   G4QPDGCode::GetBaryNum() const {return GetQuarkContent().GetBaryonNumber();}
00330 inline G4int   G4QPDGCode::GetSpin()    const 
00331 {
00332   if(thePDGCode<80000000)               return thePDGCode%10;
00333   else if(GetQuarkContent().GetTot()%2) return 3; // @@ Take into account higher resonances
00334   else                                  return 1;
00335 }
00336 inline void     G4QPDGCode::NegPDGCode()     {thePDGCode=-thePDGCode;}
00337 inline G4bool   G4QPDGCode::TestRealNeutral(){return TestRealNeutral(thePDGCode);}
00338 
00339 // Redefinition of the PDG instance
00340 inline void  G4QPDGCode::SetPDGCode(G4int newPDGCode)
00341 {
00342   thePDGCode=newPDGCode;
00343   if(!thePDGCode) theQCode = -2;
00344   else theQCode = MakeQCode(newPDGCode);
00345 }
00346 
00347 // Init existing QPDG by Quark Content
00348 inline void  G4QPDGCode::InitByQCont(G4QContent QCont)
00349 {
00350   thePDGCode = QCont.GetSPDGCode();
00351   if(!thePDGCode) theQCode = -2;
00352   else theQCode   = MakeQCode(thePDGCode);
00353 }
00354 
00355 // Init existing QPDG by Quark Content
00356 inline void  G4QPDGCode::InitByQCode(G4int QCode)
00357 {
00358   theQCode   = QCode;
00359   thePDGCode = MakePDGCode(QCode);
00360 }
00361 
00362 #endif

Generated on Mon May 27 17:49:39 2013 for Geant4 by  doxygen 1.4.7