VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
Geant4GM
source
volumes
Volume.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 Volume
14
// ---------------
15
// VGM implementation for Geant4 volume.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
VGM/solids/ISolid.h
"
20
21
#include "
Geant4GM/solids/SolidMap.h
"
22
#include "
Geant4GM/volumes/Volume.h
"
23
#include "
Geant4GM/volumes/VolumeMap.h
"
24
25
#include "G4LogicalVolume.hh"
26
#include "G4Material.hh"
27
#include "G4VSolid.hh"
28
29
#include <iostream>
30
31
//_____________________________________________________________________________
32
Geant4GM::Volume::Volume
(
const
std::string& name,
VGM::ISolid
* solid,
33
const
std::string& materialName,
const
std::string& mediumName)
34
:
VGM
::IVolume(),
35
BaseVGM
::
VVolume
(solid),
36
fLogicalVolume(0),
37
fMediumName(mediumName)
38
{
43
44
// Get solid from the solid map
45
G4VSolid* g4Solid =
Geant4GM::SolidMap::Instance
()->
GetSolid
(solid);
46
47
// Get material from G4
48
G4Material* g4Material = G4Material::GetMaterial(materialName);
49
50
if
(!g4Material) {
51
std::cerr <<
" Geant4GM::Volume::Volume:"
<< std::endl;
52
std::cerr <<
" Material \""
<< materialName <<
"\" not found."
53
<< std::endl;
54
std::cerr <<
"*** Error: Aborting execution ***"
<< std::endl;
55
exit(1);
56
}
57
58
// Create logical volume
59
fLogicalVolume =
new
G4LogicalVolume(g4Solid, g4Material, name);
60
61
// Register logical volume in the map
62
Geant4GM::VolumeMap::Instance
()->
AddVolume
(
this
, fLogicalVolume);
63
}
64
65
//_____________________________________________________________________________
66
Geant4GM::Volume::Volume
(
67
VGM::ISolid
* solid, G4LogicalVolume* lv,
const
std::string& mediumName)
68
:
VGM
::IVolume(),
69
BaseVGM
::
VVolume
(solid),
70
fLogicalVolume(lv),
71
fMediumName(mediumName)
72
{
74
75
// Register logical volume in the map
76
Geant4GM::VolumeMap::Instance
()->
AddVolume
(
this
, fLogicalVolume);
77
}
78
79
//_____________________________________________________________________________
80
Geant4GM::Volume::Volume
() :
VGM
::IVolume(),
BaseVGM
::
VVolume
()
81
{
83
}
84
85
//_____________________________________________________________________________
86
Geant4GM::Volume::Volume
(
const
Volume
& rhs)
87
:
VGM
::IVolume(rhs),
BaseVGM
::
VVolume
(rhs)
88
{
90
}
91
92
//_____________________________________________________________________________
93
Geant4GM::Volume::~Volume
()
94
{
95
//
96
}
97
98
//
99
// public functions
100
//
101
102
//_____________________________________________________________________________
103
std::string
Geant4GM::Volume::Name
()
const
104
{
105
//
106
return
fLogicalVolume->GetName();
107
}
108
109
//_____________________________________________________________________________
110
std::string
Geant4GM::Volume::MaterialName
()
const
111
{
112
//
113
return
fLogicalVolume->GetMaterial()->GetName();
114
}
115
116
//_____________________________________________________________________________
117
std::string
Geant4GM::Volume::MediumName
()
const
118
{
119
//
120
return
fMediumName;
121
}
122
123
//_____________________________________________________________________________
124
void
Geant4GM::Volume::ResetSolid
(
VGM::ISolid
* solid)
125
{
126
BaseVGM::VVolume::ResetSolid
(solid);
127
128
G4VSolid* g4Solid =
Geant4GM::SolidMap::Instance
()->
GetSolid
(solid);
129
fLogicalVolume->SetSolid(g4Solid);
130
}
SolidMap.h
VolumeMap.h
Volume.h
ISolid.h
BaseVGM::VVolume::ResetSolid
virtual void ResetSolid(VGM::ISolid *solid)
Definition
VVolume.cxx:91
BaseVGM::VVolume::VVolume
VVolume(VGM::ISolid *solid)
Definition
VVolume.cxx:43
Geant4GM::SolidMap::GetSolid
G4VSolid * GetSolid(VGM::ISolid *iSolid) const
Definition
SolidMap.cxx:68
Geant4GM::SolidMap::Instance
static SolidMap * Instance()
Definition
SolidMap.cxx:28
Geant4GM::VolumeMap::AddVolume
void AddVolume(VGM::IVolume *, G4LogicalVolume *)
Definition
VolumeMap.cxx:60
Geant4GM::VolumeMap::Instance
static VolumeMap * Instance()
Definition
VolumeMap.cxx:28
Geant4GM::Volume::MediumName
virtual std::string MediumName() const
Return the name of the associated medium.
Definition
Volume.cxx:117
Geant4GM::Volume::Name
virtual std::string Name() const
Return the name of this volume.
Definition
Volume.cxx:103
Geant4GM::Volume::~Volume
virtual ~Volume()
Definition
Volume.cxx:93
Geant4GM::Volume::ResetSolid
virtual void ResetSolid(VGM::ISolid *solid)
Definition
Volume.cxx:124
Geant4GM::Volume::MaterialName
virtual std::string MaterialName() const
Return the name of the associated material.
Definition
Volume.cxx:110
Geant4GM::Volume::Volume
Volume(const std::string &name, VGM::ISolid *solid, const std::string &materialName, const std::string &mediumName)
Definition
Volume.cxx:32
Geant4GM::Volume::Volume
Volume()
Definition
Volume.cxx:80
VGM::ISolid
The VGM interface to solids.
Definition
ISolid.h:58
BaseVGM
BaseVGM utilities.
Definition
utilities.h:23
VGM
VGM interfaces.
Definition
VMedium.h:28
Generated on
for VGM by
1.17.0