Geant4 9.6.0
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 ()
 
G4int operator== (const G4VParticlePropertyReporter &right) const
 
G4int 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 44 of file G4TextPPReporter.hh.

Constructor & Destructor Documentation

◆ G4TextPPReporter()

G4TextPPReporter::G4TextPPReporter ( )

◆ ~G4TextPPReporter()

G4TextPPReporter::~G4TextPPReporter ( )
virtual

Definition at line 54 of file G4TextPPReporter.cc.

55{
56}

Member Function Documentation

◆ GeneratePropertyTable()

void G4TextPPReporter::GeneratePropertyTable ( const G4ParticleDefinition particle)
protected

Definition at line 86 of file G4TextPPReporter.cc.

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

Referenced by Print().

◆ Print()

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

Implements G4VParticlePropertyReporter.

Definition at line 59 of file G4TextPPReporter.cc.

60{
61 SparseOption( option );
62
63 for (size_t i=0; i< pList.size(); i++){
64 G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle( pList[i]->GetParticleName() );
65
66 GeneratePropertyTable(particle);
67 }
68}
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 71 of file G4TextPPReporter.cc.

72{
73 G4Tokenizer savedToken( option );
74
75 // 1st option : base directory
76 baseDir = savedToken();
77 if (!baseDir.isNull()) {
78 if(baseDir(baseDir.length()-1)!='/') {
79 baseDir += "/";
80 }
81 }
82}
G4bool isNull() const

Referenced by Print().

Member Data Documentation

◆ baseDir

G4String G4TextPPReporter::baseDir
protected

Definition at line 61 of file G4TextPPReporter.hh.

Referenced by GeneratePropertyTable(), and SparseOption().


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