Geant4  10.02.p03
G4PDGCodeChecker Class Reference

#include <G4PDGCodeChecker.hh>

Collaboration diagram for G4PDGCodeChecker:

Public Member Functions

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

Protected Types

enum  { NumberOfQuarkFlavor = 8 }
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 44 of file G4PDGCodeChecker.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
NumberOfQuarkFlavor 

Definition at line 73 of file G4PDGCodeChecker.hh.

Constructor & Destructor Documentation

◆ G4PDGCodeChecker()

G4PDGCodeChecker::G4PDGCodeChecker ( )

Definition at line 45 of file G4PDGCodeChecker.cc.

46  :code(0),theParticleType(""),
47  higherSpin(0),
48  exotic(0),radial(0),multiplet(0),
49  quark1(0),quark2(0),quark3(0),spin(0)
50 {
51  verboseLevel = 1;
52  // clear QuarkContents
53  G4int flavor;
54  for (flavor=0; flavor<NumberOfQuarkFlavor; flavor++){
55  theQuarkContent[flavor] =0;
56  theAntiQuarkContent[flavor] =0;
57  }
58 }
int G4int
Definition: G4Types.hh:78
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]

◆ ~G4PDGCodeChecker()

G4PDGCodeChecker::~G4PDGCodeChecker ( )
inline

Definition at line 49 of file G4PDGCodeChecker.hh.

49 {};
Here is the call graph for this function:

Member Function Documentation

◆ CheckCharge()

G4bool G4PDGCodeChecker::CheckCharge ( G4double  charge) const

Definition at line 353 of file G4PDGCodeChecker.cc.

354 {
355  // check charge
356  G4double totalCharge = 0.0;
357  for (G4int flavor= 0; flavor<NumberOfQuarkFlavor-1; flavor+=2){
358  totalCharge += (-1./3.)*eplus*theQuarkContent[flavor];
359  totalCharge += 1./3.*eplus*theAntiQuarkContent[flavor];
360  totalCharge += 2./3.*eplus*theQuarkContent[flavor+1];
361  totalCharge += (-2./3.)*eplus*theAntiQuarkContent[flavor+1];
362  }
363 
364  if (std::fabs(totalCharge-thePDGCharge)>0.1*eplus) {
365 #ifdef G4VERBOSE
366  if (verboseLevel>0) {
367  G4cout << " G4PDGCodeChecker::CheckCharge : ";
368  G4cout << " illegal electric charge " << thePDGCharge/eplus;
369  G4cout << " PDG code=" << code <<G4endl;
370  }
371 #endif
372  return false;
373  }
374  return true;
375 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const double eplus
Definition: G4SIunits.hh:196
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ CheckForBaryons()

G4int G4PDGCodeChecker::CheckForBaryons ( )
private

Definition at line 107 of file G4PDGCodeChecker.cc.

108 {
109  G4int tempPDGcode = code;
110 
111  if ((quark1==0)||(quark2==0)||(quark3==0)){
112 #ifdef G4VERBOSE
113  if (verboseLevel>0) {
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  // Lambda
125  quark2=2; quark3 = 1; spin = 1;
126  } else if (std::abs(tempPDGcode)%10000 == 3124) {
127  // Lambda*
128  quark2=2; quark3 = 1; spin = 3;
129  } else if (std::abs(tempPDGcode)%10000 == 3126) {
130  // Lambda*
131  quark2=2; quark3 = 1; spin = 5;
132  } else if (std::abs(tempPDGcode)%10000 == 3128) {
133  // Lambda*
134  quark2=2; quark3 = 1; spin = 7;
135  } else if (std::abs(tempPDGcode)%10000 == 4122) {
136  // Lambda_c
137  quark2=2; quark3 = 1; spin = 1;
138  } else if (std::abs(tempPDGcode)%10000 == 5122) {
139  // Lambda_b
140  quark2=2; quark3 = 1; spin = 1;
141  } else if (std::abs(tempPDGcode)%10000 == 4132) {
142  // Xi_c0
143  quark2=3; quark3 = 1; spin = 1;
144  } else if (std::abs(tempPDGcode)%10000 == 4232) {
145  // Xi_c+
146  quark2=3; quark3 = 2; spin = 1;
147  } else if (std::abs(tempPDGcode)%10000 == 5132) {
148  // Xi_b0
149  quark2=3; quark3 = 1; spin = 1;
150  } else if (std::abs(tempPDGcode)%10000 == 5232) {
151  // Xi_b+
152  quark2=3; quark3 = 2; spin = 1;
153  } else if (std::abs(tempPDGcode)%10000 == 2122) {
154  // Delta+ (spin 1/2)
155  quark2=2; quark3 = 1; spin = 1;
156  } else if (std::abs(tempPDGcode)%10000 == 1212) {
157  // Delta0 (spin 1/2)
158  quark1=2; quark2 = 1; spin = 1;
159  } else if (std::abs(tempPDGcode)%10000 == 2126) {
160  // Delta+ (spin 5/2)
161  quark2=2; quark3 = 1; spin = 5;
162  } else if (std::abs(tempPDGcode)%10000 == 1216) {
163  // Delta0 (spin 5/2)
164  quark1=2; quark2 = 1; spin = 5;
165  } else if (std::abs(tempPDGcode)%10000 == 2128) {
166  // Delta+ (spin 7/2)
167  quark2=2; quark3 = 1; spin = 7;
168  } else if (std::abs(tempPDGcode)%10000 == 1218) {
169  // Delta0 (spin 7/2)
170  quark1=2; quark2 = 1; spin = 7;
171  } else if (std::abs(tempPDGcode)%10000 == 2124) {
172  // N*+ (spin 3/2)
173  quark2=2; quark3 = 1; spin = 3;
174  } else if (std::abs(tempPDGcode)%10000 == 1214) {
175  // N*0 (spin 3/2)
176  quark1=2; quark2 = 1; spin = 3;
177  }
178 
179  // check quark flavor
180  if ((quark1<quark2)||(quark2<quark3)||(quark1<quark3)) {
181 #ifdef G4VERBOSE
182  if (verboseLevel>0) {
183  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
184  G4cout << " illegal code for baryon ";
185  G4cout << " PDG code=" << code <<G4endl;
186  }
187 #endif
188  return 0;
189  }
191 #ifdef G4VERBOSE
192  if (verboseLevel>0) {
193  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
194  G4cout << " ??? unknown quark ";
195  G4cout << " PDG code=" << code <<G4endl;
196  }
197 #endif
198  return 0;
199  }
200 
201 
202  // Fill Quark contents
203  if (tempPDGcode >0) {
204  theQuarkContent[quark1-1] ++;
205  theQuarkContent[quark2-1] ++;
206  theQuarkContent[quark3-1] ++;
207  } else {
211  }
212 
213  return code;
214 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ CheckForDiQuarks()

G4int G4PDGCodeChecker::CheckForDiQuarks ( )
private

Definition at line 290 of file G4PDGCodeChecker.cc.

291 {
292  if ((quark1 ==0) || (quark2 ==0) || (quark3 !=0)) {
293  // quark3 should be 0
294  // --- code is wrong
295  return 0;
296 
297  } else if (quark1 < quark2) {
298  // --- code is wrong
299  return 0;
300 
301  } else if (quark2>NumberOfQuarkFlavor){
302 #ifdef G4VERBOSE
303  if (verboseLevel>0) {
304  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
305  G4cout << " ??? unknown quark ";
306  G4cout << " PDG code=" << code <<G4endl;
307  }
308 #endif
309  return 0;
310 
311  }
312 
313  // Fill Quark Contents
314  if (code>0){
315  theQuarkContent[quark1-1] +=1;
316  theQuarkContent[quark2-1] +=1;
317  } else {
320  }
321 
322  return code;
323 }
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ CheckForMesons()

G4int G4PDGCodeChecker::CheckForMesons ( )
private

Definition at line 217 of file G4PDGCodeChecker.cc.

218 {
219  G4int tempPDGcode = code;
220 
221  // -- exceptions --
222  if (tempPDGcode == 310) spin = 0; //K0s
223  if (tempPDGcode == 130) { //K0l
224  spin = 0;
225  quark2 = 3;
226  quark3 = 1;
227  }
228 
229  //
230  if ((quark1 !=0)||(quark2==0)||(quark3==0)){
231 #ifdef G4VERBOSE
232  if (verboseLevel>0) {
233  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
234  G4cout << " meson has only quark and anti-quark pair";
235  G4cout << " PDG code=" << code <<G4endl;
236  }
237 #endif
238  return 0;
239  }
240  if (quark2<quark3) {
241 #ifdef G4VERBOSE
242  if (verboseLevel>0) {
243  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
244  G4cout << " illegal code for meson ";
245  G4cout << " PDG code=" << code <<G4endl;
246  }
247 #endif
248  return 0;
249  }
250 
251  // check quark flavor
253 #ifdef G4VERBOSE
254  if (verboseLevel>0) {
255  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
256  G4cout << " ??? unknown quark ";
257  G4cout << " PDG code=" << code <<G4endl;
258  }
259 #endif
260  return 0;
261  }
262 
263 
264  // check heavier quark type
265  if (quark2 & 1) {
266  // down type qurak
267  if (tempPDGcode >0) {
268  theQuarkContent[quark3-1] =1;
270  } else {
271  theQuarkContent[quark2-1] =1;
273  }
274  } else {
275  // up type quark
276  if (tempPDGcode >0) {
277  theQuarkContent[quark2-1] =1;
279  } else {
280  theQuarkContent[quark3-1] =1;
282  }
283  }
284  return code;
285 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ CheckForNuclei()

G4int G4PDGCodeChecker::CheckForNuclei ( )
private

Definition at line 378 of file G4PDGCodeChecker.cc.

379 {
380  G4int pcode = std::abs(code);
381  if (pcode < 1000000000) {
382  // non-nuclei
383  return 0;
384  }
385 
386  pcode -= 1000000000;
387  G4int LL = pcode/10000000;
388  pcode -= 10000000*LL;
389  G4int Z = pcode/10000;
390  pcode -= 10000*Z;
391  G4int A = pcode/10;
392 
393  // Allow neutron balls
394  // if (A < 2 || Z > A-LL || LL>A || Z<=0 ) {
395  if (A < 2 || Z > A-LL || LL>A ) {
396 #ifdef G4VERBOSE
397  if (verboseLevel>0) {
398  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
399  G4cout << " ??? Illegal PDG encoding for nucleus ";
400  G4cout << " PDG code=" << code <<G4endl;
401  }
402 #endif
403  return 0;
404  }
405 
406  G4int n_up = 2*Z + (A-Z-LL) + LL;
407  G4int n_down = Z + 2*(A-Z-LL) + LL;
408  G4int n_s = LL;
409 
410  // Fill Quark contents
411  if (code>0) {
412  theQuarkContent[0] = n_up;
413  theQuarkContent[1] = n_down;
414  theQuarkContent[2] = n_s;
415  } else {
416  // anti_nucleus
417  theAntiQuarkContent[0] = n_up;
418  theAntiQuarkContent[1] = n_down;
419  theAntiQuarkContent[2] = n_s;
420  }
421  return code;
422 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
Float_t Z
Definition: inftrees.h:24
static const G4int LL[nN]
#define G4endl
Definition: G4ios.hh:61
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckForQuarks()

G4int G4PDGCodeChecker::CheckForQuarks ( )
private

Definition at line 326 of file G4PDGCodeChecker.cc.

327 {
328  if ( std::abs(quark1)>NumberOfQuarkFlavor ) {
329 #ifdef G4VERBOSE
330  if (verboseLevel>0) {
331  G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
332  G4cout << " ??? unknown quark ";
333  G4cout << " PDG code=" << code <<G4endl;
334  }
335 #endif
336  // --- code is wrong
337  return 0;
338 
339  }
340 
341  quark1 = std::abs(code);
342 
343  // Fill Quark Contents
344  if (code>0){
345  theQuarkContent[quark1-1] =1;
346  } else {
348  }
349  return code;
350 }
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ CheckPDGCode()

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

Definition at line 61 of file G4PDGCodeChecker.cc.

63 {
64  code = PDGcode;
65  theParticleType = particleType;
66 
67  // clear QuarkContents
68  G4int flavor;
69  for (flavor=0; flavor<NumberOfQuarkFlavor; flavor++){
70  theQuarkContent[flavor] =0;
71  theAntiQuarkContent[flavor] =0;
72  }
73 
74  // check code for nuclei
75  if ((theParticleType == "nucleus")||(theParticleType == "anti_nucleus")) {
76  return CheckForNuclei();
77  }
78 
79  // get each digit number
80  GetDigits(code);
81 
82  // check code
83  if (theParticleType =="quarks") {
84  return CheckForQuarks();
85 
86  } else if (theParticleType =="diquarks") {
87  return CheckForDiQuarks();
88 
89  } else if (theParticleType =="gluons") {
90  // gluons
91  // do not care about
92  return code;
93 
94  } else if (theParticleType == "meson") {
95  return CheckForMesons();
96 
97  } else if (theParticleType == "baryon"){
98  return CheckForBaryons();
99 
100 
101  }
102  // No check
103  return code;
104 }
int G4int
Definition: G4Types.hh:78
void GetDigits(G4int code)
Definition: inftrees.h:24
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAntiQuarkContent()

G4int G4PDGCodeChecker::GetAntiQuarkContent ( G4int  flavor) const
inline

Definition at line 119 of file G4PDGCodeChecker.hh.

120 {
121  G4int value = 0;
122  if ((flavor>=0)&&(flavor<NumberOfQuarkFlavor)) {
123  value = theAntiQuarkContent[flavor];
124  }
125  return value;
126 }
int G4int
Definition: G4Types.hh:78
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ GetDigits()

void G4PDGCodeChecker::GetDigits ( G4int  code)
private

Definition at line 425 of file G4PDGCodeChecker.cc.

426 {
427  G4int temp = std::abs(PDGcode);
428 
429  higherSpin = temp/10000000;
430  temp -= G4int(higherSpin*10000000);
431 
432  exotic = temp/1000000;
433  temp -= G4int(exotic*1000000);
434 
435  radial = temp/100000;
436  temp -= G4int(radial*100000);
437 
438  multiplet = temp/10000;
439  temp -= G4int(multiplet*10000);
440 
441  quark1 = temp/1000;
442  temp -= G4int(quark1*1000);
443 
444  quark2 = temp/100;
445  temp -= G4int(quark2*100);
446 
447  quark3 = temp/10;
448  temp -= G4int(quark3*10);
449 
450  spin= temp;
451  if ((spin ==0) && ( higherSpin !=0 )) {
452  spin = higherSpin-1;
453  } else {
454  spin -= 1;
455  }
456 }
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ GetExotic()

G4int G4PDGCodeChecker::GetExotic ( ) const
inline

Definition at line 141 of file G4PDGCodeChecker.hh.

142 {
143  return exotic;
144 }
Here is the caller graph for this function:

◆ GetMultiplet()

G4int G4PDGCodeChecker::GetMultiplet ( ) const
inline

Definition at line 153 of file G4PDGCodeChecker.hh.

154 {
155  return multiplet;
156 }
Here is the caller graph for this function:

◆ GetQuarkContent()

G4int G4PDGCodeChecker::GetQuarkContent ( G4int  flavor) const
inline

Definition at line 109 of file G4PDGCodeChecker.hh.

110 {
111  G4int value = 0;
112  if ((flavor>=0)&&(flavor<NumberOfQuarkFlavor)) {
113  value = theQuarkContent[flavor];
114  }
115  return value;
116 }
int G4int
Definition: G4Types.hh:78
G4int theQuarkContent[NumberOfQuarkFlavor]
Here is the caller graph for this function:

◆ GetQuarkFlavor()

G4int G4PDGCodeChecker::GetQuarkFlavor ( G4int  idx) const
inline

Definition at line 130 of file G4PDGCodeChecker.hh.

131 {
132  G4int value;
133  if (idx ==0) value = quark1;
134  else if (idx ==1) value = quark2;
135  else if (idx ==2) value = quark3;
136  else value = -1;
137  return value;
138 }
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ GetRadial()

G4int G4PDGCodeChecker::GetRadial ( ) const
inline

Definition at line 147 of file G4PDGCodeChecker.hh.

148 {
149  return radial;
150 }
Here is the caller graph for this function:

◆ GetSpin()

G4int G4PDGCodeChecker::GetSpin ( ) const
inline

Definition at line 159 of file G4PDGCodeChecker.hh.

160 {
161  return spin;
162 }
Here is the caller graph for this function:

◆ GetVerboseLevel()

G4int G4PDGCodeChecker::GetVerboseLevel ( ) const
inline

Definition at line 177 of file G4PDGCodeChecker.hh.

178 {
179  return verboseLevel;
180 }
Here is the caller graph for this function:

◆ IsAntiParticle()

G4bool G4PDGCodeChecker::IsAntiParticle ( ) const
inline

Definition at line 165 of file G4PDGCodeChecker.hh.

166 {
167  return (code <0);
168 }
Definition: inftrees.h:24
Here is the caller graph for this function:

◆ SetVerboseLevel()

void G4PDGCodeChecker::SetVerboseLevel ( G4int  verbose)
inline

Definition at line 171 of file G4PDGCodeChecker.hh.

172 {
173  verboseLevel = value;
174 }
Here is the caller graph for this function:

Member Data Documentation

◆ code

G4int G4PDGCodeChecker::code
private

Definition at line 87 of file G4PDGCodeChecker.hh.

◆ exotic

G4int G4PDGCodeChecker::exotic
private

Definition at line 91 of file G4PDGCodeChecker.hh.

◆ higherSpin

G4int G4PDGCodeChecker::higherSpin
private

Definition at line 90 of file G4PDGCodeChecker.hh.

◆ multiplet

G4int G4PDGCodeChecker::multiplet
private

Definition at line 93 of file G4PDGCodeChecker.hh.

◆ quark1

G4int G4PDGCodeChecker::quark1
private

Definition at line 94 of file G4PDGCodeChecker.hh.

◆ quark2

G4int G4PDGCodeChecker::quark2
private

Definition at line 95 of file G4PDGCodeChecker.hh.

◆ quark3

G4int G4PDGCodeChecker::quark3
private

Definition at line 96 of file G4PDGCodeChecker.hh.

◆ radial

G4int G4PDGCodeChecker::radial
private

Definition at line 92 of file G4PDGCodeChecker.hh.

◆ spin

G4int G4PDGCodeChecker::spin
private

Definition at line 97 of file G4PDGCodeChecker.hh.

◆ theAntiQuarkContent

G4int G4PDGCodeChecker::theAntiQuarkContent[NumberOfQuarkFlavor]
private

Definition at line 100 of file G4PDGCodeChecker.hh.

◆ theParticleType

G4String G4PDGCodeChecker::theParticleType
private

Definition at line 88 of file G4PDGCodeChecker.hh.

◆ theQuarkContent

G4int G4PDGCodeChecker::theQuarkContent[NumberOfQuarkFlavor]
private

Definition at line 99 of file G4PDGCodeChecker.hh.

◆ verboseLevel

G4int G4PDGCodeChecker::verboseLevel
private

Definition at line 85 of file G4PDGCodeChecker.hh.


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