Geant4
10.03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G3DetTable.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// $Id: G3DetTable.cc 67982 2013-03-13 10:36:03Z gcosmo $
28
//
29
#include "
globals.hh
"
30
#include "
G3DetTable.hh
"
31
32
typedef
std::map<G4String, G3DetTableEntry*, std::less<G4String> >
33
::iterator
DTDiterator
;
34
35
G4String
36
G3DetTable::MakeHash
(
G4String
& set,
G4String
& det){;
37
return
set+
" "
+det;
38
}
39
40
G3DetTable::G3DetTable
(){
41
}
42
43
G3DetTable::~G3DetTable
(){
44
if
(
DTD
.size() > 0) {
45
// G4cout << "Deleting DTD" << G4endl;
46
for
(
DTDiterator
i=
DTD
.begin(); i !=
DTD
.end(); i++) {
47
delete
(*i).second;
48
}
49
DTD
.clear();
50
}
51
}
52
53
G4VSensitiveDetector
*
54
G3DetTable::GetSD
(
G4String
& set,
G4String
& det){
55
56
// make hash ID
57
const
G4String
ShashID =
MakeHash
(set, det);
58
59
// search the map
60
DTDiterator
i =
DTD
.find(ShashID);
61
G3DetTableEntry
* DTE = (*i).second;
62
if
(DTE != 0) {
63
return
DTE->
GetSD
();
64
}
else
{
65
return
0;
66
}
67
}
68
69
G4int
70
G3DetTable::GetID
(
G4String
& set,
G4String
& det){
71
72
// make hash ID
73
G4String
ShashID =
MakeHash
(set, det);
74
75
// search the Hash Dictionary
76
DTDiterator
i =
DTD
.find(ShashID);
77
G3DetTableEntry
* DTE = (*i).second;
78
if
(DTE != 0) {
79
return
DTE->
GetID
();
80
}
else
{
81
return
0;
82
}
83
}
84
85
void
86
G3DetTable::Put
(
G4String
& set,
G4String
& det,
G4int
id
,
87
G4VSensitiveDetector
*
D
){
88
// make hash ID
89
G4String
ShashID =
MakeHash
(set, det);
90
G3DetTableEntry
* DTE =
new
G3DetTableEntry
(set, det,
id
, D);
91
G4cout
<<
"Inserted DTE with id "
<< ShashID <<
G4endl
;
92
DTD
[ShashID] = DTE;
93
}
94
95
void
96
G3DetTable::PrintAll
(){
97
if
(
DTD
.size()>0){
98
G4int
count=0;
99
G4cout
<<
"Dump of DTD - "
<<
DTD
.size() <<
" entries:"
<<
G4endl
;
100
for
(
DTDiterator
i=
DTD
.begin(); i !=
DTD
.end(); i++) {
101
count++;
102
G3DetTableEntry
* DTE = (*i).second;
103
G4cout
<<
"DTD entry "
<< std::setw(3) << count <<
" sensitive detector name: "
104
<< DTE->
GetSD
()->
GetName
() <<
G4endl
;
105
}
106
}
107
}
108
109
110
111
112
G3DetTable::GetSD
G4VSensitiveDetector * GetSD(G4String &set, G4String &det)
Definition:
G3DetTable.cc:54
G3DetTable::PrintAll
void PrintAll()
Definition:
G3DetTable.cc:96
G3DetTable::MakeHash
G4String MakeHash(G4String &set, G4String &det)
Definition:
G3DetTable.cc:36
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
G3DetTableEntry::GetSD
G4VSensitiveDetector * GetSD()
Definition:
G3DetTableEntry.cc:44
G3DetTable::Put
void Put(G4String &set, G4String &det, G4int id, G4VSensitiveDetector *D)
Definition:
G3DetTable.cc:86
DTDiterator
std::map< G4String, G3DetTableEntry *, std::less< G4String > >::iterator DTDiterator
Definition:
G3DetTable.cc:33
DTD
Definition:
xmlparse.cc:268
G3DetTable::GetID
G4int GetID(G4String &set, G4String &det)
Definition:
G3DetTable.cc:70
G4int
int G4int
Definition:
G4Types.hh:78
G4VSensitiveDetector::GetName
G4String GetName() const
Definition:
G4VSensitiveDetector.hh:146
G4cout
G4GLOB_DLL std::ostream G4cout
G3DetTable.hh
globals.hh
G3DetTable::~G3DetTable
virtual ~G3DetTable()
Definition:
G3DetTable.cc:43
D
double D(double temp)
Definition:
G4DNAElectronHoleRecombination.cc:91
G4endl
#define G4endl
Definition:
G4ios.hh:61
G3DetTableEntry
Definition:
G3DetTableEntry.hh:38
G3DetTableEntry::GetID
G4int GetID()
Definition:
G3DetTableEntry.cc:59
G3DetTable::G3DetTable
G3DetTable()
Definition:
G3DetTable.cc:40
G4String
Definition:
G4String.hh:45
geant4.10.03
source
g3tog4
src
G3DetTable.cc
Generated on Thu Feb 14 2002 02:28:08 for Geant4 by
1.8.8