Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4ParticlesChecker Class Reference

A helper class for comparing the basic particles properties in between Root and Geant4. More...

#include <TG4ParticlesChecker.h>

Inheritance diagram for TG4ParticlesChecker:

Public Types

enum  ParticleProperty {
  kName , kMass , kCharge , kLifetime ,
  kWidth , kParity , kSpin , kIsospin ,
  kIsospin3 , kNone
}
 The enumeration of "checkable" particle properties. More...
 

Public Member Functions

 TG4ParticlesChecker ()
 
 ~TG4ParticlesChecker ()
 
G4bool CheckParticles () const
 
G4bool CheckParticle (G4int pdgEncoding) const
 
void SetChecking (ParticleProperty property, G4bool check)
 
void SetPrecision (G4double precision)
 
const std::set< ParticleProperty > & GetAvailableProperties () const
 
const std::set< ParticleProperty > & GetCheckedProperties () const
 
- Public Member Functions inherited from TG4Verbose
 TG4Verbose (const G4String &cmdName)
 
 TG4Verbose (const G4String &cmdName, G4int verboseLevel)
 
virtual ~TG4Verbose ()
 
virtual void VerboseLevel (G4int level)
 
virtual G4int VerboseLevel () const
 

Static Public Member Functions

static G4String GetParticlePropertyName (ParticleProperty property)
 
static ParticleProperty GetParticleProperty (const G4String &propertyName)
 

Private Member Functions

 TG4ParticlesChecker (const TG4ParticlesChecker &right)
 Not implemented.
 
TG4ParticlesCheckeroperator= (const TG4ParticlesChecker &right)
 Not implemented.
 
G4bool IsEqualRel (G4double dx, G4double dy, G4double epsilon) const
 
G4double GetPropertyValue (ParticleProperty property, G4ParticleDefinition *g4Particle) const
 
G4double GetPropertyValue (ParticleProperty property, TParticlePDG *rtParticle) const
 
void PrintCheckedProperties () const
 
G4bool CheckName (G4ParticleDefinition *g4Particle, TParticlePDG *rtParticle) const
 
G4bool CheckProperty (ParticleProperty property, G4ParticleDefinition *g4Particle, TParticlePDG *rtParticle) const
 
G4bool CheckParticle (G4ParticleDefinition *g4Particle, TParticlePDG *rtParticle) const
 

Private Attributes

TG4ParticlesCheckerMessenger fMessenger
 messenger for this class
 
std::set< ParticlePropertyfAvailableProperties
 set of available properties
 
std::set< ParticlePropertyfCheckedProperties
 set of properties selected for checking
 
G4double fPrecision
 precision for checking
 

Static Private Attributes

static const G4double fgkDefaultPrecision = 1.e-06
 default precision
 

Detailed Description

A helper class for comparing the basic particles properties in between Root and Geant4.

Verbose level:

  • 1 : standard output
  • 2 : printing also Root particles which have no equivalent in G4
  • 3 : printing name candidates which are compared and more messages
Author
I. Hrivnacova; IPN Orsay

Definition at line 38 of file TG4ParticlesChecker.h.

Member Enumeration Documentation

◆ ParticleProperty

The enumeration of "checkable" particle properties.

Enumerator
kName 

mass

kMass 

mass

kCharge 

charge

kLifetime 

lifetime

kWidth 

width

kParity 

parity

kSpin 

spin

kIsospin 

isospin

kIsospin3 

isospin3

kNone 

no property

Definition at line 42 of file TG4ParticlesChecker.h.

Constructor & Destructor Documentation

◆ TG4ParticlesChecker() [1/2]

TG4ParticlesChecker::TG4ParticlesChecker ( )

Default constructor

Definition at line 101 of file TG4ParticlesChecker.cxx.

◆ ~TG4ParticlesChecker()

TG4ParticlesChecker::~TG4ParticlesChecker ( )

Destructor

Definition at line 130 of file TG4ParticlesChecker.cxx.

◆ TG4ParticlesChecker() [2/2]

TG4ParticlesChecker::TG4ParticlesChecker ( const TG4ParticlesChecker & right)
private

Not implemented.

Member Function Documentation

◆ GetParticlePropertyName()

G4String TG4ParticlesChecker::GetParticlePropertyName ( ParticleProperty property)
static

Return the name of property given by ParticleProperty code

Definition at line 39 of file TG4ParticlesChecker.cxx.

Referenced by CheckName(), CheckProperty(), GetParticleProperty(), TG4ParticlesCheckerMessenger::Init(), and PrintCheckedProperties().

◆ GetParticleProperty()

TG4ParticlesChecker::ParticleProperty TG4ParticlesChecker::GetParticleProperty ( const G4String & propertyName)
static

Return the ParticleProperty code fore the property given by name

Definition at line 69 of file TG4ParticlesChecker.cxx.

Referenced by TG4ParticlesCheckerMessenger::SetNewValue().

◆ CheckParticles()

G4bool TG4ParticlesChecker::CheckParticles ( ) const

Loop over Root particles database and check the particles properties wrt Geant4 particles. Return true if all particles selected properties match.

Definition at line 385 of file TG4ParticlesChecker.cxx.

Referenced by TG4ParticlesCheckerMessenger::SetNewValue().

◆ CheckParticle() [1/2]

G4bool TG4ParticlesChecker::CheckParticle ( G4int pdgEncoding) const

Check the properties of the particle with given pdgEncoding. Return true if all particle selected properties match

Definition at line 462 of file TG4ParticlesChecker.cxx.

Referenced by CheckParticle(), CheckParticles(), and TG4ParticlesCheckerMessenger::SetNewValue().

◆ SetChecking()

void TG4ParticlesChecker::SetChecking ( ParticleProperty property,
G4bool check )

Select or deselect the given property for checking.

Definition at line 497 of file TG4ParticlesChecker.cxx.

Referenced by TG4ParticlesCheckerMessenger::SetNewValue().

◆ SetPrecision()

void TG4ParticlesChecker::SetPrecision ( G4double precision)
inline

Set the precision for checking.

Definition at line 117 of file TG4ParticlesChecker.h.

Referenced by TG4ParticlesCheckerMessenger::SetNewValue().

◆ GetAvailableProperties()

const std::set< TG4ParticlesChecker::ParticleProperty > & TG4ParticlesChecker::GetAvailableProperties ( ) const
inline

Return the set of available properties

Definition at line 124 of file TG4ParticlesChecker.h.

Referenced by TG4ParticlesCheckerMessenger::Init().

◆ GetCheckedProperties()

const std::set< TG4ParticlesChecker::ParticleProperty > & TG4ParticlesChecker::GetCheckedProperties ( ) const
inline

Return the set of properties selected for checking

Definition at line 131 of file TG4ParticlesChecker.h.

◆ operator=()

TG4ParticlesChecker & TG4ParticlesChecker::operator= ( const TG4ParticlesChecker & right)
private

Not implemented.

◆ IsEqualRel()

G4bool TG4ParticlesChecker::IsEqualRel ( G4double dx,
G4double dy,
G4double epsilon ) const
private

The function to compare given values dx and dy; the values are found equal if there difference relative to the first value is within the given precision epsilon.

Definition at line 140 of file TG4ParticlesChecker.cxx.

Referenced by CheckProperty().

◆ GetPropertyValue() [1/2]

G4double TG4ParticlesChecker::GetPropertyValue ( ParticleProperty property,
G4ParticleDefinition * g4Particle ) const
private

Return the given property value for the given Geant4 particle

Definition at line 151 of file TG4ParticlesChecker.cxx.

Referenced by CheckProperty().

◆ GetPropertyValue() [2/2]

G4double TG4ParticlesChecker::GetPropertyValue ( ParticleProperty property,
TParticlePDG * rtParticle ) const
private

Return the given property value for the given Root particle

Definition at line 180 of file TG4ParticlesChecker.cxx.

◆ PrintCheckedProperties()

void TG4ParticlesChecker::PrintCheckedProperties ( ) const
private

Print the list of properties selected for checking and the selected precision

Definition at line 209 of file TG4ParticlesChecker.cxx.

Referenced by CheckParticle(), and CheckParticles().

◆ CheckName()

G4bool TG4ParticlesChecker::CheckName ( G4ParticleDefinition * g4Particle,
TParticlePDG * rtParticle ) const
private

Check if the given property values in Geant4 and Root for the given particle are equal within the defined precision. Return true if values match, otherwise print the property name and values and return false.

Definition at line 228 of file TG4ParticlesChecker.cxx.

Referenced by CheckProperty().

◆ CheckProperty()

G4bool TG4ParticlesChecker::CheckProperty ( ParticleProperty property,
G4ParticleDefinition * g4Particle,
TParticlePDG * rtParticle ) const
private

Check if the given property values in Geant4 and Root for the given particle are equal within the defined precision. Return true if values match, otherwise print the property name and values and return false.

Definition at line 327 of file TG4ParticlesChecker.cxx.

Referenced by CheckParticle().

◆ CheckParticle() [2/2]

G4bool TG4ParticlesChecker::CheckParticle ( G4ParticleDefinition * g4Particle,
TParticlePDG * rtParticle ) const
private

Check all selected properties for the given Geant4 and Root particles.

Definition at line 360 of file TG4ParticlesChecker.cxx.

Member Data Documentation

◆ fgkDefaultPrecision

const G4double TG4ParticlesChecker::fgkDefaultPrecision = 1.e-06
staticprivate

default precision

Definition at line 98 of file TG4ParticlesChecker.h.

◆ fMessenger

TG4ParticlesCheckerMessenger TG4ParticlesChecker::fMessenger
private

messenger for this class

Definition at line 103 of file TG4ParticlesChecker.h.

Referenced by TG4ParticlesChecker().

◆ fAvailableProperties

std::set<ParticleProperty> TG4ParticlesChecker::fAvailableProperties
private

set of available properties

Definition at line 106 of file TG4ParticlesChecker.h.

Referenced by GetAvailableProperties(), and TG4ParticlesChecker().

◆ fCheckedProperties

std::set<ParticleProperty> TG4ParticlesChecker::fCheckedProperties
private

set of properties selected for checking

Definition at line 109 of file TG4ParticlesChecker.h.

Referenced by CheckName(), CheckParticle(), CheckParticles(), GetCheckedProperties(), PrintCheckedProperties(), SetChecking(), and TG4ParticlesChecker().

◆ fPrecision

G4double TG4ParticlesChecker::fPrecision
private

precision for checking

Definition at line 112 of file TG4ParticlesChecker.h.

Referenced by CheckProperty(), PrintCheckedProperties(), and SetPrecision().


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