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: G4ParticleDefinition.cc,v 1.30 2007/11/14 02:22:08 kurasige Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // |
---|
31 | // -------------------------------------------------------------- |
---|
32 | // GEANT 4 class implementation file |
---|
33 | // |
---|
34 | // History: first implementation, based on object model of |
---|
35 | // 2nd December 1995, G.Cosmo |
---|
36 | // ---------------- G4ParticleDefinition ----------------- |
---|
37 | // first implementation by Makoto Asai, 29 January 1996 |
---|
38 | // revised by G.Cosmo, 29 February 1996 |
---|
39 | // revised by H.Kurashige, 19 April 1996 |
---|
40 | // Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96 |
---|
41 | // revised by H.Kurashige, 4 July 1996 |
---|
42 | // revised by H.Kurashige, 16 Feb 1997 |
---|
43 | // revised by H.Kurashige, 10 Nov 1997 |
---|
44 | // remove new/delete G4ProcessManager by H.Kurashige 06 June 1998 |
---|
45 | // added Resonance flag and ApplyCuts flag H.Kurashige 27 June 1998 |
---|
46 | // modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998 |
---|
47 | // modify encoding rule H.Kurashige 23 Oct. 98 |
---|
48 | // modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige |
---|
49 | // |
---|
50 | // modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige |
---|
51 | // -------------------------------------------------------------- |
---|
52 | |
---|
53 | |
---|
54 | #include "G4ParticleDefinition.hh" |
---|
55 | #include "G4ParticleTable.hh" |
---|
56 | #include "G4DecayTable.hh" |
---|
57 | #include "G4PDGCodeChecker.hh" |
---|
58 | |
---|
59 | G4ParticleDefinition::G4ParticleDefinition( |
---|
60 | const G4String& aName, |
---|
61 | G4double mass, |
---|
62 | G4double width, |
---|
63 | G4double charge, |
---|
64 | G4int iSpin, |
---|
65 | G4int iParity, |
---|
66 | G4int iConjugation, |
---|
67 | G4int iIsospin, |
---|
68 | G4int iIsospin3, |
---|
69 | G4int gParity, |
---|
70 | const G4String& pType, |
---|
71 | G4int lepton, |
---|
72 | G4int baryon, |
---|
73 | G4int encoding, |
---|
74 | G4bool stable, |
---|
75 | G4double lifetime, |
---|
76 | G4DecayTable *decaytable, |
---|
77 | G4bool shortlived, |
---|
78 | const G4String& subType, |
---|
79 | G4int anti_encoding, |
---|
80 | G4double magneticMoment) |
---|
81 | |
---|
82 | : theParticleName(aName), |
---|
83 | thePDGMass(mass), |
---|
84 | thePDGWidth(width), |
---|
85 | thePDGCharge(charge), |
---|
86 | thePDGiSpin(iSpin), |
---|
87 | thePDGSpin(iSpin*0.5), |
---|
88 | thePDGiParity(iParity), |
---|
89 | thePDGiConjugation(iConjugation), |
---|
90 | thePDGiGParity(gParity), |
---|
91 | thePDGiIsospin(iIsospin), |
---|
92 | thePDGiIsospin3(iIsospin3), |
---|
93 | thePDGIsospin(iIsospin*0.5), |
---|
94 | thePDGIsospin3(iIsospin3*0.5), |
---|
95 | thePDGMagneticMoment(magneticMoment), |
---|
96 | theLeptonNumber(lepton), |
---|
97 | theBaryonNumber(baryon), |
---|
98 | theParticleType(pType), |
---|
99 | theParticleSubType(subType), |
---|
100 | thePDGEncoding(encoding), |
---|
101 | theAntiPDGEncoding(-1*encoding), |
---|
102 | fShortLivedFlag(shortlived), |
---|
103 | thePDGStable(stable), |
---|
104 | thePDGLifeTime(lifetime), |
---|
105 | theDecayTable(decaytable), |
---|
106 | theProcessManager(0), |
---|
107 | theAtomicNumber(0), |
---|
108 | theAtomicMass(0), |
---|
109 | verboseLevel(1), |
---|
110 | fApplyCutsFlag(false) |
---|
111 | { |
---|
112 | // check name and register this particle into ParticleTable |
---|
113 | theParticleTable = G4ParticleTable::GetParticleTable(); |
---|
114 | theParticleTable->Insert(this); |
---|
115 | |
---|
116 | if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding; |
---|
117 | |
---|
118 | // check quark contents |
---|
119 | if (this->FillQuarkContents() != thePDGEncoding) { |
---|
120 | #ifdef G4VERBOSE |
---|
121 | if (verboseLevel>0) { |
---|
122 | // Using G4cerr expecting that it is available in construction of static objects |
---|
123 | G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl; |
---|
124 | } |
---|
125 | #endif |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &) |
---|
130 | { |
---|
131 | G4Exception("G4ParticleDefinition::G4ParticleDefinition()", |
---|
132 | "illegal constructor call", FatalException, |
---|
133 | "You call Copy Constructor of G4ParticleDefinition "); |
---|
134 | } |
---|
135 | |
---|
136 | G4ParticleDefinition::G4ParticleDefinition() |
---|
137 | { |
---|
138 | G4Exception("G4ParticleDefinition::G4ParticleDefinition()", |
---|
139 | "illegal constructor call", FatalException, |
---|
140 | "You call Default Constructor of G4ParticleDefinition "); |
---|
141 | } |
---|
142 | |
---|
143 | |
---|
144 | G4ParticleDefinition::~G4ParticleDefinition() |
---|
145 | { |
---|
146 | if (theDecayTable!= 0) delete theDecayTable; |
---|
147 | } |
---|
148 | |
---|
149 | |
---|
150 | const G4ParticleDefinition & G4ParticleDefinition::operator=(const G4ParticleDefinition &right) |
---|
151 | { |
---|
152 | if (this != &right) { |
---|
153 | } |
---|
154 | return *this; |
---|
155 | } |
---|
156 | |
---|
157 | G4int G4ParticleDefinition::operator==(const G4ParticleDefinition &right) const |
---|
158 | { |
---|
159 | return (this->theParticleName == right.theParticleName); |
---|
160 | } |
---|
161 | |
---|
162 | G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const |
---|
163 | { |
---|
164 | return (this->theParticleName != right.theParticleName); |
---|
165 | } |
---|
166 | |
---|
167 | |
---|
168 | |
---|
169 | G4int G4ParticleDefinition::FillQuarkContents() |
---|
170 | // calculate quark and anti-quark contents |
---|
171 | // return value is PDG encoding for this particle. |
---|
172 | // It means error if the return value is differnt from |
---|
173 | // this->thePDGEncoding. |
---|
174 | { |
---|
175 | G4int flavor; |
---|
176 | for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ |
---|
177 | theQuarkContent[flavor] = 0; |
---|
178 | theAntiQuarkContent[flavor] = 0; |
---|
179 | } |
---|
180 | |
---|
181 | G4PDGCodeChecker checker; |
---|
182 | |
---|
183 | G4int temp = checker.CheckPDGCode(thePDGEncoding, theParticleType); |
---|
184 | |
---|
185 | if ( temp != 0) { |
---|
186 | for (flavor= 0; flavor<NumberOfQuarkFlavor; flavor++){ |
---|
187 | theQuarkContent[flavor] = checker.GetQuarkContent(flavor); |
---|
188 | theAntiQuarkContent[flavor] = checker.GetAntiQuarkContent(flavor); |
---|
189 | } |
---|
190 | if ((theParticleType == "meson")||(theParticleType == "baryon")) { |
---|
191 | // check charge |
---|
192 | if (!checker.CheckCharge(thePDGCharge) ){ |
---|
193 | temp = 0; |
---|
194 | #ifdef G4VERBOSE |
---|
195 | if (verboseLevel>1) { |
---|
196 | G4cout << "G4ParticleDefinition::FillQuarkContents : "; |
---|
197 | G4cout << " illegal charge (" << thePDGCharge/eplus; |
---|
198 | G4cout << " PDG code=" << thePDGEncoding <<G4endl; |
---|
199 | } |
---|
200 | #endif |
---|
201 | } |
---|
202 | // check spin |
---|
203 | if (checker.GetSpin() != thePDGiSpin) { |
---|
204 | temp=0; |
---|
205 | #ifdef G4VERBOSE |
---|
206 | if (verboseLevel>1) { |
---|
207 | G4cout << "G4ParticleDefinition::FillQuarkContents : "; |
---|
208 | G4cout << " illegal SPIN (" << thePDGiSpin << "/2"; |
---|
209 | G4cout << " PDG code=" << thePDGEncoding <<G4endl; |
---|
210 | } |
---|
211 | #endif |
---|
212 | } |
---|
213 | } |
---|
214 | } |
---|
215 | return temp; |
---|
216 | } |
---|
217 | |
---|
218 | void G4ParticleDefinition::DumpTable() const |
---|
219 | { |
---|
220 | G4cout << G4endl; |
---|
221 | G4cout << "--- G4ParticleDefinition ---" << G4endl; |
---|
222 | G4cout << " Particle Name : " << theParticleName << G4endl; |
---|
223 | G4cout << " PDG particle code : " << thePDGEncoding; |
---|
224 | G4cout << " [PDG anti-particle code: " << this->GetAntiPDGEncoding() << "]"<< G4endl; |
---|
225 | G4cout << " Mass [GeV/c2] : " << thePDGMass/GeV ; |
---|
226 | G4cout << " Width : " << thePDGWidth/GeV << G4endl; |
---|
227 | G4cout << " Lifetime [nsec] : " << thePDGLifeTime/ns << G4endl; |
---|
228 | G4cout << " Charge [e]: " << thePDGCharge/eplus << G4endl; |
---|
229 | G4cout << " Spin : " << thePDGiSpin << "/2" << G4endl; |
---|
230 | G4cout << " Parity : " << thePDGiParity << G4endl; |
---|
231 | G4cout << " Charge conjugation : " << thePDGiConjugation << G4endl; |
---|
232 | G4cout << " Isospin : (I,Iz): (" << thePDGiIsospin <<"/2"; |
---|
233 | G4cout << " , " << thePDGiIsospin3 << "/2 ) " << G4endl; |
---|
234 | G4cout << " GParity : " << thePDGiGParity << G4endl; |
---|
235 | if (thePDGMagneticMoment != 0.0) { |
---|
236 | G4cout << " MagneticMoment [MeV/T] : " << thePDGMagneticMoment/MeV*tesla << G4endl; |
---|
237 | } |
---|
238 | G4cout << " Quark contents (d,u,s,c,b,t) : " << theQuarkContent[0]; |
---|
239 | G4cout << ", " << theQuarkContent[1]; |
---|
240 | G4cout << ", " << theQuarkContent[2]; |
---|
241 | G4cout << ", " << theQuarkContent[3]; |
---|
242 | G4cout << ", " << theQuarkContent[4]; |
---|
243 | G4cout << ", " << theQuarkContent[5] << G4endl; |
---|
244 | G4cout << " AntiQuark contents : " << theAntiQuarkContent[0]; |
---|
245 | G4cout << ", " << theAntiQuarkContent[1]; |
---|
246 | G4cout << ", " << theAntiQuarkContent[2]; |
---|
247 | G4cout << ", " << theAntiQuarkContent[3]; |
---|
248 | G4cout << ", " << theAntiQuarkContent[4]; |
---|
249 | G4cout << ", " << theAntiQuarkContent[5] << G4endl; |
---|
250 | G4cout << " Lepton number : " << theLeptonNumber; |
---|
251 | G4cout << " Baryon number : " << theBaryonNumber << G4endl; |
---|
252 | G4cout << " Particle type : " << theParticleType ; |
---|
253 | G4cout << " [" << theParticleSubType << "]" << G4endl; |
---|
254 | |
---|
255 | if ( fShortLivedFlag ){ |
---|
256 | G4cout << " ShortLived : ON" << G4endl; |
---|
257 | } |
---|
258 | |
---|
259 | if ( thePDGStable ){ |
---|
260 | G4cout << " Stable : stable" << G4endl; |
---|
261 | } else { |
---|
262 | if( theDecayTable != 0 ){ |
---|
263 | theDecayTable->DumpInfo(); |
---|
264 | } else { |
---|
265 | G4cout << "Decay Table is not defined !!" <<G4endl; |
---|
266 | } |
---|
267 | } |
---|
268 | |
---|
269 | } |
---|
270 | |
---|
271 | void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg) |
---|
272 | { |
---|
273 | if(theParticleName=="gamma" |
---|
274 | || theParticleName=="e-" |
---|
275 | || theParticleName=="e+") |
---|
276 | { fApplyCutsFlag = flg; } |
---|
277 | else |
---|
278 | { |
---|
279 | G4cerr |
---|
280 | << "G4ParticleDefinition::SetApplyCutsFlag() for " << theParticleName |
---|
281 | << G4endl; |
---|
282 | G4cerr |
---|
283 | << "becomes obsolete. Production threshold is applied only for " |
---|
284 | << "gamma, e- and e+." << G4endl; |
---|
285 | } |
---|
286 | } |
---|
287 | |
---|
288 | |
---|
289 | |
---|
290 | |
---|
291 | |
---|
292 | |
---|
293 | |
---|
294 | |
---|
295 | |
---|
296 | |
---|
297 | |
---|
298 | |
---|
299 | |
---|