Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,52 +1,77 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// 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: G3PartTable.cc,v 1.4 1999/05/28 21:09:02 lockman Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G3PartTable.cc,v 1.7 1999/12/05 17:50:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include <strstream.h>
|
||||
#include "globals.hh"
|
||||
#include "g4std/strstream"
|
||||
#include "g4std/iomanip"
|
||||
#include "G3PartTable.hh"
|
||||
|
||||
typedef G4std::map<G4String, G4ParticleDefinition*, less<G4String> >
|
||||
::iterator PTDiterator;
|
||||
|
||||
G3PartTable::G3PartTable(){
|
||||
_PTD = new RWTPtrHashDictionary<G4String,G4ParticleDefinition>(G4String::hash);
|
||||
}
|
||||
|
||||
G3PartTable::~G3PartTable(){
|
||||
_PTD->clearAndDestroy();
|
||||
delete _PTD;
|
||||
G4cout << "Deleted G3PartTable..." << endl;
|
||||
};
|
||||
if (PTD.size()>0){
|
||||
// G4cout << "Deleting PTD" << endl;
|
||||
for (PTDiterator i=PTD.begin(); i != PTD.end(); i++) {
|
||||
delete (*i).second;
|
||||
}
|
||||
PTD.clear();
|
||||
}
|
||||
}
|
||||
|
||||
G4ParticleDefinition*
|
||||
G3PartTable::get(G4int partid){
|
||||
G4String _ShashID; // static
|
||||
HashID(partid, _ShashID);
|
||||
return _PTD->findValue(&_ShashID);
|
||||
G3PartTable::Get(G4int partid){
|
||||
G4String ShashID; // static
|
||||
HashID(partid, ShashID);
|
||||
PTDiterator i = PTD.find(ShashID);
|
||||
return (*i).second;
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::put(G4int partid, G4ParticleDefinition *partpt){
|
||||
G4String* _HashID = new G4String(); // Dynamic
|
||||
HashID(partid, _HashID);
|
||||
_PTD->insertKeyAndValue(_HashID, partpt);
|
||||
G3PartTable::Put(G4int partid, G4ParticleDefinition *partpt){
|
||||
G4String ShashID; // static
|
||||
HashID(partid, ShashID);
|
||||
PTD[ShashID]=partpt;
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::HashID(G4int partid, G4String& _HashID){
|
||||
G3PartTable::HashID(G4int partid, G4String& theHashID){
|
||||
char s[20];
|
||||
ostrstream ostr(s, sizeof s);
|
||||
ostr << "Part" << partid << ends;
|
||||
_HashID = s;
|
||||
theHashID = s;
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::HashID(G4int partid, G4String* _HashID){
|
||||
HashID(partid, *_HashID);
|
||||
G3PartTable::HashID(G4int partid, G4String* theHashID){
|
||||
HashID(partid, *theHashID);
|
||||
};
|
||||
|
||||
void
|
||||
G3PartTable::PrintAll(){
|
||||
if (PTD.size()>0){
|
||||
G4int count=0;
|
||||
G4cout << "Dump of PTD - " << PTD.size() << " entries: " << endl;
|
||||
for (PTDiterator i=PTD.begin(); i != PTD.end(); i++) {
|
||||
count++;
|
||||
G4ParticleDefinition* aPTD = (*i).second;
|
||||
G4cout << "PTD entry " << setw(3) << count << " particle name: "
|
||||
<< aPTD->GetParticleName() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user