Import Geant4 6.1.0 source tree
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HtmlPPReporter.cc,v 1.2 2003/10/30 09:22:41 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4HtmlPPReporter.cc,v 1.3 2004/02/13 06:33:39 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -99,6 +99,8 @@ void G4HtmlPPReporter::SparseOption(const G4String& option)
|
||||
outFile << eTR << G4endl;;
|
||||
|
||||
for (size_t i=0; i< pList.size(); i++){
|
||||
if (pList[i]->GetPDGEncoding()<0) continue;
|
||||
|
||||
outFile << sTR << G4endl;;
|
||||
// column 1 : endcoding
|
||||
outFile << sTD << pList[i]->GetPDGEncoding() << eTD << G4endl;;
|
||||
@@ -132,6 +134,8 @@ void G4HtmlPPReporter::SparseOption(const G4String& option)
|
||||
|
||||
void G4HtmlPPReporter::GeneratePropertyTable(G4ParticleDefinition* particle)
|
||||
{
|
||||
if (particle->GetPDGEncoding()<0) return;
|
||||
|
||||
G4String name = particle->GetParticleName();
|
||||
//--- open index file -----
|
||||
G4String fileName = baseDir + name + ".html";
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimplePPReporter.cc,v 1.1 2003/09/21 19:38:50 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TextPPReporter.cc,v 1.1 2004/03/11 09:47:45 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
#include "G4TextPPReporter.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4DecayTable.hh"
|
||||
#include "G4Tokenizer.hh"
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
|
||||
//////////////////////////////
|
||||
G4TextPPReporter::G4TextPPReporter():G4VParticlePropertyReporter()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
G4TextPPReporter::~G4TextPPReporter()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
void G4TextPPReporter::Print(const G4String& option)
|
||||
{
|
||||
SparseOption( option );
|
||||
|
||||
for (size_t i=0; i< pList.size(); i++){
|
||||
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle( pList[i]->GetParticleName() );
|
||||
|
||||
GeneratePropertyTable(particle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4TextPPReporter::SparseOption(const G4String& option)
|
||||
{
|
||||
G4Tokenizer savedToken( option );
|
||||
|
||||
// 1st option : base directory
|
||||
baseDir = savedToken();
|
||||
if (!baseDir.isNull()) {
|
||||
if(baseDir(baseDir.length()-1)!='/') {
|
||||
baseDir += "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4TextPPReporter::GeneratePropertyTable(G4ParticleDefinition* particle)
|
||||
{
|
||||
G4String name = particle->GetParticleName();
|
||||
|
||||
//--- open file -----
|
||||
G4String fileName = baseDir + name + ".txt";
|
||||
// exception
|
||||
if (name == "J/psi") fileName = baseDir +"jpsi.txt";
|
||||
|
||||
std::ofstream outFile(fileName, std::ios::out );
|
||||
outFile.setf( std::ios:: scientific, std::ios::floatfield );
|
||||
outFile << std::setprecision(7) << G4endl;
|
||||
|
||||
// particle name encoding
|
||||
outFile << name << " "
|
||||
<< particle->GetPDGEncoding() << G4endl;
|
||||
|
||||
// IJPC
|
||||
outFile << particle->GetPDGiIsospin() << " "
|
||||
<< particle->GetPDGiSpin() << " "
|
||||
<< particle->GetPDGiParity() << " "
|
||||
<< particle->GetPDGiConjugation() << G4endl;
|
||||
|
||||
// mass, width, charge
|
||||
outFile << particle->GetPDGMass()/GeV << " "
|
||||
<< particle->GetPDGWidth()/GeV << " "
|
||||
<< particle->GetPDGCharge()/eplus << G4endl;
|
||||
|
||||
// life time
|
||||
outFile << particle->GetPDGLifeTime()/second << G4endl;
|
||||
|
||||
// Decay Table
|
||||
G4DecayTable* dcyTable = particle->GetDecayTable();
|
||||
if (dcyTable != 0) {
|
||||
for (G4int i=0; i< dcyTable->entries(); i++){
|
||||
G4VDecayChannel * channel = dcyTable->GetDecayChannel(i);
|
||||
// column 1 : BR
|
||||
outFile << channel->GetBR() << " ";
|
||||
// column 2. : daughters
|
||||
outFile << channel->GetNumberOfDaughters() << " ";
|
||||
// column 3 : Kinematics
|
||||
outFile << channel->GetKinematicsName() << " ";
|
||||
// daughters
|
||||
for (G4int j=0; j< channel->GetNumberOfDaughters(); j++){
|
||||
outFile << channel->GetDaughter(j)->GetParticleName() << " ";
|
||||
}
|
||||
outFile << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TextPPRetriever.cc,v 1.1 2004/03/11 09:47:45 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
#include "G4TextPPRetriever.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4DecayTable.hh"
|
||||
#include "G4Tokenizer.hh"
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
|
||||
//////////////////////////////
|
||||
G4TextPPRetriever::G4TextPPRetriever():G4VParticlePropertyRetriever()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
G4TextPPRetriever::~G4TextPPRetriever()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
void G4TextPPRetriever::Retrieve(const G4String& option)
|
||||
{
|
||||
SparseOption( option );
|
||||
|
||||
// pointer to the particle table
|
||||
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleTable::G4PTblDicIterator* theParticleIterator;
|
||||
theParticleIterator = theParticleTable->GetIterator();
|
||||
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
ModifyPropertyTable(particle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4TextPPRetriever::SparseOption(const G4String& option)
|
||||
{
|
||||
G4Tokenizer savedToken( option );
|
||||
|
||||
// 1st option : base directory
|
||||
baseDir = savedToken();
|
||||
if (!baseDir.isNull()) {
|
||||
if(baseDir(baseDir.length()-1)!='/') {
|
||||
baseDir += "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4bool G4TextPPRetriever::ModifyPropertyTable(G4ParticleDefinition* particle)
|
||||
{
|
||||
G4String name = particle->GetParticleName();
|
||||
|
||||
//--- open file -----
|
||||
G4String fileName = baseDir + name + ".txt";
|
||||
// exception
|
||||
if (name == "J/psi") fileName = baseDir +"jpsi.txt";
|
||||
|
||||
std::ifstream inFile(fileName, std::ios::in );
|
||||
if (!inFile) return false;
|
||||
|
||||
// GetParticleProperty
|
||||
G4ParticlePropertyData* pData = pPropertyTable->GetParticleProperty(name);
|
||||
|
||||
// particle name encoding
|
||||
G4String name_t;
|
||||
G4int encoding;
|
||||
inFile >> name_t >> encoding;
|
||||
if ( (name != name_t) || (encoding != pData->GetPDGEncoding()) ){
|
||||
G4cout << "G4TextPPRetriever::ModifyPropertyTable: ";
|
||||
G4cout << "particle name or encoding mismatch for " << name ;
|
||||
G4cout << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// IJPC
|
||||
G4int iIsoSpin, iSpin, iParity, iConj;
|
||||
inFile >> iIsoSpin >> iSpin >> iParity >> iConj;
|
||||
if ( ( iIsoSpin != pData->GetPDGiIsospin()) ||
|
||||
( iSpin != pData->GetPDGiSpin()) ||
|
||||
( iParity != pData->GetPDGiParity()) ||
|
||||
( iConj != pData->GetPDGiConjugation()) ){
|
||||
G4cout << "G4TextPPRetriever::ModifyPropertyTable: ";
|
||||
G4cout << "IJPC mismatch for " << name ;
|
||||
G4cout << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// mass, width, charge
|
||||
G4double mass, width, charge;
|
||||
inFile >> mass >> width >> charge;
|
||||
mass *= GeV;
|
||||
width *= GeV;
|
||||
charge *= eplus;
|
||||
if (mass != pData->GetPDGMass()){ pData->SetPDGMass(mass);}
|
||||
if (width != pData->GetPDGWidth()){ pData->SetPDGWidth(width);}
|
||||
if (charge != pData->GetPDGCharge()){ pData->SetPDGCharge(charge);}
|
||||
|
||||
// life time
|
||||
G4double tlife;
|
||||
inFile >> tlife;
|
||||
tlife *= second;
|
||||
if (tlife != pData->GetPDGLifeTime()){ pData->SetPDGLifeTime(tlife);}
|
||||
|
||||
pPropertyTable->SetParticleProperty(*pData);
|
||||
|
||||
// Decay Table
|
||||
G4DecayTable* dcyTable = particle->GetDecayTable();
|
||||
if (dcyTable == 0) return true;
|
||||
|
||||
G4int idx =0;
|
||||
while (!inFile.eof() ) {
|
||||
G4double br;
|
||||
G4int n_daughters;
|
||||
inFile >> br >> n_daughters;
|
||||
|
||||
G4VDecayChannel * channel = dcyTable->GetDecayChannel(idx);
|
||||
|
||||
if ( n_daughters == channel->GetNumberOfDaughters()) {
|
||||
channel->SetBR(br);
|
||||
}
|
||||
|
||||
idx += 1;
|
||||
if (idx>= dcyTable->entries()) break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VParticlePropertyReporter.cc,v 1.1 2003/09/21 19:38:50 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user