[819] | 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 | // |
---|
| 27 | // $Id: G4QPDGCode.hh,v 1.26 2006/06/29 20:06:23 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | // ---------------- G4QPDGCode ---------------- |
---|
| 31 | // by Mikhail Kossov, Sept 1999. |
---|
| 32 | // class header for Hadron definition in CHIPS Model |
---|
| 33 | // ------------------------------------------------------------ |
---|
| 34 | |
---|
| 35 | #ifndef G4QPDGCode_h |
---|
| 36 | #define G4QPDGCode_h 1 |
---|
| 37 | |
---|
| 38 | #include <iostream> |
---|
| 39 | #include "globals.hh" |
---|
| 40 | #include "G4ParticleTable.hh" |
---|
| 41 | #include "G4NucleiProperties.hh" |
---|
| 42 | #include "G4NucleiPropertiesTable.hh" |
---|
| 43 | #include "G4ParticleTypes.hh" |
---|
| 44 | |
---|
| 45 | #include "G4QContent.hh" |
---|
| 46 | |
---|
| 47 | class G4QPDGCode |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | // Constructors |
---|
| 51 | G4QPDGCode(G4int PDGCode = 0); // Construction by PDGCode |
---|
| 52 | G4QPDGCode(G4bool f, G4int QCode); // Construction by QCode, f-verb |
---|
| 53 | G4QPDGCode(G4QContent QCont); // Construction by Quark Content |
---|
| 54 | G4QPDGCode(const G4QPDGCode& rhs); // Copy Constructor by value |
---|
| 55 | G4QPDGCode(G4QPDGCode* rhs); // Copy Constructor by pointer |
---|
| 56 | |
---|
| 57 | ~G4QPDGCode(); // Public Destructor |
---|
| 58 | |
---|
| 59 | // Operators |
---|
| 60 | const G4QPDGCode& operator=(const G4QPDGCode& rhs); |
---|
| 61 | G4bool operator==(const G4QPDGCode& rhs) const; |
---|
| 62 | G4bool operator==(const G4int& rhs) const; |
---|
| 63 | G4bool operator!=(const G4QPDGCode& rhs) const; |
---|
| 64 | G4bool operator!=(const G4int& rhs) const; |
---|
| 65 | G4QPDGCode operator+=(const G4int& rhs); |
---|
| 66 | G4QPDGCode operator+=(const G4QPDGCode& rhs); |
---|
| 67 | G4QPDGCode operator-=(const G4int& rhs); |
---|
| 68 | G4QPDGCode operator-=(const G4QPDGCode& rhs); |
---|
| 69 | G4QPDGCode operator*=(const G4int& rhs); |
---|
| 70 | G4QPDGCode operator/=(const G4int& rhs); |
---|
| 71 | |
---|
| 72 | // Selectors |
---|
| 73 | G4int GetNQHadr(); // Return # of predefined hadrons |
---|
| 74 | G4double GetMass(); // GS Mass for the QHadron |
---|
| 75 | G4double GetMass2(); // Squared GS Mass for the QHadron |
---|
| 76 | G4double GetWidth(); // Width for the QHadron |
---|
| 77 | G4double GetNuclMass(G4int Z, G4int N, G4int S); // Wrapper forNuclearMassCalculation |
---|
| 78 | G4double GetNuclMass(G4int PDGCode); // Wrapper forNuclearMassCalculation |
---|
| 79 | G4QContent GetQuarkContent() const; // Get QC for the particle |
---|
| 80 | G4int GetBaryNum() const; // Get Baryon Number of the Hadron |
---|
| 81 | G4int GetSpin() const; // Returns 2s+1 for hadrons, 1 for A |
---|
| 82 | G4int GetCharge() const; // Get Charge of the Hadron |
---|
| 83 | G4int GetPDGCode() const; // Get PDG code of the Hadron |
---|
| 84 | G4int GetQCode() const; // Get Q code of the Hadron |
---|
| 85 | G4QContent GetExQContent(G4int i, G4int o) const; // Get Q Content for Quark Exchange |
---|
| 86 | G4int GetRelCrossIndex(G4int i, G4int o) const; // Relative Cross Index for q_i->q_o |
---|
| 87 | G4int GetNumOfComb(G4int i, G4int o) const; // Get #ofCombinations for q_i->q_o |
---|
| 88 | G4int GetTotNumOfComb(G4int i) const; // Get total#ofCombinations for q_i |
---|
| 89 | |
---|
| 90 | // Modifiers |
---|
| 91 | void SetPDGCode(G4int newPDGCode); // Set PDG code of the Hadron |
---|
| 92 | void InitByQCont(G4QContent QCont); // Init ExistingQPDG by QuarkContent |
---|
| 93 | void InitByQCode(G4int QCode); // Init ExistingQPDG by Q Code |
---|
| 94 | |
---|
| 95 | // General |
---|
| 96 | G4bool TestRealNeutral(); |
---|
| 97 | void NegPDGCode(); |
---|
| 98 | void ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s); |
---|
| 99 | |
---|
| 100 | private: |
---|
| 101 | // Encapsulated functions |
---|
| 102 | G4bool TestRealNeutral(const G4int& PDGCode); |
---|
| 103 | G4int MakeQCode(const G4int& PDGCode); // Make Q Code, using PDG Code |
---|
| 104 | G4int MakePDGCode(const G4int& QCode); // Make PDG Code, using Q Code |
---|
| 105 | G4double CalculateNuclMass(G4int Z, G4int N, G4int S); // Nuclear Mass Calculation |
---|
| 106 | G4double QHaM(G4int nQ); // Definition of hadronic masses in Q-order |
---|
| 107 | private: |
---|
| 108 | // Static parameter |
---|
| 109 | static const G4int nQHM=90; |
---|
| 110 | // the Body |
---|
| 111 | G4int thePDGCode; |
---|
| 112 | G4int theQCode; |
---|
| 113 | }; |
---|
| 114 | |
---|
| 115 | // Not member operators |
---|
| 116 | std::ostream& operator<<(std::ostream& lhs, G4QPDGCode& rhs); |
---|
| 117 | std::ostream& operator<<(std::ostream& lhs, const G4QPDGCode& rhs); |
---|
| 118 | G4int operator+(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
| 119 | G4int operator+(const G4QPDGCode& lhs, const G4int& rhs); |
---|
| 120 | G4int operator+(const G4int& lhs, const G4QPDGCode& rhs); |
---|
| 121 | G4int operator-(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
| 122 | G4int operator-(const G4QPDGCode& lhs, const G4int& rhs); |
---|
| 123 | G4int operator-(const G4int& lhs, const G4QPDGCode& rhs); |
---|
| 124 | G4int operator*(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
| 125 | G4int operator*(const G4QPDGCode& lhs, const G4int& rhs); |
---|
| 126 | G4int operator*(const G4int& lhs, const G4QPDGCode& rhs); |
---|
| 127 | G4int operator/(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
| 128 | G4int operator/(const G4QPDGCode& lhs, const G4int& rhs); |
---|
| 129 | G4int operator/(const G4int& lhs, const G4QPDGCode& rhs); |
---|
| 130 | G4int operator%(const G4QPDGCode& lhs, const G4int& rhs); |
---|
| 131 | // Not member functions |
---|
| 132 | //---------------------------------------------------------------------------------------- |
---|
| 133 | |
---|
| 134 | inline G4bool G4QPDGCode::operator==(const G4QPDGCode& rhs) const {return this==&rhs;} |
---|
| 135 | inline G4bool G4QPDGCode::operator==(const G4int& rhs) const {return thePDGCode==rhs;} |
---|
| 136 | inline G4bool G4QPDGCode::operator!=(const G4QPDGCode& rhs) const {return this!=&rhs;} |
---|
| 137 | inline G4bool G4QPDGCode::operator!=(const G4int& rhs) const {return thePDGCode!=rhs;} |
---|
| 138 | |
---|
| 139 | inline G4int G4QPDGCode::GetNQHadr() {return nQHM;} // Return # of predefined hadrons |
---|
| 140 | |
---|
| 141 | inline G4QPDGCode G4QPDGCode::operator+=(const G4QPDGCode& rhs) |
---|
| 142 | { |
---|
| 143 | thePDGCode+=rhs.GetPDGCode(); |
---|
| 144 | if(!thePDGCode) theQCode = -2; |
---|
| 145 | else theQCode = MakeQCode(thePDGCode); |
---|
| 146 | return *this; |
---|
| 147 | } |
---|
| 148 | inline G4QPDGCode G4QPDGCode::operator+=(const G4int& rhs) |
---|
| 149 | { |
---|
| 150 | thePDGCode+=rhs; |
---|
| 151 | if(!thePDGCode) theQCode = -2; |
---|
| 152 | else theQCode = MakeQCode(thePDGCode); |
---|
| 153 | return *this; |
---|
| 154 | } |
---|
| 155 | inline G4QPDGCode G4QPDGCode::operator-=(const G4QPDGCode& rhs) |
---|
| 156 | { |
---|
| 157 | thePDGCode-=rhs.GetPDGCode(); |
---|
| 158 | if(!thePDGCode) theQCode = -2; |
---|
| 159 | else theQCode = MakeQCode(thePDGCode); |
---|
| 160 | return *this; |
---|
| 161 | } |
---|
| 162 | inline G4QPDGCode G4QPDGCode::operator-=(const G4int& rhs) |
---|
| 163 | { |
---|
| 164 | thePDGCode-=rhs; |
---|
| 165 | if(!thePDGCode) theQCode = -2; |
---|
| 166 | else theQCode = MakeQCode(thePDGCode); |
---|
| 167 | return *this; |
---|
| 168 | } |
---|
| 169 | inline G4QPDGCode G4QPDGCode::operator*=(const G4int& rhs) |
---|
| 170 | { |
---|
| 171 | thePDGCode*=rhs; |
---|
| 172 | if(!thePDGCode) theQCode = -2; |
---|
| 173 | else theQCode = MakeQCode(thePDGCode); |
---|
| 174 | return *this; |
---|
| 175 | } |
---|
| 176 | inline G4QPDGCode G4QPDGCode::operator/=(const G4int& rhs) |
---|
| 177 | { |
---|
| 178 | thePDGCode/=rhs; |
---|
| 179 | if(!thePDGCode) theQCode = -2; |
---|
| 180 | else theQCode = MakeQCode(thePDGCode); |
---|
| 181 | return *this; |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | inline G4double G4QPDGCode::GetMass2() {G4double m=GetMass(); return m*m;} |
---|
| 185 | inline G4double G4QPDGCode::GetNuclMass(G4int PDG) |
---|
| 186 | { |
---|
| 187 | if(PDG>80000000) |
---|
| 188 | { |
---|
| 189 | G4int szn=PDG-90000000; |
---|
| 190 | G4int ds=0; |
---|
| 191 | G4int dz=0; |
---|
| 192 | G4int dn=0; |
---|
| 193 | if(szn<-100000) |
---|
| 194 | { |
---|
| 195 | G4int ns=(-szn)/1000000+1; |
---|
| 196 | szn+=ns*1000000; |
---|
| 197 | ds+=ns; |
---|
| 198 | } |
---|
| 199 | else if(szn<-100) |
---|
| 200 | { |
---|
| 201 | G4int nz=(-szn)/1000+1; |
---|
| 202 | szn+=nz*1000; |
---|
| 203 | dz+=nz; |
---|
| 204 | } |
---|
| 205 | else if(szn<0) |
---|
| 206 | { |
---|
| 207 | G4int nn=-szn; |
---|
| 208 | szn=0; |
---|
| 209 | dn+=nn; |
---|
| 210 | } |
---|
| 211 | G4int sz =szn/1000; |
---|
| 212 | G4int n =szn%1000; |
---|
| 213 | if(n>700) |
---|
| 214 | { |
---|
| 215 | n-=1000; |
---|
| 216 | dz--; |
---|
| 217 | } |
---|
| 218 | G4int z =sz%1000-dz; |
---|
| 219 | if(z>700) |
---|
| 220 | { |
---|
| 221 | z-=1000; |
---|
| 222 | ds--; |
---|
| 223 | } |
---|
| 224 | G4int s =sz/1000-ds; |
---|
| 225 | return GetNuclMass(z,n,s); |
---|
| 226 | } |
---|
| 227 | return 0.; |
---|
| 228 | } |
---|
| 229 | inline G4int G4QPDGCode::GetPDGCode() const {return thePDGCode;} |
---|
| 230 | inline G4int G4QPDGCode::GetQCode() const {return theQCode;} |
---|
| 231 | inline G4int G4QPDGCode::GetCharge() const {return GetQuarkContent().GetCharge();} |
---|
| 232 | inline G4int G4QPDGCode::GetBaryNum() const {return GetQuarkContent().GetBaryonNumber();} |
---|
| 233 | inline G4int G4QPDGCode::GetSpin() const |
---|
| 234 | { |
---|
| 235 | if(thePDGCode<80000000) return thePDGCode%10; |
---|
| 236 | else if(GetQuarkContent().GetTot()%2) return 3; // @@ Take into account higher resonances |
---|
| 237 | else return 1; |
---|
| 238 | } |
---|
| 239 | inline void G4QPDGCode::NegPDGCode() {thePDGCode=-thePDGCode;} |
---|
| 240 | inline G4bool G4QPDGCode::TestRealNeutral(){return TestRealNeutral(thePDGCode);} |
---|
| 241 | |
---|
| 242 | // Redefinition of the PDG instance |
---|
| 243 | inline void G4QPDGCode::SetPDGCode(G4int newPDGCode) |
---|
| 244 | // ======================================== |
---|
| 245 | { |
---|
| 246 | thePDGCode=newPDGCode; |
---|
| 247 | if(!thePDGCode) theQCode = -2; |
---|
| 248 | else theQCode = MakeQCode(newPDGCode); |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | // Init existing QPDG by Quark Content |
---|
| 252 | inline void G4QPDGCode::InitByQCont(G4QContent QCont) |
---|
| 253 | {// ========================================= |
---|
| 254 | thePDGCode = QCont.GetSPDGCode(); |
---|
| 255 | if(!thePDGCode) theQCode = -2; |
---|
| 256 | else theQCode = MakeQCode(thePDGCode); |
---|
| 257 | } |
---|
| 258 | |
---|
| 259 | // Init existing QPDG by Quark Content |
---|
| 260 | inline void G4QPDGCode::InitByQCode(G4int QCode) |
---|
| 261 | {// ==================================== |
---|
| 262 | theQCode = QCode; |
---|
| 263 | thePDGCode = MakePDGCode(QCode); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | #endif |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | |
---|