VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
RootGM
source
materials
ElementMap.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The RootGM package of the Virtual Geometry Model
5
// Copyright (C) 2007 - 2010 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 Root elements.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
VGM/materials/IElement.h
"
20
21
#include "
RootGM/materials/ElementMap.h
"
22
23
#include "TGeoElement.h"
24
25
RootGM::ElementMap
* RootGM::ElementMap::fgInstance = 0;
26
27
//_____________________________________________________________________________
28
RootGM::ElementMap
*
RootGM::ElementMap::Instance
()
29
{
31
32
if
(!fgInstance)
new
ElementMap
();
33
34
return
fgInstance;
35
}
36
37
//_____________________________________________________________________________
38
RootGM::ElementMap::ElementMap
() : fTGeoElements(), fVgmElements()
39
{
41
42
fgInstance =
this
;
43
}
44
45
//_____________________________________________________________________________
46
RootGM::ElementMap::ElementMap
(
const
ElementMap
&)
47
{
49
}
50
51
//_____________________________________________________________________________
52
RootGM::ElementMap::~ElementMap
()
53
{
54
//
55
fgInstance = 0;
56
}
57
58
//
59
// public methods
60
//
61
62
//_____________________________________________________________________________
63
void
RootGM::ElementMap::AddElement
(
64
VGM::IElement
* iElement, TGeoElement* tgeoElement)
65
{
67
68
fTGeoElements[iElement] = tgeoElement;
69
fVgmElements[tgeoElement] = iElement;
70
}
71
72
//_____________________________________________________________________________
73
void
RootGM::ElementMap::Print
()
const
74
{
76
77
std::cout <<
"Geant4 Elements Map: "
<< std::endl;
78
79
int
counter = 0;
80
TGeoElementMapCIterator
i;
81
for
(i = fTGeoElements.begin(); i != fTGeoElements.end(); i++) {
82
VGM::IElement
* iElement = (*i).first;
83
TGeoElement* 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
TGeoElement*
RootGM::ElementMap::GetElement
(
VGM::IElement
* iElement)
const
93
{
95
96
TGeoElementMapCIterator
i = fTGeoElements.find(iElement);
97
if
(i != fTGeoElements.end())
98
return
(*i).second;
99
else
100
return
0;
101
}
102
103
//_____________________________________________________________________________
104
VGM::IElement
*
RootGM::ElementMap::GetElement
(TGeoElement* 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
}
IElement.h
ElementMap.h
RootGM::ElementMap
The map between VGM and Root elements.
Definition
ElementMap.h:36
RootGM::ElementMap::VgmElementMapCIterator
VgmElementMap::const_iterator VgmElementMapCIterator
Definition
ElementMap.h:42
RootGM::ElementMap::~ElementMap
virtual ~ElementMap()
Definition
ElementMap.cxx:52
RootGM::ElementMap::AddElement
void AddElement(VGM::IElement *, TGeoElement *)
Definition
ElementMap.cxx:63
RootGM::ElementMap::GetElement
TGeoElement * GetElement(VGM::IElement *iElement) const
Definition
ElementMap.cxx:92
RootGM::ElementMap::Instance
static ElementMap * Instance()
Definition
ElementMap.cxx:28
RootGM::ElementMap::TGeoElementMapCIterator
TGeoElementMap::const_iterator TGeoElementMapCIterator
Definition
ElementMap.h:39
RootGM::ElementMap::Print
void Print() const
Definition
ElementMap.cxx:73
RootGM::ElementMap::ElementMap
ElementMap()
Definition
ElementMap.cxx:38
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