Geant4-11
Public Member Functions | Protected Types | Private Member Functions | Private Attributes
G4PDGCodeChecker Class Reference

#include <G4PDGCodeChecker.hh>

Public Member Functions

G4bool CheckCharge (G4double charge) const
 
G4int CheckPDGCode (G4int code, const G4String &type)
 
 G4PDGCodeChecker ()
 
G4int GetAntiQuarkContent (G4int flavor) const
 
G4int GetExotic () const
 
G4int GetMultiplet () const
 
G4int GetQuarkContent (G4int flavor) const
 
G4int GetQuarkFlavor (G4int idx) const
 
G4int GetRadial () const
 
G4int GetSpin () const
 
G4int GetVerboseLevel () const
 
G4bool IsAntiParticle () const
 
void SetVerboseLevel (G4int verbose)
 
 ~G4PDGCodeChecker ()
 

Protected Types

enum  { NumberOfQuarkFlavor = 8 }
 

Private Member Functions

G4int CheckForBaryons ()
 
G4int CheckForDiQuarks ()
 
G4int CheckForMesons ()
 
G4int CheckForNuclei ()
 
G4int CheckForQuarks ()
 
void GetDigits (G4int code)
 

Private Attributes

G4int code = 0
 
G4int exotic = 0
 
G4int higherSpin = 0
 
G4int multiplet = 0
 
G4int quark1 = 0
 
G4int quark2 = 0
 
G4int quark3 = 0
 
G4int radial = 0
 
G4int spin = 0
 
G4int theAntiQuarkContent [NumberOfQuarkFlavor]
 
G4String theParticleType = ""
 
G4int theQuarkContent [NumberOfQuarkFlavor]
 
G4int verboseLevel = 0
 

Detailed Description

Definition at line 36 of file G4PDGCodeChecker.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
NumberOfQuarkFlavor 

Definition at line 64 of file G4PDGCodeChecker.hh.

Constructor & Destructor Documentation

◆ G4PDGCodeChecker()

G4PDGCodeChecker::G4PDGCodeChecker ( )

Definition at line 39 of file G4PDGCodeChecker.cc.

40 : verboseLevel(1)
41{
42 // clear QuarkContents
43 for (G4int flavor=0; flavor<NumberOfQuarkFlavor; ++flavor)
44 {
45 theQuarkContent[flavor] = 0;
46 theAntiQuarkContent[flavor] = 0;
47 }
48}
int G4int
Definition: G4Types.hh:85
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]

References NumberOfQuarkFlavor, theAntiQuarkContent, and theQuarkContent.

◆ ~G4PDGCodeChecker()

G4PDGCodeChecker::~G4PDGCodeChecker ( )

Definition at line 51 of file G4PDGCodeChecker.cc.

52{
53}

Member Function Documentation

◆ CheckCharge()

G4bool G4PDGCodeChecker::CheckCharge ( G4double  charge) const

Definition at line 384 of file G4PDGCodeChecker.cc.

385{
386 // check charge
387 G4double totalCharge = 0.0;
388 for (G4int flavor= 0; flavor<NumberOfQuarkFlavor-1; flavor+=2)
389 {
390 totalCharge += (-1./3.)*eplus*theQuarkContent[flavor];
391 totalCharge += 1./3.*eplus*theAntiQuarkContent[flavor];
392 totalCharge += 2./3.*eplus*theQuarkContent[flavor+1];
393 totalCharge += (-2./3.)*eplus*theAntiQuarkContent[flavor+1];
394 }
395
396 if (std::fabs(totalCharge-thePDGCharge)>0.1*eplus)
397 {
398#ifdef G4VERBOSE
399 if (verboseLevel>0)
400 {
401 G4cout << " G4PDGCodeChecker::CheckCharge : ";
402 G4cout << " illegal electric charge " << thePDGCharge/eplus;
403 G4cout << " PDG code=" << code <<G4endl;
404 }
405#endif
406 return false;
407 }
408 return true;
409}
static constexpr double eplus
Definition: G4SIunits.hh:184
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24

References eplus, G4cout, G4endl, NumberOfQuarkFlavor, theAntiQuarkContent, theQuarkContent, and verboseLevel.

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ CheckForBaryons()

G4int G4PDGCodeChecker::CheckForBaryons ( )
private

Definition at line 105 of file G4PDGCodeChecker.cc.

106{
107 G4int tempPDGcode = code;
108
109 if ((quark1==0)||(quark2==0)||(quark3==0))
110 {
111#ifdef G4VERBOSE
112 if (verboseLevel>0)
113 {
114 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
115 G4cout << " meson has three quark ";
116 G4cout << " PDG code=" << code <<G4endl;
117 }
118#endif
119 return 0;
120 }
121
122 // exceptions
123 if (std::abs(tempPDGcode)%10000 == 3122)
124 {
125 // Lambda
126 quark2=2; quark3 = 1; spin = 1;
127 } else if (std::abs(tempPDGcode)%10000 == 3124) {
128 // Lambda*
129 quark2=2; quark3 = 1; spin = 3;
130 } else if (std::abs(tempPDGcode)%10000 == 3126) {
131 // Lambda*
132 quark2=2; quark3 = 1; spin = 5;
133 } else if (std::abs(tempPDGcode)%10000 == 3128) {
134 // Lambda*
135 quark2=2; quark3 = 1; spin = 7;
136 } else if (std::abs(tempPDGcode)%10000 == 4122) {
137 // Lambda_c
138 quark2=2; quark3 = 1; spin = 1;
139 } else if (std::abs(tempPDGcode)%10000 == 5122) {
140 // Lambda_b
141 quark2=2; quark3 = 1; spin = 1;
142 } else if (std::abs(tempPDGcode)%10000 == 4132) {
143 // Xi_c0
144 quark2=3; quark3 = 1; spin = 1;
145 } else if (std::abs(tempPDGcode)%10000 == 4232) {
146 // Xi_c+
147 quark2=3; quark3 = 2; spin = 1;
148 } else if (std::abs(tempPDGcode)%10000 == 5132) {
149 // Xi_b0
150 quark2=3; quark3 = 1; spin = 1;
151 } else if (std::abs(tempPDGcode)%10000 == 5232) {
152 // Xi_b+
153 quark2=3; quark3 = 2; spin = 1;
154 } else if (std::abs(tempPDGcode)%10000 == 2122) {
155 // Delta+ (spin 1/2)
156 quark2=2; quark3 = 1; spin = 1;
157 } else if (std::abs(tempPDGcode)%10000 == 1212) {
158 // Delta0 (spin 1/2)
159 quark1=2; quark2 = 1; spin = 1;
160 } else if (std::abs(tempPDGcode)%10000 == 2126) {
161 // Delta+ (spin 5/2)
162 quark2=2; quark3 = 1; spin = 5;
163 } else if (std::abs(tempPDGcode)%10000 == 1216) {
164 // Delta0 (spin 5/2)
165 quark1=2; quark2 = 1; spin = 5;
166 } else if (std::abs(tempPDGcode)%10000 == 2128) {
167 // Delta+ (spin 7/2)
168 quark2=2; quark3 = 1; spin = 7;
169 } else if (std::abs(tempPDGcode)%10000 == 1218) {
170 // Delta0 (spin 7/2)
171 quark1=2; quark2 = 1; spin = 7;
172 } else if (std::abs(tempPDGcode)%10000 == 2124) {
173 // N*+ (spin 3/2)
174 quark2=2; quark3 = 1; spin = 3;
175 } else if (std::abs(tempPDGcode)%10000 == 1214) {
176 // N*0 (spin 3/2)
177 quark1=2; quark2 = 1; spin = 3;
178 }
179
180 // check quark flavor
182 {
183#ifdef G4VERBOSE
184 if (verboseLevel>0)
185 {
186 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
187 G4cout << " illegal code for baryon ";
188 G4cout << " PDG code=" << code << G4endl;
189 }
190#endif
191 return 0;
192 }
194 {
195#ifdef G4VERBOSE
196 if (verboseLevel>0)
197 {
198 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
199 G4cout << " ??? unknown quark ";
200 G4cout << " PDG code=" << code <<G4endl;
201 }
202#endif
203 return 0;
204 }
205
206 // Fill Quark contents
207 if (tempPDGcode >0)
208 {
212 }
213 else
214 {
218 }
219
220 return code;
221}

References code, G4cout, G4endl, NumberOfQuarkFlavor, quark1, quark2, quark3, spin, theAntiQuarkContent, theQuarkContent, and verboseLevel.

Referenced by CheckPDGCode().

◆ CheckForDiQuarks()

G4int G4PDGCodeChecker::CheckForDiQuarks ( )
private

Definition at line 309 of file G4PDGCodeChecker.cc.

310{
311 if ((quark1 ==0) || (quark2 ==0) || (quark3 !=0))
312 {
313 // quark3 should be 0
314 // --- code is wrong
315 return 0;
316
317 }
318 else if (quark1 < quark2)
319 {
320 // --- code is wrong
321 return 0;
322
323 }
325 {
326#ifdef G4VERBOSE
327 if (verboseLevel>0)
328 {
329 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
330 G4cout << " ??? unknown quark ";
331 G4cout << " PDG code=" << code <<G4endl;
332 }
333#endif
334 return 0;
335 }
336
337 // Fill Quark Contents
338 if (code>0)
339 {
340 theQuarkContent[quark1-1] +=1;
341 theQuarkContent[quark2-1] +=1;
342 }
343 else
344 {
347 }
348
349 return code;
350}

References code, G4cout, G4endl, NumberOfQuarkFlavor, quark1, quark2, quark3, theAntiQuarkContent, theQuarkContent, and verboseLevel.

Referenced by CheckPDGCode().

◆ CheckForMesons()

G4int G4PDGCodeChecker::CheckForMesons ( )
private

Definition at line 224 of file G4PDGCodeChecker.cc.

225{
226 G4int tempPDGcode = code;
227
228 // -- exceptions --
229 if (tempPDGcode == 310) spin = 0; // K0s
230 if (tempPDGcode == 130) // K0l
231 {
232 spin = 0;
233 quark2 = 3;
234 quark3 = 1;
235 }
236
237 if ((quark1 !=0)||(quark2==0)||(quark3==0))
238 {
239#ifdef G4VERBOSE
240 if (verboseLevel>0)
241 {
242 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
243 G4cout << " meson has only quark and anti-quark pair";
244 G4cout << " PDG code=" << code <<G4endl;
245 }
246#endif
247 return 0;
248 }
249 if (quark2<quark3)
250 {
251#ifdef G4VERBOSE
252 if (verboseLevel>0)
253 {
254 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
255 G4cout << " illegal code for meson ";
256 G4cout << " PDG code=" << code <<G4endl;
257 }
258#endif
259 return 0;
260 }
261
262 // check quark flavor
264 {
265#ifdef G4VERBOSE
266 if (verboseLevel>0)
267 {
268 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
269 G4cout << " ??? unknown quark ";
270 G4cout << " PDG code=" << code <<G4endl;
271 }
272#endif
273 return 0;
274 }
275
276 // check heavier quark type
277 if (quark2 & 1)
278 {
279 // down type qurak
280 if (tempPDGcode >0)
281 {
284 }
285 else
286 {
289 }
290 }
291 else
292 {
293 // up type quark
294 if (tempPDGcode >0)
295 {
298 }
299 else
300 {
303 }
304 }
305 return code;
306}

References code, G4cout, G4endl, NumberOfQuarkFlavor, quark1, quark2, quark3, spin, theAntiQuarkContent, theQuarkContent, and verboseLevel.

Referenced by CheckPDGCode().

◆ CheckForNuclei()

G4int G4PDGCodeChecker::CheckForNuclei ( )
private

Definition at line 412 of file G4PDGCodeChecker.cc.

413{
414 G4int pcode = std::abs(code);
415 if (pcode < 1000000000)
416 {
417 // non-nuclei
418 return 0;
419 }
420
421 pcode -= 1000000000;
422 G4int LL = pcode/10000000;
423 pcode -= 10000000*LL;
424 G4int Z = pcode/10000;
425 pcode -= 10000*Z;
426 G4int A = pcode/10;
427
428 // Allow neutron balls
429 // if (A < 2 || Z > A-LL || LL>A || Z<=0 ) {
430 if (A < 2 || Z > A-LL || LL>A )
431 {
432#ifdef G4VERBOSE
433 if (verboseLevel>0)
434 {
435 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
436 G4cout << " ??? Illegal PDG encoding for nucleus ";
437 G4cout << " PDG code=" << code <<G4endl;
438 }
439#endif
440 return 0;
441 }
442
443 G4int n_up = 2*Z + (A-Z-LL) + LL;
444 G4int n_down = Z + 2*(A-Z-LL) + LL;
445 G4int n_s = LL;
446
447 // Fill Quark contents
448 if (code>0)
449 {
450 theQuarkContent[0] = n_up;
451 theQuarkContent[1] = n_down;
452 theQuarkContent[2] = n_s;
453 }
454 else
455 {
456 // anti_nucleus
457 theAntiQuarkContent[0] = n_up;
458 theAntiQuarkContent[1] = n_down;
459 theAntiQuarkContent[2] = n_s;
460 }
461 return code;
462}
static const G4int LL[nN]
const G4int Z[17]
const G4double A[17]

References A, code, G4cout, G4endl, LL, theAntiQuarkContent, theQuarkContent, verboseLevel, and Z.

Referenced by CheckPDGCode().

◆ CheckForQuarks()

G4int G4PDGCodeChecker::CheckForQuarks ( )
private

Definition at line 353 of file G4PDGCodeChecker.cc.

354{
355 quark1 = std::abs(code);
356
357 if ( std::abs(quark1)>NumberOfQuarkFlavor )
358 {
359#ifdef G4VERBOSE
360 if (verboseLevel>0)
361 {
362 G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
363 G4cout << " ??? unknown quark ";
364 G4cout << " PDG code=" << code <<G4endl;
365 }
366#endif
367 // --- code is wrong
368 return 0;
369 }
370
371 // Fill Quark Contents
372 if (code>0)
373 {
375 }
376 else
377 {
379 }
380 return code;
381}

References code, G4cout, G4endl, NumberOfQuarkFlavor, quark1, theAntiQuarkContent, theQuarkContent, and verboseLevel.

Referenced by CheckPDGCode().

◆ CheckPDGCode()

G4int G4PDGCodeChecker::CheckPDGCode ( G4int  code,
const G4String type 
)

Definition at line 56 of file G4PDGCodeChecker.cc.

58{
59 code = PDGcode;
60 theParticleType = particleType;
61
62 // clear QuarkContents
63 for (G4int flavor=0; flavor<NumberOfQuarkFlavor; ++flavor)
64 {
65 theQuarkContent[flavor] = 0;
66 theAntiQuarkContent[flavor] = 0;
67 }
68
69 // check code for nuclei
70 if ((theParticleType == "nucleus") || (theParticleType == "anti_nucleus"))
71 {
72 return CheckForNuclei();
73 }
74
75 // get each digit number
77
78 // check code
79 if (theParticleType =="quarks")
80 {
81 return CheckForQuarks();
82 }
83 else if (theParticleType =="diquarks")
84 {
85 return CheckForDiQuarks();
86 }
87 else if (theParticleType =="gluons")
88 {
89 return code; // gluons, do not care about
90 }
91 else if (theParticleType == "meson")
92 {
93 return CheckForMesons();
94
95 }
96 else if (theParticleType == "baryon")
97 {
98 return CheckForBaryons();
99 }
100 // No check
101 return code;
102}
void GetDigits(G4int code)

References CheckForBaryons(), CheckForDiQuarks(), CheckForMesons(), CheckForNuclei(), CheckForQuarks(), code, GetDigits(), NumberOfQuarkFlavor, theAntiQuarkContent, theParticleType, and theQuarkContent.

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetAntiQuarkContent()

G4int G4PDGCodeChecker::GetAntiQuarkContent ( G4int  flavor) const
inline

Definition at line 115 of file G4PDGCodeChecker.hh.

116{
117 G4int value = 0;
118 if ((flavor>=0)&&(flavor<NumberOfQuarkFlavor))
119 {
120 value = theAntiQuarkContent[flavor];
121 }
122 return value;
123}

References NumberOfQuarkFlavor, and theAntiQuarkContent.

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetDigits()

void G4PDGCodeChecker::GetDigits ( G4int  code)
private

Definition at line 465 of file G4PDGCodeChecker.cc.

466{
467 G4int temp = std::abs(PDGcode);
468
469 higherSpin = temp/10000000;
470 temp -= G4int(higherSpin*10000000);
471
472 exotic = temp/1000000;
473 temp -= G4int(exotic*1000000);
474
475 radial = temp/100000;
476 temp -= G4int(radial*100000);
477
478 multiplet = temp/10000;
479 temp -= G4int(multiplet*10000);
480
481 quark1 = temp/1000;
482 temp -= G4int(quark1*1000);
483
484 quark2 = temp/100;
485 temp -= G4int(quark2*100);
486
487 quark3 = temp/10;
488 temp -= G4int(quark3*10);
489
490 spin = temp;
491 if ((spin ==0) && ( higherSpin !=0 ))
492 {
493 spin = higherSpin-1;
494 }
495 else
496 {
497 spin -= 1;
498 }
499}

References exotic, higherSpin, multiplet, quark1, quark2, quark3, radial, and spin.

Referenced by CheckPDGCode().

◆ GetExotic()

G4int G4PDGCodeChecker::GetExotic ( ) const
inline

Definition at line 138 of file G4PDGCodeChecker.hh.

139{
140 return exotic;
141}

References exotic.

◆ GetMultiplet()

G4int G4PDGCodeChecker::GetMultiplet ( ) const
inline

Definition at line 150 of file G4PDGCodeChecker.hh.

151{
152 return multiplet;
153}

References multiplet.

◆ GetQuarkContent()

G4int G4PDGCodeChecker::GetQuarkContent ( G4int  flavor) const
inline

Definition at line 104 of file G4PDGCodeChecker.hh.

105{
106 G4int value = 0;
107 if ((flavor>=0)&&(flavor<NumberOfQuarkFlavor))
108 {
109 value = theQuarkContent[flavor];
110 }
111 return value;
112}

References NumberOfQuarkFlavor, and theQuarkContent.

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetQuarkFlavor()

G4int G4PDGCodeChecker::GetQuarkFlavor ( G4int  idx) const
inline

Definition at line 127 of file G4PDGCodeChecker.hh.

128{
129 G4int value;
130 if (idx ==0) value = quark1;
131 else if (idx ==1) value = quark2;
132 else if (idx ==2) value = quark3;
133 else value = -1;
134 return value;
135}

References quark1, quark2, and quark3.

◆ GetRadial()

G4int G4PDGCodeChecker::GetRadial ( ) const
inline

Definition at line 144 of file G4PDGCodeChecker.hh.

145{
146 return radial;
147}

References radial.

◆ GetSpin()

G4int G4PDGCodeChecker::GetSpin ( ) const
inline

Definition at line 156 of file G4PDGCodeChecker.hh.

157{
158 return spin;
159}

References spin.

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetVerboseLevel()

G4int G4PDGCodeChecker::GetVerboseLevel ( ) const
inline

Definition at line 174 of file G4PDGCodeChecker.hh.

175{
176 return verboseLevel;
177}

References verboseLevel.

◆ IsAntiParticle()

G4bool G4PDGCodeChecker::IsAntiParticle ( ) const
inline

Definition at line 162 of file G4PDGCodeChecker.hh.

163{
164 return (code <0);
165}

◆ SetVerboseLevel()

void G4PDGCodeChecker::SetVerboseLevel ( G4int  verbose)
inline

Definition at line 168 of file G4PDGCodeChecker.hh.

169{
170 verboseLevel = value;
171}

References verboseLevel.

Referenced by G4ParticleDefinition::FillQuarkContents().

Field Documentation

◆ code

G4int G4PDGCodeChecker::code = 0
private

◆ exotic

G4int G4PDGCodeChecker::exotic = 0
private

Definition at line 83 of file G4PDGCodeChecker.hh.

Referenced by GetDigits(), and GetExotic().

◆ higherSpin

G4int G4PDGCodeChecker::higherSpin = 0
private

Definition at line 82 of file G4PDGCodeChecker.hh.

Referenced by GetDigits().

◆ multiplet

G4int G4PDGCodeChecker::multiplet = 0
private

Definition at line 85 of file G4PDGCodeChecker.hh.

Referenced by GetDigits(), and GetMultiplet().

◆ quark1

G4int G4PDGCodeChecker::quark1 = 0
private

◆ quark2

G4int G4PDGCodeChecker::quark2 = 0
private

◆ quark3

G4int G4PDGCodeChecker::quark3 = 0
private

◆ radial

G4int G4PDGCodeChecker::radial = 0
private

Definition at line 84 of file G4PDGCodeChecker.hh.

Referenced by GetDigits(), and GetRadial().

◆ spin

G4int G4PDGCodeChecker::spin = 0
private

Definition at line 89 of file G4PDGCodeChecker.hh.

Referenced by CheckForBaryons(), CheckForMesons(), GetDigits(), and GetSpin().

◆ theAntiQuarkContent

G4int G4PDGCodeChecker::theAntiQuarkContent[NumberOfQuarkFlavor]
private

◆ theParticleType

G4String G4PDGCodeChecker::theParticleType = ""
private

Definition at line 80 of file G4PDGCodeChecker.hh.

Referenced by CheckPDGCode().

◆ theQuarkContent

G4int G4PDGCodeChecker::theQuarkContent[NumberOfQuarkFlavor]
private

◆ verboseLevel

G4int G4PDGCodeChecker::verboseLevel = 0
private

The documentation for this class was generated from the following files: