Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 << 22 // >> 23 // the GEANT4 collaboration. >> 24 // >> 25 // By copying, distributing or modifying the Program (or any work >> 26 // based on the Program) you indicate your acceptance of this statement, >> 27 // and all its terms. >> 28 // >> 29 // $Id: G4TextPPReporter.cc,v 1.1 2004/03/11 09:47:45 kurasige Exp $ >> 30 // GEANT4 tag $Name: geant4-06-01 $ >> 31 // >> 32 // >> 33 // --------------------------------------------------------------- 26 #include "G4TextPPReporter.hh" 34 #include "G4TextPPReporter.hh" 27 << 28 #include "G4DecayTable.hh" << 29 #include "G4ParticleDefinition.hh" << 30 #include "G4ParticleTable.hh" << 31 #include "G4SystemOfUnits.hh" << 32 #include "G4Tokenizer.hh" << 33 #include "G4VDecayChannel.hh" << 34 #include "G4ios.hh" 35 #include "G4ios.hh" 35 #include "globals.hh" 36 #include "globals.hh" 36 << 37 #include "G4DecayTable.hh" 37 #include <fstream> << 38 #include "G4Tokenizer.hh" 38 #include <iomanip> 39 #include <iomanip> >> 40 #include <fstream> 39 41 >> 42 ////////////////////////////// >> 43 G4TextPPReporter::G4TextPPReporter():G4VParticlePropertyReporter() >> 44 { >> 45 } >> 46 >> 47 //////////////////////////// >> 48 G4TextPPReporter::~G4TextPPReporter() >> 49 { >> 50 } >> 51 >> 52 ///////////////////// 40 void G4TextPPReporter::Print(const G4String& o 53 void G4TextPPReporter::Print(const G4String& option) 41 { 54 { 42 SparseOption(option); << 55 SparseOption( option ); 43 56 44 for (const auto& i : pList) { << 57 for (size_t i=0; i< pList.size(); i++){ 45 G4ParticleDefinition* particle = << 58 G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle( pList[i]->GetParticleName() ); 46 G4ParticleTable::GetParticleTable()->Fin << 47 59 48 GeneratePropertyTable(particle); 60 GeneratePropertyTable(particle); 49 } 61 } 50 } << 62 } >> 63 51 64 52 void G4TextPPReporter::SparseOption(const G4St 65 void G4TextPPReporter::SparseOption(const G4String& option) 53 { 66 { 54 G4Tokenizer savedToken(option); << 67 G4Tokenizer savedToken( option ); 55 << 68 56 // 1st option : base directory 69 // 1st option : base directory 57 baseDir = savedToken(); 70 baseDir = savedToken(); 58 if (!baseDir.empty()) { << 71 if (!baseDir.isNull()) { 59 if (baseDir.back() != '/') { << 72 if(baseDir(baseDir.length()-1)!='/') { 60 baseDir += "/"; 73 baseDir += "/"; 61 } 74 } 62 } 75 } 63 } 76 } 64 77 65 void G4TextPPReporter::GeneratePropertyTable(c << 78 >> 79 >> 80 void G4TextPPReporter::GeneratePropertyTable(G4ParticleDefinition* particle) 66 { 81 { 67 G4String name = particle->GetParticleName(); 82 G4String name = particle->GetParticleName(); 68 << 83 69 //--- open file ----- 84 //--- open file ----- 70 G4String fileName = baseDir + name + ".txt"; 85 G4String fileName = baseDir + name + ".txt"; 71 // exception 86 // exception 72 if (name == "J/psi") fileName = baseDir + "j << 87 if (name == "J/psi") fileName = baseDir +"jpsi.txt"; 73 88 74 std::ofstream outFile(fileName, std::ios::ou << 89 std::ofstream outFile(fileName, std::ios::out ); 75 outFile.setf(std::ios::scientific, std::ios: << 90 outFile.setf( std::ios:: scientific, std::ios::floatfield ); 76 outFile << std::setprecision(7) << G4endl; 91 outFile << std::setprecision(7) << G4endl; 77 92 78 // particle name encoding 93 // particle name encoding 79 outFile << name << " " << particle->GetPDGEn << 94 outFile << name << " " >> 95 << particle->GetPDGEncoding() << G4endl; 80 96 81 // IJPC 97 // IJPC 82 outFile << particle->GetPDGiIsospin() << " " << 98 outFile << particle->GetPDGiIsospin() << " " 83 << particle->GetPDGiParity() << " " << 99 << particle->GetPDGiSpin() << " " 84 << 100 << particle->GetPDGiParity() << " " 85 // mass, width, charge << 101 << particle->GetPDGiConjugation() << G4endl; 86 outFile << particle->GetPDGMass() / GeV << " << 102 87 << particle->GetPDGCharge() / eplus << 103 // mass, width, charge >> 104 outFile << particle->GetPDGMass()/GeV << " " >> 105 << particle->GetPDGWidth()/GeV << " " >> 106 << particle->GetPDGCharge()/eplus << G4endl; 88 107 89 // life time 108 // life time 90 outFile << particle->GetPDGLifeTime() / seco << 109 outFile << particle->GetPDGLifeTime()/second << G4endl; 91 110 92 // Decay Table << 111 // Decay Table 93 G4DecayTable* dcyTable = particle->GetDecayT << 112 G4DecayTable* dcyTable = particle->GetDecayTable(); 94 if (dcyTable != nullptr) { << 113 if (dcyTable != 0) { 95 for (G4int i = 0; i < dcyTable->entries(); << 114 for (G4int i=0; i< dcyTable->entries(); i++){ 96 G4VDecayChannel* channel = dcyTable->Get << 115 G4VDecayChannel * channel = dcyTable->GetDecayChannel(i); 97 // column 1 : BR 116 // column 1 : BR 98 outFile << channel->GetBR() << " "; 117 outFile << channel->GetBR() << " "; 99 // column 2. : daughters 118 // column 2. : daughters 100 outFile << channel->GetNumberOfDaughters 119 outFile << channel->GetNumberOfDaughters() << " "; 101 // column 3 : Kinematics 120 // column 3 : Kinematics 102 outFile << channel->GetKinematicsName() 121 outFile << channel->GetKinematicsName() << " "; 103 // daughters 122 // daughters 104 for (G4int j = 0; j < channel->GetNumber << 123 for (G4int j=0; j< channel->GetNumberOfDaughters(); j++){ 105 outFile << channel->GetDaughter(j)->Ge 124 outFile << channel->GetDaughter(j)->GetParticleName() << " "; 106 } 125 } 107 outFile << G4endl; 126 outFile << G4endl; 108 } 127 } 109 } 128 } 110 } 129 } >> 130 >> 131 >> 132 >> 133 >> 134 111 135