VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
Geant4GM
source
materials
ElementMap.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The Geant4GM package of the Virtual Geometry Model
5
// Copyright (C) 2007, Ivana Hrivnacova
6
// All rights reserved.
7
//
8
// For the licensing terms see vgm/LICENSE.
9
// Contact: ivana@ipno.in2p3.fr
10
// -----------------------------------------------------------------------
11
12
//
13
// Class ElementMap
14
// ------------------
15
// The map between VGM and Geant4 elements.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
VGM/materials/IElement.h
"
20
21
#include "
Geant4GM/materials/ElementMap.h
"
22
23
#include "G4Element.hh"
24
25
Geant4GM::ElementMap
* Geant4GM::ElementMap::fgInstance = 0;
26
27
//_____________________________________________________________________________
28
Geant4GM::ElementMap
*
Geant4GM::ElementMap::Instance
()
29
{
31
32
if
(!fgInstance)
new
ElementMap
();
33
34
return
fgInstance;
35
}
36
37
//_____________________________________________________________________________
38
Geant4GM::ElementMap::ElementMap
() : fG4Elements(), fVgmElements()
39
{
41
42
fgInstance =
this
;
43
}
44
45
//_____________________________________________________________________________
46
Geant4GM::ElementMap::ElementMap
(
const
ElementMap
&)
47
{
49
}
50
51
//_____________________________________________________________________________
52
Geant4GM::ElementMap::~ElementMap
()
53
{
54
//
55
fgInstance = 0;
56
}
57
58
//
59
// public methods
60
//
61
62
//_____________________________________________________________________________
63
void
Geant4GM::ElementMap::AddElement
(
64
VGM::IElement
* iElement, G4Element* g4Element)
65
{
67
68
fG4Elements[iElement] = g4Element;
69
fVgmElements[g4Element] = iElement;
70
}
71
72
//_____________________________________________________________________________
73
void
Geant4GM::ElementMap::Print
()
const
74
{
76
77
std::cout <<
"Geant4 Elements Map: "
<< std::endl;
78
79
int
counter = 0;
80
G4ElementMapCIterator
i;
81
for
(i = fG4Elements.begin(); i != fG4Elements.end(); i++) {
82
VGM::IElement
* iElement = (*i).first;
83
G4Element* element = (*i).second;
84
85
std::cout <<
" "
<< counter++ <<
"th entry:"
86
<<
" vgmElement "
<< iElement <<
" "
<< iElement->
Name
()
87
<<
" LV "
<< element <<
" "
<< element->GetName() << std::endl;
88
}
89
}
90
91
//_____________________________________________________________________________
92
G4Element*
Geant4GM::ElementMap::GetElement
(
VGM::IElement
* iElement)
const
93
{
95
96
G4ElementMapCIterator
i = fG4Elements.find(iElement);
97
if
(i != fG4Elements.end())
98
return
(*i).second;
99
else
100
return
0;
101
}
102
103
//_____________________________________________________________________________
104
VGM::IElement
*
Geant4GM::ElementMap::GetElement
(G4Element* element)
const
105
{
107
108
VgmElementMapCIterator
i = fVgmElements.find(element);
109
if
(i != fVgmElements.end())
110
return
(*i).second;
111
else
112
return
0;
113
}
ElementMap.h
IElement.h
Geant4GM::ElementMap
The map between VGM and Geant4 elements.
Definition
ElementMap.h:36
Geant4GM::ElementMap::VgmElementMapCIterator
VgmElementMap::const_iterator VgmElementMapCIterator
Definition
ElementMap.h:42
Geant4GM::ElementMap::G4ElementMapCIterator
G4ElementMap::const_iterator G4ElementMapCIterator
Definition
ElementMap.h:39
Geant4GM::ElementMap::Print
void Print() const
Definition
ElementMap.cxx:73
Geant4GM::ElementMap::~ElementMap
virtual ~ElementMap()
Definition
ElementMap.cxx:52
Geant4GM::ElementMap::AddElement
void AddElement(VGM::IElement *, G4Element *)
Definition
ElementMap.cxx:63
Geant4GM::ElementMap::ElementMap
ElementMap()
Definition
ElementMap.cxx:38
Geant4GM::ElementMap::Instance
static ElementMap * Instance()
Definition
ElementMap.cxx:28
Geant4GM::ElementMap::GetElement
G4Element * GetElement(VGM::IElement *iElement) const
Definition
ElementMap.cxx:92
VGM::IElement
The VGM interface to elements.
Definition
IElement.h:34
VGM::IElement::Name
virtual std::string Name() const =0
Return the name of this element.
Generated on
for VGM by
1.17.0