VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
BaseVGM
source
volumes
VPlacement.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The BaseVGM 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 VPlacement
14
// -----------------
15
// The abstract base class to positions of volumes.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
VGM/common/Transform.h
"
20
#include "
VGM/volumes/IVolume.h
"
21
22
#include "
BaseVGM/volumes/VPlacement.h
"
23
24
#include <iostream>
25
26
//_____________________________________________________________________________
27
BaseVGM::VPlacement::VPlacement
(
28
VGM::IVolume
* volume,
VGM::IVolume
* motherVolume)
29
:
VGM
::IPlacement(), fVolume(volume), fMotherVolume(motherVolume)
30
{
32
33
// Update mother volume
34
if
(motherVolume)
35
motherVolume->
AddDaughter
(
this
);
36
else
{
37
// check if top volume not yet set and
38
// set top volume here
39
}
40
}
41
42
//_____________________________________________________________________________
43
BaseVGM::VPlacement::VPlacement
() :
VGM
::IPlacement()
44
{
46
}
47
48
//_____________________________________________________________________________
49
BaseVGM::VPlacement::VPlacement
(
const
VPlacement
& rhs) :
VGM
::IPlacement(rhs)
50
{
52
}
53
54
//_____________________________________________________________________________
55
BaseVGM::VPlacement::~VPlacement
()
56
{
57
//
58
}
59
60
//_____________________________________________________________________________
61
VGM::IVolume
*
BaseVGM::VPlacement::Volume
()
const
62
{
63
//
64
return
fVolume;
65
}
66
67
//_____________________________________________________________________________
68
VGM::IVolume
*
BaseVGM::VPlacement::Mother
()
const
69
{
70
//
71
return
fMotherVolume;
72
}
73
74
//_____________________________________________________________________________
75
std::ostream&
BaseVGM::VPlacement::Put
(std::ostream& out)
const
76
{
77
out <<
"\""
<<
Name
() <<
"\""
;
78
79
if
(
Volume
())
80
out <<
" volume: \""
<<
Volume
()->Name() <<
"\""
;
81
else
82
out <<
" volume: \"-\""
;
83
84
if
(
Mother
())
85
out <<
" mother: \""
<<
Mother
()->Name() <<
"\""
;
86
else
87
out <<
" mother: \"-\""
;
88
89
out <<
" type: \""
<<
VGM::PlacementTypeName
(
Type
()) <<
"\""
;
90
91
if
(
Type
() ==
VGM::kSimplePlacement
) {
92
out <<
" copyNo: "
<<
CopyNo
() <<
" transform: "
<<
Transformation
();
93
}
94
95
if
(
Type
() ==
VGM::kMultiplePlacement
) {
96
VGM::Axis
axis =
VGM::kUnknownAxis
;
97
int
nofItems = 0;
98
double
width = 0.;
99
double
offset = 0.;
100
double
halfGap = 0.;
101
MultiplePlacementData
(axis, nofItems, width, offset, halfGap);
102
103
out <<
" axis: \""
<<
VGM::AxisTypeName
(axis) <<
"\""
104
<<
" ndiv: "
<< nofItems <<
" width: "
<< width
105
<<
" offset: "
<< offset <<
" halfGap: "
<< halfGap;
106
}
107
108
return
out;
109
}
110
111
//_____________________________________________________________________________
112
void
BaseVGM::VPlacement::SetVolume
(
VGM::IVolume
* volume)
113
{
118
119
fVolume = volume;
120
}
121
122
//_____________________________________________________________________________
123
std::string
VGM::PlacementTypeName
(
VGM::PlacementType
typeId)
124
{
125
// Returns the placement type name for specified typeId
126
switch
(typeId) {
127
case
kSimplePlacement
:
128
return
"Simple"
;
129
break
;
130
case
kMultiplePlacement
:
131
return
"Multiple"
;
132
break
;
133
// case kParameterised: return "Parameterised"; break;
134
default
:
135
return
"Undefined"
;
136
break
;
137
};
138
}
139
140
//_____________________________________________________________________________
141
std::ostream&
operator<<
(std::ostream& out,
const
VGM::IPlacement
& placement)
142
{
143
return
placement.
Put
(out);
144
}
operator<<
std::ostream & operator<<(std::ostream &out, const VGM::Transform &transform)
Definition
utilities.cxx:88
IVolume.h
Transform.h
VPlacement.h
BaseVGM::VPlacement::SetVolume
void SetVolume(VGM::IVolume *volume)
Definition
VPlacement.cxx:112
BaseVGM::VPlacement::CopyNo
virtual int CopyNo() const =0
Return the copy number of this placement.
BaseVGM::VPlacement::Volume
virtual VGM::IVolume * Volume() const
Return the associated volume.
Definition
VPlacement.cxx:61
BaseVGM::VPlacement::MultiplePlacementData
virtual bool MultiplePlacementData(VGM::Axis &axis, int &nofDivisions, double &width, double &offset, double &halfGap) const =0
Fill the multiple placement data if relevant and return true; return false if not multiple placement.
BaseVGM::VPlacement::VPlacement
VPlacement()
Definition
VPlacement.cxx:43
BaseVGM::VPlacement::Mother
virtual VGM::IVolume * Mother() const
Return the associated mother volume.
Definition
VPlacement.cxx:68
BaseVGM::VPlacement::Put
virtual std::ostream & Put(std::ostream &out) const
Put the printing of the placement parameters in the out stream.
Definition
VPlacement.cxx:75
BaseVGM::VPlacement::~VPlacement
virtual ~VPlacement()
Definition
VPlacement.cxx:55
BaseVGM::VPlacement::Transformation
virtual VGM::Transform Transformation() const =0
Return the 3D transformation (if simple placement).
BaseVGM::VPlacement::VPlacement
VPlacement(VGM::IVolume *volume, VGM::IVolume *motherVolume)
Definition
VPlacement.cxx:27
BaseVGM::VPlacement::Name
virtual std::string Name() const =0
Return the name of this placement.
VGM::IPlacement
The VGM interface to positions of volumes.
Definition
IPlacement.h:44
VGM::IPlacement::Type
virtual PlacementType Type() const =0
Return the type of this placement.
VGM::IPlacement::Put
virtual std::ostream & Put(std::ostream &out) const =0
Put the printing of the placement parameters in the out stream.
VGM::IVolume
The VGM interface to volumes.
Definition
IVolume.h:32
VGM::IVolume::AddDaughter
virtual void AddDaughter(VGM::IPlacement *daughter)=0
Add the specified daughter.
VGM
VGM interfaces.
Definition
VMedium.h:28
VGM::AxisTypeName
std::string AxisTypeName(VGM::Axis typeId)
Definition
utilities.cxx:53
VGM::Axis
Axis
Definition
Axis.h:34
VGM::kUnknownAxis
@ kUnknownAxis
Definition
Axis.h:42
VGM::PlacementTypeName
std::string PlacementTypeName(VGM::PlacementType typeId)
Definition
VPlacement.cxx:123
VGM::PlacementType
PlacementType
Definition
IPlacement.h:32
VGM::kSimplePlacement
@ kSimplePlacement
Definition
IPlacement.h:33
VGM::kMultiplePlacement
@ kMultiplePlacement
Definition
IPlacement.h:34
Generated on
for VGM by
1.17.0