Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G3PartTable Class Reference

#include <G3PartTable.hh>

Public Member Functions

 G3PartTable ()
 
G4ParticleDefinitionGet (G4int partid)
 
void PrintAll ()
 
void Put (G4int partid, G4ParticleDefinition *partpt)
 
virtual ~G3PartTable ()
 

Private Member Functions

void HashID (G4int partid, G4String &_HID)
 
void HashID (G4int partid, G4String *_HID)
 

Private Attributes

std::map< G4String, G4ParticleDefinition *, std::less< G4String > > PTD
 

Detailed Description

Definition at line 42 of file G3PartTable.hh.

Constructor & Destructor Documentation

◆ G3PartTable()

G3PartTable::G3PartTable ( )

Definition at line 37 of file G3PartTable.cc.

37 {
38}

◆ ~G3PartTable()

G3PartTable::~G3PartTable ( )
virtual

Definition at line 40 of file G3PartTable.cc.

40 {
41 if (PTD.size()>0){
42 // G4cout << "Deleting PTD" << G4endl;
43 for (PTDiterator i=PTD.begin(); i != PTD.end(); i++) {
44 delete (*i).second;
45 }
46 PTD.clear();
47 }
48}
std::map< G4String, G4ParticleDefinition *, std::less< G4String > >::iterator PTDiterator
Definition: G3PartTable.cc:35
std::map< G4String, G4ParticleDefinition *, std::less< G4String > > PTD
Definition: G3PartTable.hh:55

References PTD.

Member Function Documentation

◆ Get()

G4ParticleDefinition * G3PartTable::Get ( G4int  partid)

Definition at line 51 of file G3PartTable.cc.

51 {
52 G4String ShashID; // static
53 HashID(partid, ShashID);
54 PTDiterator i = PTD.find(ShashID);
55 return (*i).second;
56}
void HashID(G4int partid, G4String *_HID)
Definition: G3PartTable.cc:73

References HashID(), and PTD.

◆ HashID() [1/2]

void G3PartTable::HashID ( G4int  partid,
G4String _HID 
)
private

Definition at line 66 of file G3PartTable.cc.

66 {
67 std::ostringstream ostr;
68 ostr << "Part" << partid << std::ends;
69 theHashID = ostr.str();
70}

◆ HashID() [2/2]

void G3PartTable::HashID ( G4int  partid,
G4String _HID 
)
private

Definition at line 73 of file G3PartTable.cc.

73 {
74 HashID(partid, *theHashID);
75}

References HashID().

Referenced by Get(), HashID(), and Put().

◆ PrintAll()

void G3PartTable::PrintAll ( )

Definition at line 78 of file G3PartTable.cc.

78 {
79 if (PTD.size()>0){
80 G4int count=0;
81 G4cout << "Dump of PTD - " << PTD.size() << " entries: " << G4endl;
82 for (PTDiterator i=PTD.begin(); i != PTD.end(); i++) {
83 count++;
84 G4ParticleDefinition* aPTD = (*i).second;
85 G4cout << "PTD entry " << std::setw(3) << count << " particle name: "
86 << aPTD->GetParticleName() << G4endl;
87 }
88 }
89}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetParticleName() const

References G4cout, G4endl, G4ParticleDefinition::GetParticleName(), and PTD.

Referenced by G4BuildGeom().

◆ Put()

void G3PartTable::Put ( G4int  partid,
G4ParticleDefinition partpt 
)

Definition at line 59 of file G3PartTable.cc.

59 {
60 G4String ShashID; // static
61 HashID(partid, ShashID);
62 PTD[ShashID]=partpt;
63}

References HashID(), and PTD.

Field Documentation

◆ PTD

std::map<G4String, G4ParticleDefinition*, std::less<G4String> > G3PartTable::PTD
private

Definition at line 55 of file G3PartTable.hh.

Referenced by Get(), PrintAll(), Put(), and ~G3PartTable().


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