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.30 2009/11/04 11:01:59 mkossov Exp $ |
---|
28 | // GEANT4 tag $Name: hadr-chips-V09-03-08 $ |
---|
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 | // Geant4 particles for consistency of masses only |
---|
48 | // Leptons |
---|
49 | #include "G4MuonPlus.hh" |
---|
50 | #include "G4MuonMinus.hh" |
---|
51 | #include "G4TauMinus.hh" |
---|
52 | #include "G4TauPlus.hh" |
---|
53 | #include "G4Electron.hh" |
---|
54 | #include "G4Positron.hh" |
---|
55 | #include "G4NeutrinoTau.hh" |
---|
56 | #include "G4AntiNeutrinoTau.hh" |
---|
57 | #include "G4NeutrinoMu.hh" |
---|
58 | #include "G4AntiNeutrinoMu.hh" |
---|
59 | #include "G4NeutrinoE.hh" |
---|
60 | #include "G4AntiNeutrinoE.hh" |
---|
61 | // Mesons |
---|
62 | #include "G4PionPlus.hh" |
---|
63 | #include "G4PionMinus.hh" |
---|
64 | #include "G4PionZero.hh" |
---|
65 | #include "G4Eta.hh" |
---|
66 | #include "G4EtaPrime.hh" |
---|
67 | |
---|
68 | #include "G4KaonPlus.hh" |
---|
69 | #include "G4KaonMinus.hh" |
---|
70 | #include "G4KaonZero.hh" |
---|
71 | #include "G4AntiKaonZero.hh" |
---|
72 | #include "G4KaonZeroLong.hh" |
---|
73 | #include "G4KaonZeroShort.hh" |
---|
74 | |
---|
75 | #include "G4DMesonPlus.hh" |
---|
76 | #include "G4DMesonMinus.hh" |
---|
77 | #include "G4DMesonZero.hh" |
---|
78 | #include "G4AntiDMesonZero.hh" |
---|
79 | #include "G4DsMesonPlus.hh" |
---|
80 | #include "G4DsMesonMinus.hh" |
---|
81 | #include "G4JPsi.hh" |
---|
82 | |
---|
83 | #include "G4BMesonPlus.hh" |
---|
84 | #include "G4BMesonMinus.hh" |
---|
85 | #include "G4BMesonZero.hh" |
---|
86 | #include "G4AntiBMesonZero.hh" |
---|
87 | #include "G4BsMesonZero.hh" |
---|
88 | #include "G4AntiBsMesonZero.hh" |
---|
89 | |
---|
90 | |
---|
91 | // Barions |
---|
92 | #include "G4Proton.hh" |
---|
93 | #include "G4AntiProton.hh" |
---|
94 | #include "G4Neutron.hh" |
---|
95 | #include "G4AntiNeutron.hh" |
---|
96 | |
---|
97 | #include "G4Lambda.hh" |
---|
98 | #include "G4SigmaPlus.hh" |
---|
99 | #include "G4SigmaZero.hh" |
---|
100 | #include "G4SigmaMinus.hh" |
---|
101 | #include "G4XiMinus.hh" |
---|
102 | #include "G4XiZero.hh" |
---|
103 | #include "G4OmegaMinus.hh" |
---|
104 | |
---|
105 | #include "G4AntiLambda.hh" |
---|
106 | #include "G4AntiSigmaPlus.hh" |
---|
107 | #include "G4AntiSigmaZero.hh" |
---|
108 | #include "G4AntiSigmaMinus.hh" |
---|
109 | #include "G4AntiXiMinus.hh" |
---|
110 | #include "G4AntiXiZero.hh" |
---|
111 | #include "G4AntiOmegaMinus.hh" |
---|
112 | |
---|
113 | #include "G4LambdacPlus.hh" |
---|
114 | #include "G4SigmacPlusPlus.hh" |
---|
115 | #include "G4SigmacPlus.hh" |
---|
116 | #include "G4SigmacZero.hh" |
---|
117 | #include "G4XicPlus.hh" |
---|
118 | #include "G4XicZero.hh" |
---|
119 | #include "G4OmegacZero.hh" |
---|
120 | |
---|
121 | #include "G4AntiLambdacPlus.hh" |
---|
122 | #include "G4AntiSigmacPlusPlus.hh" |
---|
123 | #include "G4AntiSigmacPlus.hh" |
---|
124 | #include "G4AntiSigmacZero.hh" |
---|
125 | #include "G4AntiXicPlus.hh" |
---|
126 | #include "G4AntiXicZero.hh" |
---|
127 | #include "G4AntiOmegacZero.hh" |
---|
128 | |
---|
129 | // Nuclei |
---|
130 | #include "G4Alpha.hh" |
---|
131 | #include "G4Deuteron.hh" |
---|
132 | #include "G4He3.hh" |
---|
133 | #include "G4Triton.hh" |
---|
134 | |
---|
135 | //ions |
---|
136 | #include "G4GenericIon.hh" |
---|
137 | #include "G4NucleiProperties.hh" |
---|
138 | // --- End of consistency headers --- |
---|
139 | |
---|
140 | #include "G4QContent.hh" |
---|
141 | |
---|
142 | class G4QPDGCode |
---|
143 | { |
---|
144 | public: |
---|
145 | // Constructors |
---|
146 | G4QPDGCode(G4int PDGCode = 0); // Construction by PDGCode |
---|
147 | G4QPDGCode(G4bool f, G4int QCode); // Construction by QCode, f-verb |
---|
148 | G4QPDGCode(G4QContent QCont); // Construction by Quark Content |
---|
149 | G4QPDGCode(const G4QPDGCode& rhs); // Copy Constructor by value |
---|
150 | G4QPDGCode(G4QPDGCode* rhs); // Copy Constructor by pointer |
---|
151 | |
---|
152 | ~G4QPDGCode(); // Public Destructor |
---|
153 | |
---|
154 | // Operators |
---|
155 | const G4QPDGCode& operator=(const G4QPDGCode& rhs); |
---|
156 | G4bool operator==(const G4QPDGCode& rhs) const; |
---|
157 | G4bool operator==(const G4int& rhs) const; |
---|
158 | G4bool operator!=(const G4QPDGCode& rhs) const; |
---|
159 | G4bool operator!=(const G4int& rhs) const; |
---|
160 | G4QPDGCode operator+=(const G4int& rhs); |
---|
161 | G4QPDGCode operator+=(const G4QPDGCode& rhs); |
---|
162 | G4QPDGCode operator-=(const G4int& rhs); |
---|
163 | G4QPDGCode operator-=(const G4QPDGCode& rhs); |
---|
164 | G4QPDGCode operator*=(const G4int& rhs); |
---|
165 | G4QPDGCode operator/=(const G4int& rhs); |
---|
166 | |
---|
167 | // Selectors |
---|
168 | G4int GetNQHadr(); // Return # of predefined hadrons |
---|
169 | G4double GetMass(); // GS Mass for the QHadron |
---|
170 | G4double GetMass2(); // Squared GS Mass for the QHadron |
---|
171 | G4double GetWidth(); // Width for the QHadron |
---|
172 | G4double GetNuclMass(G4int Z, G4int N, G4int S); // Wrapper forNuclearMassCalculation |
---|
173 | G4double GetNuclMass(G4int PDGCode); // Wrapper forNuclearMassCalculation |
---|
174 | G4QContent GetQuarkContent() const; // Get QC for the particle |
---|
175 | G4int GetBaryNum() const; // Get Baryon Number of the Hadron |
---|
176 | G4int GetSpin() const; // Returns 2s+1 for hadrons, 1 for A |
---|
177 | G4int GetCharge() const; // Get Charge of the Hadron |
---|
178 | G4int GetPDGCode() const; // Get PDG code of the Hadron |
---|
179 | G4int GetQCode() const; // Get Q code of the Hadron |
---|
180 | G4QContent GetExQContent(G4int i, G4int o) const; // Get Q Content for Quark Exchange |
---|
181 | G4int GetRelCrossIndex(G4int i, G4int o) const; // Relative Cross Index for q_i->q_o |
---|
182 | G4int GetNumOfComb(G4int i, G4int o) const; // Get #ofCombinations for q_i->q_o |
---|
183 | G4int GetTotNumOfComb(G4int i) const; // Get total#ofCombinations for q_i |
---|
184 | |
---|
185 | // Modifiers |
---|
186 | void SetPDGCode(G4int newPDGCode); // Set PDG code of the Hadron |
---|
187 | void InitByQCont(G4QContent QCont); // Init ExistingQPDG by QuarkContent |
---|
188 | void InitByQCode(G4int QCode); // Init ExistingQPDG by Q Code |
---|
189 | |
---|
190 | // General |
---|
191 | G4bool TestRealNeutral(); |
---|
192 | |
---|
193 | void NegPDGCode(); |
---|
194 | void ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s); |
---|
195 | std::pair<G4int,G4int> MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2); |
---|
196 | |
---|
197 | private: |
---|
198 | // Encapsulated functions |
---|
199 | G4bool TestRealNeutral(const G4int& PDGCode); |
---|
200 | G4int MakeQCode(const G4int& PDGCode); // Make Q Code, using PDG Code |
---|
201 | G4int MakePDGCode(const G4int& QCode); // Make PDG Code, using Q Code |
---|
202 | G4double CalculateNuclMass(G4int Z, G4int N, G4int S); // Nuclear Mass Calculation |
---|
203 | G4double QHaM(G4int nQ); // Definition of hadronic masses in Q-order |
---|
204 | private: |
---|
205 | // Static parameter |
---|
206 | static const G4int nQHM=90; |
---|
207 | // the Body |
---|
208 | G4int thePDGCode; |
---|
209 | G4int theQCode; |
---|
210 | }; |
---|
211 | |
---|
212 | // Not member operators |
---|
213 | std::ostream& operator<<(std::ostream& lhs, G4QPDGCode& rhs); |
---|
214 | std::ostream& operator<<(std::ostream& lhs, const G4QPDGCode& rhs); |
---|
215 | G4int operator+(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
216 | G4int operator+(const G4QPDGCode& lhs, const G4int& rhs); |
---|
217 | G4int operator+(const G4int& lhs, const G4QPDGCode& rhs); |
---|
218 | G4int operator-(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
219 | G4int operator-(const G4QPDGCode& lhs, const G4int& rhs); |
---|
220 | G4int operator-(const G4int& lhs, const G4QPDGCode& rhs); |
---|
221 | G4int operator*(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
222 | G4int operator*(const G4QPDGCode& lhs, const G4int& rhs); |
---|
223 | G4int operator*(const G4int& lhs, const G4QPDGCode& rhs); |
---|
224 | G4int operator/(const G4QPDGCode& lhs, const G4QPDGCode& rhs); |
---|
225 | G4int operator/(const G4QPDGCode& lhs, const G4int& rhs); |
---|
226 | G4int operator/(const G4int& lhs, const G4QPDGCode& rhs); |
---|
227 | G4int operator%(const G4QPDGCode& lhs, const G4int& rhs); |
---|
228 | // Not member functions |
---|
229 | //---------------------------------------------------------------------------------------- |
---|
230 | |
---|
231 | inline G4bool G4QPDGCode::operator==(const G4QPDGCode& rhs) const {return this==&rhs;} |
---|
232 | inline G4bool G4QPDGCode::operator==(const G4int& rhs) const {return thePDGCode==rhs;} |
---|
233 | inline G4bool G4QPDGCode::operator!=(const G4QPDGCode& rhs) const {return this!=&rhs;} |
---|
234 | inline G4bool G4QPDGCode::operator!=(const G4int& rhs) const {return thePDGCode!=rhs;} |
---|
235 | |
---|
236 | inline G4int G4QPDGCode::GetNQHadr() {return nQHM;} // Return # of predefined hadrons |
---|
237 | |
---|
238 | inline G4QPDGCode G4QPDGCode::operator+=(const G4QPDGCode& rhs) |
---|
239 | { |
---|
240 | thePDGCode+=rhs.GetPDGCode(); |
---|
241 | if(!thePDGCode) theQCode = -2; |
---|
242 | else theQCode = MakeQCode(thePDGCode); |
---|
243 | return *this; |
---|
244 | } |
---|
245 | inline G4QPDGCode G4QPDGCode::operator+=(const G4int& rhs) |
---|
246 | { |
---|
247 | thePDGCode+=rhs; |
---|
248 | if(!thePDGCode) theQCode = -2; |
---|
249 | else theQCode = MakeQCode(thePDGCode); |
---|
250 | return *this; |
---|
251 | } |
---|
252 | inline G4QPDGCode G4QPDGCode::operator-=(const G4QPDGCode& rhs) |
---|
253 | { |
---|
254 | thePDGCode-=rhs.GetPDGCode(); |
---|
255 | if(!thePDGCode) theQCode = -2; |
---|
256 | else theQCode = MakeQCode(thePDGCode); |
---|
257 | return *this; |
---|
258 | } |
---|
259 | inline G4QPDGCode G4QPDGCode::operator-=(const G4int& rhs) |
---|
260 | { |
---|
261 | thePDGCode-=rhs; |
---|
262 | if(!thePDGCode) theQCode = -2; |
---|
263 | else theQCode = MakeQCode(thePDGCode); |
---|
264 | return *this; |
---|
265 | } |
---|
266 | inline G4QPDGCode G4QPDGCode::operator*=(const G4int& rhs) |
---|
267 | { |
---|
268 | thePDGCode*=rhs; |
---|
269 | if(!thePDGCode) theQCode = -2; |
---|
270 | else theQCode = MakeQCode(thePDGCode); |
---|
271 | return *this; |
---|
272 | } |
---|
273 | inline G4QPDGCode G4QPDGCode::operator/=(const G4int& rhs) |
---|
274 | { |
---|
275 | thePDGCode/=rhs; |
---|
276 | if(!thePDGCode) theQCode = -2; |
---|
277 | else theQCode = MakeQCode(thePDGCode); |
---|
278 | return *this; |
---|
279 | } |
---|
280 | |
---|
281 | inline G4double G4QPDGCode::GetMass2() {G4double m=GetMass(); return m*m;} |
---|
282 | inline G4double G4QPDGCode::GetNuclMass(G4int PDG) |
---|
283 | { |
---|
284 | if(PDG>80000000) |
---|
285 | { |
---|
286 | G4int szn=PDG-90000000; |
---|
287 | G4int ds=0; |
---|
288 | G4int dz=0; |
---|
289 | G4int dn=0; |
---|
290 | if(szn<-100000) |
---|
291 | { |
---|
292 | G4int ns=(-szn)/1000000+1; |
---|
293 | szn+=ns*1000000; |
---|
294 | ds+=ns; |
---|
295 | } |
---|
296 | else if(szn<-100) |
---|
297 | { |
---|
298 | G4int nz=(-szn)/1000+1; |
---|
299 | szn+=nz*1000; |
---|
300 | dz+=nz; |
---|
301 | } |
---|
302 | else if(szn<0) |
---|
303 | { |
---|
304 | G4int nn=-szn; |
---|
305 | szn=0; |
---|
306 | dn+=nn; |
---|
307 | } |
---|
308 | G4int sz =szn/1000; |
---|
309 | G4int n =szn%1000; |
---|
310 | if(n>700) |
---|
311 | { |
---|
312 | n-=1000; |
---|
313 | dz--; |
---|
314 | } |
---|
315 | G4int z =sz%1000-dz; |
---|
316 | if(z>700) |
---|
317 | { |
---|
318 | z-=1000; |
---|
319 | ds--; |
---|
320 | } |
---|
321 | G4int s =sz/1000-ds; |
---|
322 | return GetNuclMass(z,n,s); |
---|
323 | } |
---|
324 | return 0.; |
---|
325 | } |
---|
326 | inline G4int G4QPDGCode::GetPDGCode() const {return thePDGCode;} |
---|
327 | inline G4int G4QPDGCode::GetQCode() const {return theQCode;} |
---|
328 | inline G4int G4QPDGCode::GetCharge() const {return GetQuarkContent().GetCharge();} |
---|
329 | inline G4int G4QPDGCode::GetBaryNum() const {return GetQuarkContent().GetBaryonNumber();} |
---|
330 | inline G4int G4QPDGCode::GetSpin() const |
---|
331 | { |
---|
332 | if(thePDGCode<80000000) return thePDGCode%10; |
---|
333 | else if(GetQuarkContent().GetTot()%2) return 3; // @@ Take into account higher resonances |
---|
334 | else return 1; |
---|
335 | } |
---|
336 | inline void G4QPDGCode::NegPDGCode() {thePDGCode=-thePDGCode;} |
---|
337 | inline G4bool G4QPDGCode::TestRealNeutral(){return TestRealNeutral(thePDGCode);} |
---|
338 | |
---|
339 | // Redefinition of the PDG instance |
---|
340 | inline void G4QPDGCode::SetPDGCode(G4int newPDGCode) |
---|
341 | // ======================================== |
---|
342 | { |
---|
343 | thePDGCode=newPDGCode; |
---|
344 | if(!thePDGCode) theQCode = -2; |
---|
345 | else theQCode = MakeQCode(newPDGCode); |
---|
346 | } |
---|
347 | |
---|
348 | // Init existing QPDG by Quark Content |
---|
349 | inline void G4QPDGCode::InitByQCont(G4QContent QCont) |
---|
350 | {// ========================================= |
---|
351 | thePDGCode = QCont.GetSPDGCode(); |
---|
352 | if(!thePDGCode) theQCode = -2; |
---|
353 | else theQCode = MakeQCode(thePDGCode); |
---|
354 | } |
---|
355 | |
---|
356 | // Init existing QPDG by Quark Content |
---|
357 | inline void G4QPDGCode::InitByQCode(G4int QCode) |
---|
358 | {// ==================================== |
---|
359 | theQCode = QCode; |
---|
360 | thePDGCode = MakePDGCode(QCode); |
---|
361 | } |
---|
362 | |
---|
363 | #endif |
---|