00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #define INCLXX_IN_GEANT4_MODE 1
00034 
00035 #include "globals.hh"
00036 
00037 #ifndef G4INCLParticleTable_hh
00038 #define G4INCLParticleTable_hh 1
00039 
00040 #include <string>
00041 #include <vector>
00042 
00043 
00044 #include "G4INCLParticleType.hh"
00045 #include "G4INCLParticleSpecies.hh"
00046 #include "G4INCLLogger.hh"
00047 #include "G4INCLConfig.hh"
00048 
00049 #ifdef INCLXX_IN_GEANT4_MODE
00050 #include "G4IonTable.hh"
00051 #include "G4ParticleTable.hh"
00052 #endif
00053 #include "G4INCLGlobals.hh"
00054 #include "G4INCLNaturalIsotopicDistributions.hh"
00055 
00056 namespace G4INCL {
00057   class ParticleTable {
00058   public:
00060     static void initialize(Config const * const theConfig = 0);
00061 
00063     static G4int getIsospin(const ParticleType t);
00064 
00066     static std::string getName(const ParticleType t);
00067 
00069     static std::string getShortName(const ParticleType t);
00070 
00072     static std::string getName(const ParticleSpecies s);
00073 
00075     static std::string getShortName(const ParticleSpecies s);
00076 
00078     static std::string getName(const G4int A, const G4int Z);
00079 
00081     static std::string getShortName(const G4int A, const G4int Z);
00082 
00084     static G4double getINCLMass(const G4int A, const G4int Z);
00085 
00087     static G4double getINCLMass(const ParticleType t);
00088 
00089 #ifndef INCLXX_IN_GEANT4_MODE
00091     static G4double hasMassTable(const unsigned int A, const unsigned int Z) {
00092       return ( Z > 0 && A > 0
00093           && Z < massTableMask.size() && A < massTableMask.at(Z).size()
00094           && massTableMask.at(Z).at(A));
00095     }
00096 
00106     static G4double getWeizsaeckerMass(const G4int A, const G4int Z) {
00107       const G4int Npairing = (A-Z)%2;                  
00108       const G4int Zpairing = Z%2;
00109       const G4double fA = (G4double) A;
00110       const G4double fZ = (G4double) Z;
00111       G4double binding =
00112         - 15.67*fA                          
00113         + 17.23*Math::pow23(fA)                
00114         + 93.15*((fA/2.-fZ)*(fA/2.-fZ))/fA       
00115         + 0.6984523*fZ*fZ*Math::powMinus13(fA);      
00116       if( Npairing == Zpairing ) binding += (Npairing+Zpairing-1) * 12.0 / std::sqrt(fA);  
00117 
00118       return fZ*getRealMass(Proton)+((G4double)(A-Z))*getRealMass(Neutron)+binding;
00119     }
00120 #endif
00121 
00123     static G4double getRealMass(const G4INCL::ParticleType t);
00125     static G4double getRealMass(const G4int A, const G4int Z);
00126 
00133     static G4double getTableQValue(const G4int A1, const G4int Z1, const G4int A2, const G4int Z2) {
00134       return getTableMass(A1,Z1) + getTableMass(A2,Z2) - getTableMass(A1+A2,Z1+Z2);
00135     }
00136 
00143     static G4double getTableQValue(const G4int A1, const G4int Z1, const G4int A2, const G4int Z2, const G4int A3, const G4int Z3) {
00144       return getTableMass(A1,Z1) + getTableMass(A2,Z2) - getTableMass(A3,Z3) - getTableMass(A1+A2-A3,Z1+Z2-Z3);
00145     }
00146 
00147     
00148     typedef G4double (*NuclearMassFn)(const G4int, const G4int);
00149     typedef G4double (*ParticleMassFn)(const ParticleType);
00150     static NuclearMassFn getTableMass;
00151     static ParticleMassFn getTableParticleMass;
00152 
00153     static G4double getTableSpeciesMass(const ParticleSpecies &p) {
00154       if(p.theType == Composite)
00155         return (*getTableMass)(p.theA, p.theZ);
00156       else
00157         return (*getTableParticleMass)(p.theType);
00158     }
00159 
00160     
00161     typedef G4double (*SeparationEnergyFn)(const ParticleType, const G4int, const G4int);
00162     static SeparationEnergyFn getSeparationEnergy;
00163 
00165     static G4int getMassNumber(const ParticleType t) {
00166       switch(t) {
00167         case Proton:
00168         case Neutron:
00169         case DeltaPlusPlus:
00170         case DeltaPlus:
00171         case DeltaZero:
00172         case DeltaMinus:
00173           return 1;
00174           break;
00175         case PiPlus:
00176         case PiMinus:
00177         case PiZero:
00178           return 0;
00179           break;
00180         default:
00181           return 0;
00182           break;
00183       }
00184     }
00185 
00187     static G4int getChargeNumber(const ParticleType t) {
00188       switch(t) {
00189         case DeltaPlusPlus:
00190           return 2;
00191           break;
00192         case Proton:
00193         case DeltaPlus:
00194         case PiPlus:
00195           return 1;
00196           break;
00197         case Neutron:
00198         case DeltaZero:
00199         case PiZero:
00200           return 0;
00201           break;
00202         case DeltaMinus:
00203         case PiMinus:
00204           return -1;
00205           break;
00206         default:
00207           return 0;
00208           break;
00209       }
00210     }
00211 
00212     static G4double getNuclearRadius(const G4int A, const G4int Z);
00213     static G4double getRadiusParameter(const G4int A, const G4int Z);
00214     static G4double getMaximumNuclearRadius(const G4int A, const G4int Z);
00215     static G4double getSurfaceDiffuseness(const G4int A, const G4int Z);
00216 
00218     static G4double getMomentumRMS(const G4int A, const G4int Z) {
00219 
00220       if(Z<clusterTableZSize && A<clusterTableASize)
00221         return momentumRMS[Z][A];
00222       else
00223         return Math::sqrtThreeFifths * PhysicalConstants::Pf;
00224     }
00225 
00227     static G4double getSeparationEnergyINCL(const ParticleType t, const G4int , const G4int ) {
00228       if(t==Proton)
00229         return theINCLProtonSeparationEnergy;
00230       else if(t==Neutron)
00231         return theINCLNeutronSeparationEnergy;
00232       else {
00233         ERROR("ParticleTable::getSeparationEnergyINCL : Unknown particle type." << std::endl);
00234         return 0.0;
00235       }
00236     }
00237 
00239     static G4double getSeparationEnergyReal(const ParticleType t, const G4int A, const G4int Z) {
00240       
00241       if(t==Proton)
00242         return (*getTableParticleMass)(Proton) + (*getTableMass)(A-1,Z-1) - (*getTableMass)(A,Z);
00243       else if(t==Neutron)
00244         return (*getTableParticleMass)(Neutron) + (*getTableMass)(A-1,Z) - (*getTableMass)(A,Z);
00245       else {
00246         ERROR("ParticleTable::getSeparationEnergyReal : Unknown particle type." << std::endl);
00247         return 0.0;
00248       }
00249     }
00250 
00252     static G4double getSeparationEnergyRealForLight(const ParticleType t, const G4int A, const G4int Z) {
00253       
00254       if(Z<clusterTableZSize && A<clusterTableASize)
00255         return getSeparationEnergyReal(t, A, Z);
00256       else
00257         return getSeparationEnergyINCL(t, A, Z);
00258     }
00259 
00261     static G4double getProtonSeparationEnergy() { return protonSeparationEnergy; }
00262 
00264     static G4double getNeutronSeparationEnergy() { return neutronSeparationEnergy; }
00265 
00267     static void setProtonSeparationEnergy(const G4double s) { protonSeparationEnergy = s; }
00268 
00270     static void setNeutronSeparationEnergy(const G4double s) { neutronSeparationEnergy  = s; }
00271 
00273     static std::string getElementName(const G4int Z);
00275     static std::string getIUPACElementName(const G4int Z);
00276 
00284     static G4int parseIUPACElement(std::string const &pS);
00285 
00286     const static G4int elementTableSize = 113; 
00287 
00288     const static G4double effectiveNucleonMass;
00289     const static G4double effectiveNucleonMass2;
00290     const static G4double effectiveDeltaMass;
00291     const static G4double effectivePionMass;
00292     const static G4double effectiveDeltaDecayThreshold;
00293 
00294     static const G4int maxClusterMass = 12;
00295     static const G4int maxClusterCharge = 8;
00296 
00297     const static G4int clusterTableZSize = ParticleTable::maxClusterCharge+1;
00298     const static G4int clusterTableASize = ParticleTable::maxClusterMass+1;
00299     const static G4double clusterPosFact[maxClusterMass+1];
00300     const static G4double clusterPosFact2[maxClusterMass+1];
00301     const static G4int clusterZMin[maxClusterMass+1]; 
00302     const static G4int clusterZMax[maxClusterMass+1]; 
00303     const static G4double clusterPhaseSpaceCut[maxClusterMass+1];
00304 
00305 #ifdef INCLXX_IN_GEANT4_MODE
00306     static G4IonTable *theG4IonTable;
00307 #else
00308     static std::vector< std::vector <G4bool> > massTableMask;
00309     static std::vector< std::vector <G4double> > massTable;
00310 #endif
00311 
00312     
00313     enum ClusterDecayType {
00314       StableCluster,
00315       NeutronDecay,
00316       ProtonDecay,
00317       AlphaDecay,
00318       TwoProtonDecay,
00319       TwoNeutronDecay,
00320       ProtonUnbound,
00321       NeutronUnbound
00322     };
00323     const static ClusterDecayType clusterDecayMode[clusterTableZSize][clusterTableASize];
00324 
00329     static const G4double eSquared;
00330 
00331     static IsotopicDistribution const &getNaturalIsotopicDistribution(const G4int Z) {
00332       return getNaturalIsotopicDistributions()->getIsotopicDistribution(Z);
00333     }
00334 
00335     static G4int drawRandomNaturalIsotope(const G4int Z) {
00336       return getNaturalIsotopicDistributions()->drawRandomIsotope(Z);
00337     }
00338 
00339   protected:
00340     ParticleTable() {};
00341     ~ParticleTable() {};
00342 
00343   private:
00344     static const G4double theINCLNucleonMass;
00345     static const G4double theINCLPionMass;
00346     static const G4double theINCLNeutronSeparationEnergy;
00347     static const G4double theINCLProtonSeparationEnergy;
00348     static G4double protonMass;
00349     static G4double neutronMass;
00350     static G4double neutronSeparationEnergy;
00351     static G4double protonSeparationEnergy;
00352     static G4double piPlusMass, piMinusMass, piZeroMass;
00353     static G4double theRealProtonMass;
00354     static G4double theRealNeutronMass;
00355     static G4double theRealChargedPiMass;
00356     static G4double theRealPiZeroMass;
00357 
00358     const static G4int mediumNucleiTableSize = 30;
00359     const static G4double mediumDiffuseness[mediumNucleiTableSize];
00360     const static G4double mediumRadius[mediumNucleiTableSize];
00361     const static G4double positionRMS[clusterTableZSize][clusterTableASize];
00362     const static G4double momentumRMS[clusterTableZSize][clusterTableASize];
00363 
00364     const static std::string elementTable[elementTableSize];
00365     
00366 #ifndef INCLXX_IN_GEANT4_MODE
00368     static void readRealMasses(std::string const &path);
00369 #endif
00370 
00371     const static std::string elementIUPACDigits;
00372 
00374     static char iupacToInt(char c) {
00375       return (char)(((G4int)'0')+elementIUPACDigits.find(c));
00376     }
00377 
00379     static char intToIUPAC(char n) { return elementIUPACDigits.at(n); }
00380 
00382     static const NaturalIsotopicDistributions *theNaturalIsotopicDistributions;
00383 
00385     static const NaturalIsotopicDistributions *getNaturalIsotopicDistributions() {
00386       if(!theNaturalIsotopicDistributions)
00387         theNaturalIsotopicDistributions = new NaturalIsotopicDistributions;
00388       return theNaturalIsotopicDistributions;
00389     }
00390 
00391   };
00392 }
00393 
00394 #endif