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
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef G4QPDGCode_h
00042 #define G4QPDGCode_h 1
00043
00044 #include <iostream>
00045 #include "globals.hh"
00046
00047
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
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
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
00129 #include "G4Alpha.hh"
00130 #include "G4Deuteron.hh"
00131 #include "G4He3.hh"
00132 #include "G4Triton.hh"
00133
00134
00135 #include "G4GenericIon.hh"
00136 #include "G4NucleiProperties.hh"
00137
00138
00139 #include "G4QContent.hh"
00140
00141 class G4QPDGCode
00142 {
00143 public:
00144
00145 G4QPDGCode(G4int PDGCode = 0);
00146 G4QPDGCode(G4bool f, G4int QCode);
00147 G4QPDGCode(G4QContent QCont);
00148 G4QPDGCode(const G4QPDGCode& rhs);
00149 G4QPDGCode(G4QPDGCode* rhs);
00150
00151 ~G4QPDGCode();
00152
00153
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
00167 G4int GetNQHadr();
00168 G4double GetMass();
00169 G4double GetMass2();
00170 G4double GetWidth();
00171 G4double GetNuclMass(G4int Z, G4int N, G4int S);
00172 G4double GetNuclMass(G4int PDGCode);
00173 G4QContent GetQuarkContent() const;
00174 G4int GetBaryNum() const;
00175 G4int GetSpin() const;
00176 G4int GetCharge() const;
00177 G4int GetPDGCode() const;
00178 G4int GetQCode() const;
00179 G4QContent GetExQContent(G4int i, G4int o) const;
00180 G4int GetRelCrossIndex(G4int i, G4int o) const;
00181 G4int GetNumOfComb(G4int i, G4int o) const;
00182 G4int GetTotNumOfComb(G4int i) const;
00183
00184
00185 void SetPDGCode(G4int newPDGCode);
00186 void InitByQCont(G4QContent QCont);
00187 void InitByQCode(G4int QCode);
00188
00189
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
00198 G4bool TestRealNeutral(const G4int& PDGCode);
00199 G4int MakeQCode(const G4int& PDGCode);
00200 G4int MakePDGCode(const G4int& QCode);
00201 G4double CalculateNuclMass(G4int Z, G4int N, G4int S);
00202 G4double QHaM(G4int nQ);
00203 private:
00204
00205
00206 static const G4int nQHM=53;
00207
00208 G4int thePDGCode;
00209 G4int theQCode;
00210 };
00211
00212
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
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;}
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;
00334 else return 1;
00335 }
00336 inline void G4QPDGCode::NegPDGCode() {thePDGCode=-thePDGCode;}
00337 inline G4bool G4QPDGCode::TestRealNeutral(){return TestRealNeutral(thePDGCode);}
00338
00339
00340 inline void G4QPDGCode::SetPDGCode(G4int newPDGCode)
00341 {
00342 thePDGCode=newPDGCode;
00343 if(!thePDGCode) theQCode = -2;
00344 else theQCode = MakeQCode(newPDGCode);
00345 }
00346
00347
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
00356 inline void G4QPDGCode::InitByQCode(G4int QCode)
00357 {
00358 theQCode = QCode;
00359 thePDGCode = MakePDGCode(QCode);
00360 }
00361
00362 #endif