VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
RootGM
source
materials
MaterialMap.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, 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 MaterialMap
14
// ------------------
15
// The map between VGM and Root materials.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
VGM/materials/IMaterial.h
"
20
21
#include "
RootGM/materials/MaterialMap.h
"
22
23
#include "TGeoMaterial.h"
24
25
RootGM::MaterialMap
* RootGM::MaterialMap::fgInstance = 0;
26
27
//_____________________________________________________________________________
28
RootGM::MaterialMap
*
RootGM::MaterialMap::Instance
()
29
{
31
32
if
(!fgInstance)
new
RootGM::MaterialMap
();
33
34
return
fgInstance;
35
}
36
37
//_____________________________________________________________________________
38
RootGM::MaterialMap::MaterialMap
() : fRootMaterials(), fVgmMaterials()
39
{
41
42
fgInstance =
this
;
43
}
44
45
//_____________________________________________________________________________
46
RootGM::MaterialMap::MaterialMap
(
const
MaterialMap
&)
47
{
49
}
50
51
//_____________________________________________________________________________
52
RootGM::MaterialMap::~MaterialMap
()
53
{
54
//
55
fgInstance = 0;
56
}
57
58
//
59
// public methods
60
//
61
62
//_____________________________________________________________________________
63
void
RootGM::MaterialMap::AddMaterial
(
64
VGM::IMaterial
* iMaterial, TGeoMaterial* rootMaterial)
65
{
67
68
fRootMaterials[iMaterial] = rootMaterial;
69
fVgmMaterials[rootMaterial] = iMaterial;
70
}
71
72
//_____________________________________________________________________________
73
void
RootGM::MaterialMap::Print
()
const
74
{
76
77
std::cout <<
"Root Materials Map: "
<< std::endl;
78
79
int
counter = 0;
80
RootMaterialMapCIterator
i;
81
for
(i = fRootMaterials.begin(); i != fRootMaterials.end(); i++) {
82
VGM::IMaterial
* iMaterial = (*i).first;
83
TGeoMaterial* rootMaterial = (*i).second;
84
85
std::cout <<
" "
<< counter++ <<
"th entry:"
86
<<
" vgmMaterial "
<< iMaterial <<
" "
<< iMaterial->
Name
()
87
<<
" rootMaterial "
<< rootMaterial <<
" "
88
<< rootMaterial->GetName() << std::endl;
89
}
90
}
91
92
//_____________________________________________________________________________
93
TGeoMaterial*
RootGM::MaterialMap::GetMaterial
(
VGM::IMaterial
* iMaterial)
const
94
{
96
97
RootMaterialMapCIterator
i = fRootMaterials.find(iMaterial);
98
if
(i != fRootMaterials.end())
99
return
(*i).second;
100
else
101
return
0;
102
}
103
104
//_____________________________________________________________________________
105
VGM::IMaterial
*
RootGM::MaterialMap::GetMaterial
(
106
TGeoMaterial* rootMaterial)
const
107
{
109
110
VgmMaterialMapCIterator
i = fVgmMaterials.find(rootMaterial);
111
if
(i != fVgmMaterials.end())
112
return
(*i).second;
113
else
114
return
0;
115
}
IMaterial.h
MaterialMap.h
RootGM::MaterialMap
The map between VGM and Root material.
Definition
MaterialMap.h:36
RootGM::MaterialMap::~MaterialMap
virtual ~MaterialMap()
Definition
MaterialMap.cxx:52
RootGM::MaterialMap::MaterialMap
MaterialMap()
Definition
MaterialMap.cxx:38
RootGM::MaterialMap::VgmMaterialMapCIterator
VgmMaterialMap::const_iterator VgmMaterialMapCIterator
Definition
MaterialMap.h:42
RootGM::MaterialMap::GetMaterial
TGeoMaterial * GetMaterial(VGM::IMaterial *iMaterial) const
Definition
MaterialMap.cxx:93
RootGM::MaterialMap::Print
void Print() const
Definition
MaterialMap.cxx:73
RootGM::MaterialMap::RootMaterialMapCIterator
RootMaterialMap::const_iterator RootMaterialMapCIterator
Definition
MaterialMap.h:39
RootGM::MaterialMap::AddMaterial
void AddMaterial(VGM::IMaterial *, TGeoMaterial *)
Definition
MaterialMap.cxx:63
RootGM::MaterialMap::Instance
static MaterialMap * Instance()
Definition
MaterialMap.cxx:28
VGM::IMaterial
The VGM interface to materials.
Definition
IMaterial.h:44
VGM::IMaterial::Name
virtual std::string Name() const =0
Return the name of this element.
Generated on
for VGM by
1.17.0