Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PDGCodeChecker Class Reference

#include <G4PDGCodeChecker.hh>

Public Member Functions

 G4PDGCodeChecker ()
 
 ~G4PDGCodeChecker ()=default
 
G4int CheckPDGCode (G4int code, const 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 }
 

Detailed Description

Definition at line 36 of file G4PDGCodeChecker.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
NumberOfQuarkFlavor 

Definition at line 62 of file G4PDGCodeChecker.hh.

63 {
65 };

Constructor & Destructor Documentation

◆ G4PDGCodeChecker()

G4PDGCodeChecker::G4PDGCodeChecker ( )

Definition at line 39 of file G4PDGCodeChecker.cc.

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

◆ ~G4PDGCodeChecker()

G4PDGCodeChecker::~G4PDGCodeChecker ( )
default

Member Function Documentation

◆ CheckCharge()

G4bool G4PDGCodeChecker::CheckCharge ( G4double charge) const

Definition at line 382 of file G4PDGCodeChecker.cc.

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

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ CheckPDGCode()

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

Definition at line 48 of file G4PDGCodeChecker.cc.

49{
50 code = PDGcode;
51 theParticleType = particleType;
52
53 // clear QuarkContents
54 for (G4int flavor = 0; flavor < NumberOfQuarkFlavor; ++flavor) {
55 theQuarkContent[flavor] = 0;
56 theAntiQuarkContent[flavor] = 0;
57 }
58
59 // check code for nuclei
60 if ((theParticleType == "nucleus") || (theParticleType == "anti_nucleus")) {
61 return CheckForNuclei();
62 }
63
64 // get each digit number
65 GetDigits(code);
66
67 // check code
68 if (theParticleType == "quarks") {
69 return CheckForQuarks();
70 }
71 if (theParticleType == "diquarks") {
72 return CheckForDiQuarks();
73 }
74 if (theParticleType == "gluons") {
75 return code; // gluons, do not care about
76 }
77 if (theParticleType == "meson") {
78 return CheckForMesons();
79 }
80 if (theParticleType == "baryon") {
81 return CheckForBaryons();
82 }
83 // No check
84 return code;
85}

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetAntiQuarkContent()

G4int G4PDGCodeChecker::GetAntiQuarkContent ( G4int flavor) const
inline

Definition at line 111 of file G4PDGCodeChecker.hh.

112{
113 G4int value = 0;
114 if ((flavor >= 0) && (flavor < NumberOfQuarkFlavor)) {
115 value = theAntiQuarkContent[flavor];
116 }
117 return value;
118}

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetExotic()

G4int G4PDGCodeChecker::GetExotic ( ) const
inline

Definition at line 134 of file G4PDGCodeChecker.hh.

135{
136 return exotic;
137}

◆ GetMultiplet()

G4int G4PDGCodeChecker::GetMultiplet ( ) const
inline

Definition at line 144 of file G4PDGCodeChecker.hh.

145{
146 return multiplet;
147}

◆ GetQuarkContent()

G4int G4PDGCodeChecker::GetQuarkContent ( G4int flavor) const
inline

Definition at line 102 of file G4PDGCodeChecker.hh.

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

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetQuarkFlavor()

G4int G4PDGCodeChecker::GetQuarkFlavor ( G4int idx) const
inline

Definition at line 120 of file G4PDGCodeChecker.hh.

121{
122 G4int value;
123 if (idx == 0)
124 value = quark1;
125 else if (idx == 1)
126 value = quark2;
127 else if (idx == 2)
128 value = quark3;
129 else
130 value = -1;
131 return value;
132}

◆ GetRadial()

G4int G4PDGCodeChecker::GetRadial ( ) const
inline

Definition at line 139 of file G4PDGCodeChecker.hh.

140{
141 return radial;
142}

◆ GetSpin()

G4int G4PDGCodeChecker::GetSpin ( ) const
inline

Definition at line 149 of file G4PDGCodeChecker.hh.

150{
151 return spin;
152}

Referenced by G4ParticleDefinition::FillQuarkContents().

◆ GetVerboseLevel()

G4int G4PDGCodeChecker::GetVerboseLevel ( ) const
inline

Definition at line 164 of file G4PDGCodeChecker.hh.

165{
166 return verboseLevel;
167}

◆ IsAntiParticle()

G4bool G4PDGCodeChecker::IsAntiParticle ( ) const
inline

Definition at line 154 of file G4PDGCodeChecker.hh.

155{
156 return (code < 0);
157}

◆ SetVerboseLevel()

void G4PDGCodeChecker::SetVerboseLevel ( G4int verbose)
inline

Definition at line 159 of file G4PDGCodeChecker.hh.

160{
161 verboseLevel = value;
162}

Referenced by G4ParticleDefinition::FillQuarkContents().


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