Geant4 11.1.1
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

 G4TextPPReporter ()
 
virtual ~G4TextPPReporter ()
 
virtual void Print (const G4String &option="")
 
- 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 ()
 
virtual void Print (const G4String &option)=0
 
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
typedef std::vector< G4ParticlePropertyData * > G4PPDContainer
 

Detailed Description

Definition at line 43 of file G4TextPPReporter.hh.

Constructor & Destructor Documentation

◆ G4TextPPReporter()

G4TextPPReporter::G4TextPPReporter ( )

◆ ~G4TextPPReporter()

G4TextPPReporter::~G4TextPPReporter ( )
virtual

Definition at line 53 of file G4TextPPReporter.cc.

54{
55}

Member Function Documentation

◆ 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}
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)
const char * name(G4int ptype)

Referenced by Print().

◆ 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)
static G4ParticleTable * GetParticleTable()
void SparseOption(const G4String &option)
void GeneratePropertyTable(const G4ParticleDefinition *)

◆ 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}

Referenced by Print().

Member Data Documentation

◆ baseDir

G4String G4TextPPReporter::baseDir
protected

Definition at line 60 of file G4TextPPReporter.hh.

Referenced by GeneratePropertyTable(), and SparseOption().


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