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