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

#include <G4TextPPReporter.hh>

+ Inheritance diagram for G4TextPPReporter:

Public Member Functions

void Print (const G4String &option="") override
 
- Public Member Functions inherited from G4VParticlePropertyReporter
 G4VParticlePropertyReporter ()
 
virtual ~G4VParticlePropertyReporter ()
 
G4bool operator== (const G4VParticlePropertyReporter &right) const
 
G4bool operator!= (const G4VParticlePropertyReporter &right) const
 
virtual G4bool FillList (G4String name)
 
virtual void Clear ()
 
const G4PPDContainerGetList () const
 

Protected Member Functions

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

Protected Attributes

G4String baseDir
 
- Protected Attributes inherited from G4VParticlePropertyReporter
G4PPDContainer pList
 
G4ParticlePropertyTablepPropertyTable
 

Additional Inherited Members

- Public Types inherited from G4VParticlePropertyReporter
using G4PPDContainer = std::vector<G4ParticlePropertyData*>
 

Detailed Description

Definition at line 32 of file G4TextPPReporter.hh.

Member Function Documentation

◆ GeneratePropertyTable()

void G4TextPPReporter::GeneratePropertyTable ( const G4ParticleDefinition * particle)
protected

Definition at line 65 of file G4TextPPReporter.cc.

66{
67 G4String name = particle->GetParticleName();
68
69 //--- open file -----
70 G4String fileName = baseDir + name + ".txt";
71 // exception
72 if (name == "J/psi") fileName = baseDir + "jpsi.txt";
73
74 std::ofstream outFile(fileName, std::ios::out);
75 outFile.setf(std::ios::scientific, std::ios::floatfield);
76 outFile << std::setprecision(7) << G4endl;
77
78 // particle name encoding
79 outFile << name << " " << particle->GetPDGEncoding() << G4endl;
80
81 // IJPC
82 outFile << particle->GetPDGiIsospin() << " " << particle->GetPDGiSpin() << " "
83 << particle->GetPDGiParity() << " " << particle->GetPDGiConjugation() << G4endl;
84
85 // mass, width, charge
86 outFile << particle->GetPDGMass() / GeV << " " << particle->GetPDGWidth() / GeV << " "
87 << particle->GetPDGCharge() / eplus << G4endl;
88
89 // life time
90 outFile << particle->GetPDGLifeTime() / second << G4endl;
91
92 // Decay Table
93 G4DecayTable* dcyTable = particle->GetDecayTable();
94 if (dcyTable != nullptr) {
95 for (G4int i = 0; i < dcyTable->entries(); i++) {
96 G4VDecayChannel* channel = dcyTable->GetDecayChannel(i);
97 // column 1 : BR
98 outFile << channel->GetBR() << " ";
99 // column 2. : daughters
100 outFile << channel->GetNumberOfDaughters() << " ";
101 // column 3 : Kinematics
102 outFile << channel->GetKinematicsName() << " ";
103 // daughters
104 for (G4int j = 0; j < channel->GetNumberOfDaughters(); j++) {
105 outFile << channel->GetDaughter(j)->GetParticleName() << " ";
106 }
107 outFile << G4endl;
108 }
109 }
110}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int entries() 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)
const char * name(G4int ptype)

Referenced by Print().

◆ Print()

void G4TextPPReporter::Print ( const G4String & option = "")
overridevirtual

Implements G4VParticlePropertyReporter.

Definition at line 40 of file G4TextPPReporter.cc.

41{
42 SparseOption(option);
43
44 for (const auto& i : pList) {
45 G4ParticleDefinition* particle =
46 G4ParticleTable::GetParticleTable()->FindParticle(i->GetParticleName());
47
48 GeneratePropertyTable(particle);
49 }
50}
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SparseOption(const G4String &option)
void GeneratePropertyTable(const G4ParticleDefinition *)

◆ SparseOption()

void G4TextPPReporter::SparseOption ( const G4String & option)
protected

Definition at line 52 of file G4TextPPReporter.cc.

53{
54 G4Tokenizer savedToken(option);
55
56 // 1st option : base directory
57 baseDir = savedToken();
58 if (!baseDir.empty()) {
59 if (baseDir.back() != '/') {
60 baseDir += "/";
61 }
62 }
63}

Referenced by Print().

Member Data Documentation

◆ baseDir

G4String G4TextPPReporter::baseDir
protected

Definition at line 42 of file G4TextPPReporter.hh.

Referenced by GeneratePropertyTable(), and SparseOption().


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