ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TextPPReporter.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TextPPReporter.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // the GEANT4 collaboration.
27 //
28 // By copying, distributing or modifying the Program (or any work
29 // based on the Program) you indicate your acceptance of this statement,
30 // and all its terms.
31 //
32 //
33 //
34 // ---------------------------------------------------------------
35 #include "G4TextPPReporter.hh"
36 #include "G4ios.hh"
37 #include "globals.hh"
38 #include "G4SystemOfUnits.hh"
39 #include "G4ParticleTable.hh"
40 #include "G4ParticleDefinition.hh"
41 #include "G4DecayTable.hh"
42 #include "G4VDecayChannel.hh"
43 #include "G4Tokenizer.hh"
44 #include <iomanip>
45 #include <fstream>
46 
49 {
50 }
51 
54 {
55 }
56 
58 void G4TextPPReporter::Print(const G4String& option)
59 {
60  SparseOption( option );
61 
62  for (size_t i=0; i< pList.size(); i++){
64 
65  GeneratePropertyTable(particle);
66  }
67 }
68 
69 
71 {
72  G4Tokenizer savedToken( option );
73 
74  // 1st option : base directory
75  baseDir = savedToken();
76  if (!baseDir.isNull()) {
77  if(baseDir(baseDir.length()-1)!='/') {
78  baseDir += "/";
79  }
80  }
81 }
82 
83 
84 
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 }
135 
136 
137 
138 
139