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

#include <G3DetTable.hh>

Public Member Functions

 G3DetTable ()
 
G4int GetID (G4String &set, G4String &det)
 
G4VSensitiveDetectorGetSD (G4String &set, G4String &det)
 
void PrintAll ()
 
void Put (G4String &set, G4String &det, G4int id, G4VSensitiveDetector *D)
 
virtual ~G3DetTable ()
 

Private Member Functions

G4String MakeHash (G4String &set, G4String &det)
 

Private Attributes

std::map< G4String, G3DetTableEntry *, std::less< G4String > > DTD
 

Detailed Description

Definition at line 38 of file G3DetTable.hh.

Constructor & Destructor Documentation

◆ G3DetTable()

G3DetTable::G3DetTable ( )

Definition at line 39 of file G3DetTable.cc.

39 {
40}

◆ ~G3DetTable()

G3DetTable::~G3DetTable ( )
virtual

Definition at line 42 of file G3DetTable.cc.

42 {
43 if (DTD.size() > 0) {
44 // G4cout << "Deleting DTD" << G4endl;
45 for (DTDiterator i=DTD.begin(); i != DTD.end(); i++) {
46 delete (*i).second;
47 }
48 DTD.clear();
49 }
50}
std::map< G4String, G3DetTableEntry *, std::less< G4String > >::iterator DTDiterator
Definition: G3DetTable.cc:32
Definition: xmlparse.cc:268

Member Function Documentation

◆ GetID()

G4int G3DetTable::GetID ( G4String set,
G4String det 
)

Definition at line 69 of file G3DetTable.cc.

69 {
70
71 // make hash ID
72 G4String ShashID = MakeHash(set, det);
73
74 // search the Hash Dictionary
75 DTDiterator i = DTD.find(ShashID);
76 G3DetTableEntry* DTE = (*i).second;
77 if (DTE != 0) {
78 return DTE->GetID();
79 } else {
80 return 0;
81 }
82}
G4String MakeHash(G4String &set, G4String &det)
Definition: G3DetTable.cc:35

References G3DetTableEntry::GetID(), and MakeHash().

Referenced by G4gsdeta().

◆ GetSD()

G4VSensitiveDetector * G3DetTable::GetSD ( G4String set,
G4String det 
)

Definition at line 53 of file G3DetTable.cc.

53 {
54
55 // make hash ID
56 const G4String ShashID = MakeHash(set, det);
57
58 // search the map
59 DTDiterator i = DTD.find(ShashID);
60 G3DetTableEntry* DTE = (*i).second;
61 if (DTE != 0) {
62 return DTE->GetSD();
63 } else {
64 return 0;
65 }
66}
G4VSensitiveDetector * GetSD()

References G3DetTableEntry::GetSD(), and MakeHash().

◆ MakeHash()

G4String G3DetTable::MakeHash ( G4String set,
G4String det 
)
private

Definition at line 35 of file G3DetTable.cc.

35 {;
36 return set+" "+det;
37}

Referenced by GetID(), GetSD(), and Put().

◆ PrintAll()

void G3DetTable::PrintAll ( )

Definition at line 95 of file G3DetTable.cc.

95 {
96 if (DTD.size()>0){
97 G4int count=0;
98 G4cout << "Dump of DTD - " << DTD.size() << " entries:" << G4endl;
99 for (DTDiterator i=DTD.begin(); i != DTD.end(); i++) {
100 count++;
101 G3DetTableEntry* DTE = (*i).second;
102 G4cout << "DTD entry " << std::setw(3) << count << " sensitive detector name: "
103 << DTE->GetSD()->GetName() << G4endl;
104 }
105 }
106}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References G4cout, G4endl, G4VSensitiveDetector::GetName(), and G3DetTableEntry::GetSD().

Referenced by G4BuildGeom().

◆ Put()

void G3DetTable::Put ( G4String set,
G4String det,
G4int  id,
G4VSensitiveDetector D 
)

Definition at line 85 of file G3DetTable.cc.

86 {
87 // make hash ID
88 G4String ShashID = MakeHash(set, det);
89 G3DetTableEntry* DTE = new G3DetTableEntry(set, det, id, D);
90 G4cout << "Inserted DTE with id " << ShashID << G4endl;
91 DTD[ShashID] = DTE;
92}
G4double D(G4double temp)

References D(), G4cout, G4endl, and MakeHash().

Field Documentation

◆ DTD

std::map<G4String, G3DetTableEntry*, std::less<G4String> > G3DetTable::DTD
private

Definition at line 40 of file G3DetTable.hh.


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