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: G4QContent.hh,v 1.28 2006/06/29 20:06:05 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // ---------------- G4QContent ---------------- |
---|
31 | // by Mikhail Kossov, Sept 1999. |
---|
32 | // class header for Quasmon initiated Contents used by the CHIPS Model |
---|
33 | // ---------------------------------------------------------------------- |
---|
34 | |
---|
35 | #ifndef G4QContent_h |
---|
36 | #define G4QContent_h 1 |
---|
37 | |
---|
38 | #include <iostream> |
---|
39 | #include "globals.hh" |
---|
40 | #include "Randomize.hh" |
---|
41 | #include "G4QException.hh" |
---|
42 | |
---|
43 | class G4QContent |
---|
44 | { |
---|
45 | public: |
---|
46 | G4QContent(G4int d=0, G4int u=0, G4int s=0, G4int ad=0, G4int au=0, G4int as=0); |
---|
47 | G4QContent(const G4QContent& rhs); // Copy constructor by value |
---|
48 | G4QContent(G4QContent* rhs); // Copy constructor by pointer |
---|
49 | |
---|
50 | ~G4QContent(); // Public Destructor |
---|
51 | |
---|
52 | // Overloaded operators |
---|
53 | const G4QContent& operator=(const G4QContent& rhs); |
---|
54 | G4bool operator==(const G4QContent& rhs) const; |
---|
55 | G4bool operator!=(const G4QContent& rhs) const; |
---|
56 | G4QContent operator+=(G4QContent& rhs); |
---|
57 | G4QContent operator-=(G4QContent& rhs); |
---|
58 | G4QContent operator*=(G4int& rhs); |
---|
59 | G4QContent operator+=(const G4QContent& rhs); |
---|
60 | G4QContent operator-=(const G4QContent& rhs); |
---|
61 | G4QContent operator*=(const G4int& rhs); |
---|
62 | |
---|
63 | // Selectors |
---|
64 | G4int GetCharge() const; |
---|
65 | G4int GetBaryonNumber() const; |
---|
66 | G4int GetStrangeness() const; |
---|
67 | G4int GetSPDGCode() const; |
---|
68 | G4int GetZNSPDGCode() const; |
---|
69 | G4int NOfCombinations(const G4QContent& rhs) const;//@@ can be an "operator/" |
---|
70 | G4int GetQ() const; |
---|
71 | G4int GetAQ() const; |
---|
72 | G4int GetTot() const; |
---|
73 | G4bool CheckNegative() const; |
---|
74 | |
---|
75 | G4int GetP() const; // A#of protons |
---|
76 | G4int GetN() const; // A#of neutrons |
---|
77 | G4int GetL() const; // A#of lambdas |
---|
78 | G4int GetAP() const; // A#of anti-protons |
---|
79 | G4int GetAN() const; // A#of anti-neutrons |
---|
80 | G4int GetAL() const; // A#of anti-lambdas |
---|
81 | |
---|
82 | G4int GetD() const; // A#of d-quarks |
---|
83 | G4int GetU() const; // A#of u-quarks |
---|
84 | G4int GetS() const; // A#of s-quarks |
---|
85 | G4int GetAD() const; // A#of anti-d-quarks |
---|
86 | G4int GetAU() const; // A#of anti-u-quarks |
---|
87 | G4int GetAS() const; // A#of anti-s-quarks |
---|
88 | |
---|
89 | G4int GetNetD() const; // A net#of d-quarks |
---|
90 | G4int GetNetU() const; // A net#of u-quarks |
---|
91 | G4int GetNetS() const; // A net#of s-quarks |
---|
92 | G4int GetNetAD() const; // A net#of anti-d-quarks |
---|
93 | G4int GetNetAU() const; // A net#of anti-u-quarks |
---|
94 | G4int GetNetAS() const; // A net#of anti-s-quarks |
---|
95 | |
---|
96 | G4int GetDD() const; // A#of dd-di-quarks |
---|
97 | G4int GetUU() const; // A#of uu-di-quarks |
---|
98 | G4int GetSS() const; // A#of ss-di-quarks |
---|
99 | G4int GetUD() const; // A#of ud-di-quarks |
---|
100 | G4int GetDS() const; // A#of ds-di-quarks |
---|
101 | G4int GetUS() const; // A#of us-di-quarks |
---|
102 | G4int GetADAD() const; // A#of anti-dd-di-quarks |
---|
103 | G4int GetAUAU() const; // A#of anti-uu-di-quarks |
---|
104 | G4int GetASAS() const; // A#of anti-ss-di-quarks |
---|
105 | G4int GetAUAD() const; // A#of anti-ud-di-quarks |
---|
106 | G4int GetADAS() const; // A#of anti-ds-di-quarks |
---|
107 | G4int GetAUAS() const; // A#of anti-us-di-quarks |
---|
108 | |
---|
109 | // Modifiers |
---|
110 | void Anti(); |
---|
111 | G4QContent IndQ (G4int ind=0); |
---|
112 | G4QContent IndAQ(G4int ind=0); |
---|
113 | G4QContent SplitChipo(G4double mQ); |
---|
114 | G4bool SubtractHadron(G4QContent h); |
---|
115 | G4bool SubtractPi0(); |
---|
116 | G4bool SubtractPion(); |
---|
117 | G4bool SubtractKaon(G4double mQ); |
---|
118 | |
---|
119 | void SetD (G4int n=0); |
---|
120 | void SetU (G4int n=0); |
---|
121 | void SetS (G4int n=0); |
---|
122 | void SetAD(G4int n=0); |
---|
123 | void SetAU(G4int n=0); |
---|
124 | void SetAS(G4int n=0); |
---|
125 | |
---|
126 | void IncD (G4int n=1); |
---|
127 | void IncU (G4int n=1); |
---|
128 | void IncS (G4int n=1); |
---|
129 | void IncAD(G4int n=1); |
---|
130 | void IncAU(G4int n=1); |
---|
131 | void IncAS(G4int n=1); |
---|
132 | void IncQAQ(const G4int& nQAQ=1, const G4double& sProb = 1.); |
---|
133 | |
---|
134 | void DecD (G4int n=1); |
---|
135 | void DecU (G4int n=1); |
---|
136 | void DecS (G4int n=1); |
---|
137 | void DecAD(G4int n=1); |
---|
138 | void DecAU(G4int n=1); |
---|
139 | void DecAS(G4int n=1); |
---|
140 | G4int DecQAQ(const G4int& nQAQ=1); |
---|
141 | |
---|
142 | private: |
---|
143 | G4QContent GetThis() const; |
---|
144 | |
---|
145 | // Body |
---|
146 | private: // C S |
---|
147 | G4int nD; // a#of d-quarks (-1/3)( 0) |
---|
148 | G4int nU; // a#of u-quarks (+2/3)( 0) |
---|
149 | G4int nS; // a#of s-quarks (-1/3)(+1) |
---|
150 | G4int nAD; // a#of anti-d-quarks (+1/3)( 0) |
---|
151 | G4int nAU; // a#of anti-u-quarks (-2/3)( 0) |
---|
152 | G4int nAS; // a#of anti-s-quarks (+1/3)(-1) |
---|
153 | }; |
---|
154 | |
---|
155 | // Not member operators |
---|
156 | std::ostream& operator<<(std::ostream& lhs, G4QContent& rhs); |
---|
157 | std::ostream& operator<<(std::ostream& lhs, const G4QContent& rhs); |
---|
158 | G4QContent operator+(const G4QContent& lhs, const G4QContent& rhs); |
---|
159 | G4QContent operator-(const G4QContent& lhs, const G4QContent& rhs); |
---|
160 | G4QContent operator*(const G4QContent& lhs, const G4int& rhs); |
---|
161 | G4QContent operator*(const G4int& lhs, const G4QContent& rhs); |
---|
162 | //G4int operator/(const G4QContent& lhs, const G4QContent& rhs); // Combinations |
---|
163 | // Not member functions |
---|
164 | //---------------------------------------------------------------------------------------- |
---|
165 | |
---|
166 | inline G4bool G4QContent::operator==(const G4QContent& rhs) const {return this==&rhs;} |
---|
167 | inline G4bool G4QContent::operator!=(const G4QContent& rhs) const {return this!=&rhs;} |
---|
168 | inline G4int G4QContent::GetQ() const {return nU+nD+nS;} |
---|
169 | inline G4int G4QContent::GetAQ() const {return nAU+nAD+nAS;} |
---|
170 | inline G4int G4QContent::GetTot() const {return nU+nD+nS+nAU+nAD+nAS;} |
---|
171 | inline G4int G4QContent::GetStrangeness() const {return nS-nAS;} |
---|
172 | // @@ Temporary for tests |
---|
173 | inline G4bool G4QContent::CheckNegative() const |
---|
174 | {return nU<0||nD<0||nS<0||nAU<0||nAD<0||nAS<0;} |
---|
175 | |
---|
176 | inline G4int G4QContent::GetU() const{return nU;} |
---|
177 | inline G4int G4QContent::GetD() const{return nD;} |
---|
178 | inline G4int G4QContent::GetS() const{return nS;} |
---|
179 | inline G4int G4QContent::GetAU() const{return nAU;} |
---|
180 | inline G4int G4QContent::GetAD() const{return nAD;} |
---|
181 | inline G4int G4QContent::GetAS() const{return nAS;} |
---|
182 | |
---|
183 | inline G4int G4QContent::GetNetU() const{return nU-nAU;} |
---|
184 | inline G4int G4QContent::GetNetD() const{return nD-nAD;} |
---|
185 | inline G4int G4QContent::GetNetS() const{return nS-nAS;} |
---|
186 | inline G4int G4QContent::GetNetAU() const{return nAU-nU;} |
---|
187 | inline G4int G4QContent::GetNetAD() const{return nAD-nD;} |
---|
188 | inline G4int G4QContent::GetNetAS() const{return nAS-nS;} |
---|
189 | |
---|
190 | inline G4int G4QContent::GetUU() const{return nU*(nU-1)/2;} |
---|
191 | inline G4int G4QContent::GetDD() const{return nD*(nD-1)/2;} |
---|
192 | inline G4int G4QContent::GetSS() const{return nS*(nS-1)/2;} |
---|
193 | inline G4int G4QContent::GetUD() const{return nU*nD;} |
---|
194 | inline G4int G4QContent::GetUS() const{return nU*nS;} |
---|
195 | inline G4int G4QContent::GetDS() const{return nD*nS;} |
---|
196 | inline G4int G4QContent::GetAUAU() const{return nAU*(nAU-1)/2;} |
---|
197 | inline G4int G4QContent::GetADAD() const{return nAD*(nAD-1)/2;} |
---|
198 | inline G4int G4QContent::GetASAS() const{return nAS*(nAS-1)/2;} |
---|
199 | inline G4int G4QContent::GetAUAD() const{return nAU*nAD;} |
---|
200 | inline G4int G4QContent::GetAUAS() const{return nAU*nAS;} |
---|
201 | inline G4int G4QContent::GetADAS() const{return nAD*nAS;} |
---|
202 | |
---|
203 | // Convert particle to anti-particle |
---|
204 | inline G4int G4QContent::GetZNSPDGCode() const |
---|
205 | { |
---|
206 | G4int kD=nD-nAD; // A net # of d quarks |
---|
207 | G4int kU=nU-nAU; // A net # of u quarks |
---|
208 | G4int kS=nS-nAS; // A net # of s quarks |
---|
209 | // if(kD>=0&&kU>=0&&kS>=0&&kD+kU+kS>0) // => "Normal nucleus" case |
---|
210 | //{ |
---|
211 | // G4int b=(kU+kD-kS-kS)/3; |
---|
212 | // G4int d=kU-kD; |
---|
213 | // G4int n=(b-d)/2; |
---|
214 | // return 90000000+1000*(1000*kS+n+d)+n; |
---|
215 | //} |
---|
216 | //else if(kD<=0&&kU<=0&&kS<=0&&kD+kU+kS<0) // => "Normal anti-nucleus" case |
---|
217 | //{ |
---|
218 | // G4int b=(kS+kS-kD-kU)/3; |
---|
219 | // G4int d=kD-kU; |
---|
220 | // G4int n=(b-d)/2; |
---|
221 | // return -90000000-1000*(1000*kS+n+d)-n; // @@ double notation for anti-nuclei |
---|
222 | //} |
---|
223 | //else |
---|
224 | //{ |
---|
225 | G4int b=(kU+kD-kS-kS)/3; // Baryon number-n*{LAMBDA=kS) |
---|
226 | if(!b && !kS) return GetSPDGCode(); // Not a nucleus |
---|
227 | G4int d=kU-kD; // Isotopic shift |
---|
228 | G4int n=(b-d)/2; // A#of neutrons |
---|
229 | return 90000000+1000*(1000*kS+n+d)+n; |
---|
230 | //} |
---|
231 | //return 0; |
---|
232 | } |
---|
233 | |
---|
234 | // Convert particle to anti-particle |
---|
235 | inline void G4QContent::Anti() |
---|
236 | { |
---|
237 | G4int r=nD; |
---|
238 | nD = nAD; |
---|
239 | nAD= r; |
---|
240 | r = nU; |
---|
241 | nU = nAU; |
---|
242 | nAU= r; |
---|
243 | r = nS; |
---|
244 | nS = nAS; |
---|
245 | nAS= r; |
---|
246 | } |
---|
247 | |
---|
248 | // Add Quark Content |
---|
249 | inline G4QContent G4QContent::operator+=(const G4QContent& rhs) |
---|
250 | // ======================================================= |
---|
251 | { |
---|
252 | nD += rhs.nD; |
---|
253 | nU += rhs.nU; |
---|
254 | nS += rhs.nS; |
---|
255 | nAD+= rhs.nAD; |
---|
256 | nAU+= rhs.nAU; |
---|
257 | nAS+= rhs.nAS; |
---|
258 | return *this; |
---|
259 | } |
---|
260 | |
---|
261 | // Add Quark Content |
---|
262 | inline G4QContent G4QContent::operator+=(G4QContent& rhs) |
---|
263 | // ======================================================= |
---|
264 | { |
---|
265 | nD += rhs.nD; |
---|
266 | nU += rhs.nU; |
---|
267 | nS += rhs.nS; |
---|
268 | nAD+= rhs.nAD; |
---|
269 | nAU+= rhs.nAU; |
---|
270 | nAS+= rhs.nAS; |
---|
271 | return *this; |
---|
272 | } |
---|
273 | |
---|
274 | // Multiply Quark Content by integer number |
---|
275 | inline G4QContent G4QContent::operator*=(const G4int& rhs) |
---|
276 | // =================================================== |
---|
277 | { |
---|
278 | nU *= rhs; |
---|
279 | nD *= rhs; |
---|
280 | nS *= rhs; |
---|
281 | nAU*= rhs; |
---|
282 | nAD*= rhs; |
---|
283 | nAS*= rhs; |
---|
284 | return *this; |
---|
285 | } |
---|
286 | |
---|
287 | // Multiply Quark Content by integer number |
---|
288 | inline G4QContent G4QContent::operator*=(G4int& rhs) |
---|
289 | // =================================================== |
---|
290 | { |
---|
291 | nU *= rhs; |
---|
292 | nD *= rhs; |
---|
293 | nS *= rhs; |
---|
294 | nAU*= rhs; |
---|
295 | nAD*= rhs; |
---|
296 | nAS*= rhs; |
---|
297 | return *this; |
---|
298 | } |
---|
299 | |
---|
300 | inline void G4QContent::SetU(G4int n) {nU=n;} |
---|
301 | inline void G4QContent::SetD(G4int n) {nD=n;} |
---|
302 | inline void G4QContent::SetS(G4int n) {nS=n;} |
---|
303 | inline void G4QContent::SetAU(G4int n){nAU=n;} |
---|
304 | inline void G4QContent::SetAD(G4int n){nAD=n;} |
---|
305 | inline void G4QContent::SetAS(G4int n){nAS=n;} |
---|
306 | |
---|
307 | inline void G4QContent::IncU(G4int n) {nU+=n;} |
---|
308 | inline void G4QContent::IncD(G4int n) {nD+=n;} |
---|
309 | inline void G4QContent::IncS(G4int n) {nS+=n;} |
---|
310 | inline void G4QContent::IncAU(G4int n){nAU+=n;} |
---|
311 | inline void G4QContent::IncAD(G4int n){nAD+=n;} |
---|
312 | inline void G4QContent::IncAS(G4int n){nAS+=n;} |
---|
313 | |
---|
314 | inline void G4QContent::DecU(G4int n) {nU-=n;} |
---|
315 | inline void G4QContent::DecD(G4int n) {nD-=n;} |
---|
316 | inline void G4QContent::DecS(G4int n) {nS-=n;} |
---|
317 | inline void G4QContent::DecAU(G4int n){nAU-=n;} |
---|
318 | inline void G4QContent::DecAD(G4int n){nAD-=n;} |
---|
319 | inline void G4QContent::DecAS(G4int n){nAS-=n;} |
---|
320 | |
---|
321 | // Private member functions |
---|
322 | inline G4QContent G4QContent::GetThis()const{return G4QContent(nD,nU,nS,nAD,nAU,nAS);} |
---|
323 | #endif |
---|