158 return g4Particle->GetPDGMass() / GeV;
160 return g4Particle->GetPDGCharge();
162 return g4Particle->GetPDGLifeTime() / second;
164 return g4Particle->GetPDGWidth() / GeV;
166 return g4Particle->GetPDGiParity();
168 return g4Particle->GetPDGSpin();
170 return g4Particle->GetPDGIsospin();
172 return g4Particle->GetPDGIsospin3();
236 G4String g4Value = g4Particle->GetParticleName();
237 G4String rtValue = rtParticle->GetName();
242 std::set<G4String> candidates;
243 std::string rtValueStd = rtValue;
244 char firstChar = rtValueStd[0];
247 if (firstChar >=
'A' && firstChar <=
'Z') {
248 firstChar = tolower(firstChar);
251 candidates.insert(rtValue);
252 std::string::size_type pos = rtValue.find(
"_bar");
253 if (pos == std::string::npos) {
255 G4String candidate = rtValue;
256 candidate.replace(0, 1, std::string(1, firstChar));
257 candidates.insert(candidate);
261 G4String candidate = rtValue;
262 candidate.erase(pos, 4);
263 candidate.insert(0,
"anti");
264 candidates.insert(candidate);
266 candidate.insert(4,
"_");
267 candidates.insert(candidate);
270 candidate.replace(0, 1, std::string(1, firstChar));
271 candidate.erase(pos, 4);
272 candidate.insert(0,
"anti");
273 candidates.insert(candidate);
275 candidate.insert(4,
"_");
276 candidates.insert(candidate);
279 G4bool match =
false;
280 std::set<G4String>::iterator it;
281 for (it = candidates.begin(); it != candidates.end(); it++) {
283 if (it == candidates.begin()) G4cout <<
" ... comparing ";
284 G4cout << *it <<
" ";
286 if (g4Value == *it) {
298 G4cout <<
" " << std::setw(10) << propertyName << std::setw(8)
299 <<
" Root: " << std::setw(12) << rtValue << std::setw(6)
300 <<
" G4: " << std::setw(12) << g4Value;
304 G4cout <<
" " << std::setw(10) << propertyName << std::setw(8)
305 <<
" Root: " << std::setw(12) << rtValue << std::setw(6)
306 <<
" G4: " << std::setw(20) << g4Value << std::setw(6)
307 <<
" pdg: " << std::setw(12) << g4Particle->GetPDGEncoding();
314 G4cout <<
" " << propertyName <<
" equivalent: " << rtValue <<
" "
317 G4cout << std::setw(6) <<
" pdg: " << std::setw(10)
318 << g4Particle->GetPDGEncoding() << G4endl;
341 !(property ==
kLifetime && g4Value < 0 && rtValue == 0)) {
342 G4cout <<
" " << std::setw(10) << propertyName << std::setw(8)
343 <<
" Root: " << std::setw(12) << rtValue << std::setw(6)
344 <<
" G4: " << std::setw(12) << g4Value;
346 G4cout << std::setw(6) <<
" eps: " << std::setw(12)
347 << fabs(g4Value - rtValue) / g4Value;
354 G4cout <<
" " << propertyName <<
" equal" << G4endl;
391 G4bool resultAll =
true;
393 G4ParticleTable* g4ParticleTable = G4ParticleTable::GetParticleTable();
395 const THashList* rootParticles = TDatabasePDG::Instance()->ParticleList();
403 std::set<G4String> names;
404 std::set<G4String> duplicateNames;
406 TIter next(rootParticles);
408 while ((obj = next())) {
409 TParticlePDG* rootParticle = (TParticlePDG*)obj;
410 G4int pdgCode = rootParticle->PdgCode();
413 if (g4Particle && printBanner) {
415 G4cout <<
"=============================================================="
417 << G4endl <<
"Particle: " << std::setw(16)
418 << rootParticle->GetName() <<
" pdg: " << std::setw(10)
420 <<
"=============================================================="
426 G4String name = rootParticle->GetName();
427 if (names.find(name) != names.end()) {
428 G4cout <<
"!!! duplicate name: " << name << G4endl;
429 duplicateNames.insert(name);
435 G4cout <<
" no G4 particle equivalent to Root: "
436 << rootParticle->GetName() <<
" pdg = " << pdgCode << G4endl
442 resultAll = resultAll && result;
449 if (duplicateNames.size() > 0) {
450 G4cout <<
"!!! Found duplicate particle names: ";
451 std::set<G4String>::iterator it;
452 for (it = duplicateNames.begin(); it != duplicateNames.end(); it++) {
453 G4cout << *it <<
" ";
467 TParticlePDG* rootParticle =
468 TDatabasePDG::Instance()->GetParticle(pdgEncoding);
470 TString text =
"Particle with PDG encoding ";
472 text +=
" not found in TDatabasePDG.";
478 G4ParticleTable::GetParticleTable()->FindParticle(pdgEncoding);
480 TString text =
"Particle with PDG encoding ";
482 text +=
" not found in G4ParticleTable.";
487 G4int pdgCode = rootParticle->PdgCode();
488 G4cout <<
"Particle: " << std::setw(16) << rootParticle->GetName()
489 <<
" pdg: " << std::setw(10) << pdgCode << G4endl <<
" ";
Definition of the TG4ParticlesChecker class.
G4bool CheckParticle(G4int pdgEncoding) const
ParticleProperty
The enumeration of "checkable" particle properties.
void SetChecking(ParticleProperty property, G4bool check)
std::set< ParticleProperty > fCheckedProperties
set of properties selected for checking
static G4String GetParticlePropertyName(ParticleProperty property)
static ParticleProperty GetParticleProperty(const G4String &propertyName)
static const G4double fgkDefaultPrecision
default precision
TG4ParticlesCheckerMessenger fMessenger
messenger for this class
void PrintCheckedProperties() const
G4bool CheckParticles() const
G4bool CheckName(G4ParticleDefinition *g4Particle, TParticlePDG *rtParticle) const
G4bool IsEqualRel(G4double dx, G4double dy, G4double epsilon) const
std::set< ParticleProperty > fAvailableProperties
set of available properties
G4double GetPropertyValue(ParticleProperty property, G4ParticleDefinition *g4Particle) const
G4bool CheckProperty(ParticleProperty property, G4ParticleDefinition *g4Particle, TParticlePDG *rtParticle) const