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

#include <G4TextPPReporter.hh>

Inheritance diagram for G4TextPPReporter:
G4VParticlePropertyReporter

Public Types

typedef std::vector< G4ParticlePropertyData * > G4PPDContainer
 

Public Member Functions

virtual void Clear ()
 
virtual G4bool FillList (G4String name)
 
 G4TextPPReporter ()
 
const G4PPDContainerGetList () const
 
G4bool operator!= (const G4VParticlePropertyReporter &right) const
 
G4bool operator== (const G4VParticlePropertyReporter &right) const
 
virtual void Print (const G4String &option="")
 
virtual ~G4TextPPReporter ()
 

Protected Member Functions

void GeneratePropertyTable (const G4ParticleDefinition *)
 
void SparseOption (const G4String &option)
 

Protected Attributes

G4String baseDir
 
G4PPDContainer pList
 
G4ParticlePropertyTablepPropertyTable
 

Detailed Description

Definition at line 43 of file G4TextPPReporter.hh.

Member Typedef Documentation

◆ G4PPDContainer

Definition at line 63 of file G4VParticlePropertyReporter.hh.

Constructor & Destructor Documentation

◆ G4TextPPReporter()

G4TextPPReporter::G4TextPPReporter ( )

◆ ~G4TextPPReporter()

G4TextPPReporter::~G4TextPPReporter ( )
virtual

Definition at line 53 of file G4TextPPReporter.cc.

54{
55}

Member Function Documentation

◆ Clear()

void G4VParticlePropertyReporter::Clear ( )
virtualinherited

Definition at line 85 of file G4VParticlePropertyReporter.cc.

86{
87 pList.clear();
88}

References G4VParticlePropertyReporter::pList.

◆ FillList()

G4bool G4VParticlePropertyReporter::FillList ( G4String  name)
virtualinherited

Definition at line 53 of file G4VParticlePropertyReporter.cc.

54{
56 G4bool result = false;
57 if (pData != 0) {
58 //the particle exists
59 pList.push_back(pData);
60 result = true;
61 } else {
62 // pointer to the particle table
65 theParticleIterator = theParticleTable->GetIterator();
66
67 // loop over all particles in G4ParticleTable
68 theParticleIterator->reset();
69 while( (*theParticleIterator)() ){ // Loop checking, 09.08.2015, K.Kurashige
70 G4ParticleDefinition* particle = theParticleIterator->value();
71 G4String type = particle->GetParticleType();
72 pData =pPropertyTable->GetParticleProperty(particle);
73 if ( name == "all" ) {
74 pList.push_back(pData);
75 result = true;
76 } else if ( name == type ) {
77 pList.push_back(pData);
78 result = true;
79 }
80 }
81 }
82 return result;
83}
bool G4bool
Definition: G4Types.hh:86
#define theParticleIterator
const G4String & GetParticleType() const
G4ParticlePropertyData * GetParticleProperty(const G4String &aParticleName)
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()
G4ParticlePropertyTable * pPropertyTable
const char * name(G4int ptype)

References G4ParticleTable::GetIterator(), G4ParticlePropertyTable::GetParticleProperty(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetParticleType(), G4InuclParticleNames::name(), G4VParticlePropertyReporter::pList, G4VParticlePropertyReporter::pPropertyTable, and theParticleIterator.

◆ GeneratePropertyTable()

void G4TextPPReporter::GeneratePropertyTable ( const G4ParticleDefinition particle)
protected

Definition at line 85 of file G4TextPPReporter.cc.

86{
87 G4String name = particle->GetParticleName();
88
89 //--- open file -----
90 G4String fileName = baseDir + name + ".txt";
91 // exception
92 if (name == "J/psi") fileName = baseDir +"jpsi.txt";
93
94 std::ofstream outFile(fileName, std::ios::out );
95 outFile.setf( std::ios:: scientific, std::ios::floatfield );
96 outFile << std::setprecision(7) << G4endl;
97
98 // particle name encoding
99 outFile << name << " "
100 << particle->GetPDGEncoding() << G4endl;
101
102 // IJPC
103 outFile << particle->GetPDGiIsospin() << " "
104 << particle->GetPDGiSpin() << " "
105 << particle->GetPDGiParity() << " "
106 << particle->GetPDGiConjugation() << G4endl;
107
108 // mass, width, charge
109 outFile << particle->GetPDGMass()/GeV << " "
110 << particle->GetPDGWidth()/GeV << " "
111 << particle->GetPDGCharge()/eplus << G4endl;
112
113 // life time
114 outFile << particle->GetPDGLifeTime()/second << G4endl;
115
116// Decay Table
117 G4DecayTable* dcyTable = particle->GetDecayTable();
118 if (dcyTable != 0) {
119 for (G4int i=0; i< dcyTable->entries(); i++){
120 G4VDecayChannel * channel = dcyTable->GetDecayChannel(i);
121 // column 1 : BR
122 outFile << channel->GetBR() << " ";
123 // column 2. : daughters
124 outFile << channel->GetNumberOfDaughters() << " ";
125 // column 3 : Kinematics
126 outFile << channel->GetKinematicsName() << " ";
127 // daughters
128 for (G4int j=0; j< channel->GetNumberOfDaughters(); j++){
129 outFile << channel->GetDaughter(j)->GetParticleName() << " ";
130 }
131 outFile << G4endl;
132 }
133 }
134}
static constexpr double eplus
Definition: G4SIunits.hh:184
static constexpr double second
Definition: G4SIunits.hh:137
static constexpr double GeV
Definition: G4SIunits.hh:203
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int entries() const
G4double GetPDGWidth() const
G4double GetPDGCharge() const
G4DecayTable * GetDecayTable() const
G4double GetPDGLifeTime() const
const G4String & GetParticleName() const
G4double GetBR() const
const G4String & GetKinematicsName() const
G4int GetNumberOfDaughters() const
G4ParticleDefinition * GetDaughter(G4int anIndex)

References baseDir, G4DecayTable::entries(), eplus, G4endl, G4VDecayChannel::GetBR(), G4VDecayChannel::GetDaughter(), G4DecayTable::GetDecayChannel(), G4ParticleDefinition::GetDecayTable(), G4VDecayChannel::GetKinematicsName(), G4VDecayChannel::GetNumberOfDaughters(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGEncoding(), G4ParticleDefinition::GetPDGiConjugation(), G4ParticleDefinition::GetPDGiIsospin(), G4ParticleDefinition::GetPDGiParity(), G4ParticleDefinition::GetPDGiSpin(), G4ParticleDefinition::GetPDGLifeTime(), G4ParticleDefinition::GetPDGMass(), G4ParticleDefinition::GetPDGWidth(), GeV, G4InuclParticleNames::name(), and second.

Referenced by Print().

◆ GetList()

const G4PPDContainer & G4VParticlePropertyReporter::GetList ( ) const
inlineinherited

Definition at line 76 of file G4VParticlePropertyReporter.hh.

76{return pList;}

References G4VParticlePropertyReporter::pList.

◆ operator!=()

G4bool G4VParticlePropertyReporter::operator!= ( const G4VParticlePropertyReporter right) const
inlineinherited

Definition at line 59 of file G4VParticlePropertyReporter.hh.

60 { return (this != &right); }

◆ operator==()

G4bool G4VParticlePropertyReporter::operator== ( const G4VParticlePropertyReporter right) const
inlineinherited

Definition at line 56 of file G4VParticlePropertyReporter.hh.

57 { return (this == &right); }

◆ Print()

void G4TextPPReporter::Print ( const G4String option = "")
virtual

Implements G4VParticlePropertyReporter.

Definition at line 58 of file G4TextPPReporter.cc.

59{
60 SparseOption( option );
61
62 for (size_t i=0; i< pList.size(); i++){
63 G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle( pList[i]->GetParticleName() );
64
65 GeneratePropertyTable(particle);
66 }
67}
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SparseOption(const G4String &option)
void GeneratePropertyTable(const G4ParticleDefinition *)

References G4ParticleTable::FindParticle(), GeneratePropertyTable(), G4ParticleTable::GetParticleTable(), G4VParticlePropertyReporter::pList, and SparseOption().

◆ SparseOption()

void G4TextPPReporter::SparseOption ( const G4String option)
protected

Definition at line 70 of file G4TextPPReporter.cc.

71{
72 G4Tokenizer savedToken( option );
73
74 // 1st option : base directory
75 baseDir = savedToken();
76 if (!baseDir.empty()) {
77 if(baseDir.back()!='/') {
78 baseDir += "/";
79 }
80 }
81}

References baseDir.

Referenced by Print().

Field Documentation

◆ baseDir

G4String G4TextPPReporter::baseDir
protected

Definition at line 60 of file G4TextPPReporter.hh.

Referenced by GeneratePropertyTable(), and SparseOption().

◆ pList

G4PPDContainer G4VParticlePropertyReporter::pList
protectedinherited

◆ pPropertyTable

G4ParticlePropertyTable* G4VParticlePropertyReporter::pPropertyTable
protectedinherited

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