Geant4
10.01.p03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G3VolTable.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: G3VolTable.cc 67982 2013-03-13 10:36:03Z gcosmo $
28
//
29
// modified by I.Hrivnacova, 13.10.99
30
31
#include <iomanip>
32
#include "
globals.hh
"
33
#include "
G3VolTable.hh
"
34
#include "
G3Pos.hh
"
35
36
typedef
std::map<G4String, G3VolTableEntry*, std::less<G4String> >
37
::iterator
VTDiterator
;
38
39
G3VolTable::G3VolTable
()
40
: G3toG4TopVTE(0), _FirstKey(
"UnDefined"
), _NG3Pos(0){
41
}
42
43
G3VolTable::~G3VolTable
(){
44
if
(
VTD
.size()>0){
45
// G4cout << "Deleting VTD" << G4endl;
46
for
(
VTDiterator
i=
VTD
.begin(); i !=
VTD
.end(); i++) {
47
delete
(*i).second;
48
}
49
VTD
.clear();
50
}
51
}
52
53
G3VolTableEntry
*
54
G3VolTable::GetVTE
(
const
G4String
& Vname) {
55
VTDiterator
i =
VTD
.find(Vname);
56
if
(i ==
VTD
.end())
return
0;
57
else
return
(*i).second;
58
}
59
60
void
61
G3VolTable::PrintAll
(){
62
if
(
VTD
.size()){
63
G4int
i=0;
64
G4cout
<<
"Dump of VTD - "
<<
VTD
.size() <<
" entries:"
<<
G4endl
;
65
VTEStat
();
66
for
(
VTDiterator
v=
VTD
.begin(); v !=
VTD
.end(); v++){
67
G3VolTableEntry
* VTE = (*v).second;
68
G4cout
<<
"G3VolTable element "
<< std::setw(3) << i++ <<
" name "
69
<< VTE->
GetName
() <<
" has "
<< VTE->
GetNoDaughters
()
70
<<
" daughters"
<<
G4endl
;
71
}
72
}
73
}
74
75
G3VolTableEntry
*
76
G3VolTable::PutVTE
(
G3VolTableEntry
* aG3VolTableEntry){
77
78
if
(
GetVTE
(aG3VolTableEntry->
GetName
()) == 0 ){
79
80
// create a hash key
81
G4String
HashID = aG3VolTableEntry->
GetName
();
82
83
if
(
_FirstKey
==
"UnDefined"
)
_FirstKey
= HashID;
84
85
// insert into dictionary
86
VTD
[HashID] = aG3VolTableEntry;
87
}
88
return
GetVTE
(aG3VolTableEntry->
GetName
());
89
}
90
91
void
92
G3VolTable::CountG3Pos
(){
93
_NG3Pos
++;
94
}
95
96
void
97
G3VolTable::SetFirstVTE
(){
98
G3toG4TopVTE
=
VTD
[
_FirstKey
];
99
100
if
(
G3toG4TopVTE
->
NPCopies
() > 0) {
101
_FirstKey
=
G3toG4TopVTE
->
GetMother
()->
GetName
();
102
SetFirstVTE
();
103
}
104
}
105
106
G3VolTableEntry
*
107
G3VolTable::GetFirstVTE
() {
108
return
G3toG4TopVTE
;
109
}
110
111
void
112
G3VolTable::VTEStat
() {
113
G4cout
<<
"Instantiated "
<<
VTD
.size() <<
114
" volume table entries \n"
115
<<
" "
<<
_NG3Pos
<<
" positions."
<<
G4endl
;
116
}
117
118
void
119
G3VolTable::Clear
() {
120
if
(
VTD
.size()>0){
121
for
(
VTDiterator
i=
VTD
.begin(); i !=
VTD
.end(); i++) {
122
delete
(*i).second;
123
}
124
VTD
.clear();
125
}
126
G3toG4TopVTE
= 0;
127
_FirstKey
=
"UnDefined"
;
128
_NG3Pos
= 0;
129
}
G3VolTable.hh
G3VolTable::GetFirstVTE
G3VolTableEntry * GetFirstVTE()
Definition:
G3VolTable.cc:107
G3Pos.hh
G3VolTable::Clear
void Clear()
Definition:
G3VolTable.cc:119
G3VolTableEntry::NPCopies
G4int NPCopies()
Definition:
G3VolTableEntry.cc:254
G3VolTable::~G3VolTable
virtual ~G3VolTable()
Definition:
G3VolTable.cc:43
G3VolTableEntry
Definition:
G3VolTableEntry.hh:80
G4int
int G4int
Definition:
G4Types.hh:78
G3VolTable::GetVTE
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition:
G3VolTable.cc:54
G3VolTable::G3VolTable
G3VolTable()
Definition:
G3VolTable.cc:39
G3VolTableEntry::GetMother
G3VolTableEntry * GetMother(G4int i)
Definition:
G3VolTableEntry.cc:315
G3VolTable::PrintAll
void PrintAll()
Definition:
G3VolTable.cc:61
G3VolTable::VTD
std::map< G4String, G3VolTableEntry *, std::less< G4String > > VTD
Definition:
G3VolTable.hh:81
G3VolTableEntry::GetNoDaughters
G4int GetNoDaughters()
Definition:
G3VolTableEntry.cc:287
G4cout
G4GLOB_DLL std::ostream G4cout
G3VolTable::G3toG4TopVTE
G3VolTableEntry * G3toG4TopVTE
Definition:
G3VolTable.hh:79
G3VolTable::CountG3Pos
void CountG3Pos()
Definition:
G3VolTable.cc:92
globals.hh
VTDiterator
std::map< G4String, G3VolTableEntry *, std::less< G4String > >::iterator VTDiterator
Definition:
G3VolTable.cc:37
G3VolTableEntry::GetName
G4String GetName()
Definition:
G3VolTableEntry.cc:229
G3VolTable::SetFirstVTE
void SetFirstVTE()
Definition:
G3VolTable.cc:97
G3VolTable::_NG3Pos
G4int _NG3Pos
Definition:
G3VolTable.hh:82
G3VolTable::_FirstKey
G4String _FirstKey
Definition:
G3VolTable.hh:80
G4endl
#define G4endl
Definition:
G4ios.hh:61
G3VolTable::PutVTE
G3VolTableEntry * PutVTE(G3VolTableEntry *aVTE)
Definition:
G3VolTable.cc:76
G3VolTable::VTEStat
void VTEStat()
Definition:
G3VolTable.cc:112
G4String
Definition:
G4String.hh:45
geant4.10.01.p03
source
g3tog4
src
G3VolTable.cc
Generated on Fri Feb 19 2016 15:53:26 for Geant4 by
1.8.8