Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
28// modified by I.Hrivnacova, 13.10.99
29
30#include <iomanip>
31#include "globals.hh"
32#include "G3VolTable.hh"
33#include "G3Pos.hh"
34
35typedef std::map<G4String, G3VolTableEntry*, std::less<G4String> >
36::iterator VTDiterator;
37
39 : G3toG4TopVTE(0), _FirstKey("UnDefined"), _NG3Pos(0){
40}
41
43 if (VTD.size()>0){
44 // G4cout << "Deleting VTD" << G4endl;
45 for (VTDiterator i=VTD.begin(); i != VTD.end(); i++) {
46 delete (*i).second;
47 }
48 VTD.clear();
49 }
50}
51
54 VTDiterator i = VTD.find(Vname);
55 if (i == VTD.end()) return 0;
56 else return (*i).second;
57}
58
59void
61 if (VTD.size()){
62 G4int i=0;
63 G4cout << "Dump of VTD - " << VTD.size() << " entries:" << G4endl;
64 VTEStat();
65 for (VTDiterator v=VTD.begin(); v != VTD.end(); v++){
66 G3VolTableEntry* VTE = (*v).second;
67 G4cout << "G3VolTable element " << std::setw(3) << i++ << " name "
68 << VTE->GetName() << " has " << VTE->GetNoDaughters()
69 << " daughters" << G4endl;
70 }
71 }
72}
73
76
77 if (GetVTE(aG3VolTableEntry->GetName()) == 0 ){
78
79 // create a hash key
80 G4String HashID = aG3VolTableEntry->GetName();
81
82 if (_FirstKey == "UnDefined") _FirstKey = HashID;
83
84 // insert into dictionary
85 VTD[HashID] = aG3VolTableEntry;
86 }
87 return GetVTE(aG3VolTableEntry->GetName());
88}
89
90void
92 _NG3Pos++;
93}
94
95void
97 G3toG4TopVTE = VTD[_FirstKey];
98
99 if (G3toG4TopVTE->NPCopies() > 0) {
100 _FirstKey = G3toG4TopVTE->GetMother()->GetName();
101 SetFirstVTE();
102 }
103}
104
107 return G3toG4TopVTE;
108}
109
110void
112 G4cout << "Instantiated " << VTD.size() <<
113 " volume table entries \n"
114 << " " << _NG3Pos << " positions." << G4endl;
115}
116
117void
119 if (VTD.size()>0){
120 for (VTDiterator i=VTD.begin(); i != VTD.end(); i++) {
121 delete (*i).second;
122 }
123 VTD.clear();
124 }
125 G3toG4TopVTE = 0;
126 _FirstKey = "UnDefined";
127 _NG3Pos = 0;
128}
std::map< G4String, G3VolTableEntry *, std::less< G4String > >::iterator VTDiterator
Definition: G3VolTable.cc:36
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G3VolTableEntry * GetMother(G4int i)
void SetFirstVTE()
Definition: G3VolTable.cc:96
void PrintAll()
Definition: G3VolTable.cc:60
void CountG3Pos()
Definition: G3VolTable.cc:91
G3VolTableEntry * GetFirstVTE()
Definition: G3VolTable.cc:106
virtual ~G3VolTable()
Definition: G3VolTable.cc:42
G3VolTableEntry * PutVTE(G3VolTableEntry *aVTE)
Definition: G3VolTable.cc:75
void Clear()
Definition: G3VolTable.cc:118
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition: G3VolTable.cc:53
void VTEStat()
Definition: G3VolTable.cc:111