VGM Version 5.3
Loading...
Searching...
No Matches
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
20#include "VGM/volumes/IVolume.h"
21
23
24#include <iostream>
25
26//_____________________________________________________________________________
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//_____________________________________________________________________________
44{
46}
47
48//_____________________________________________________________________________
49BaseVGM::VPlacement::VPlacement(const VPlacement& rhs) : VGM::IPlacement(rhs)
50{
52}
53
54//_____________________________________________________________________________
59
60//_____________________________________________________________________________
62{
63 //
64 return fVolume;
65}
66
67//_____________________________________________________________________________
69{
70 //
71 return fMotherVolume;
72}
73
74//_____________________________________________________________________________
75std::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) {
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//_____________________________________________________________________________
113{
118
119 fVolume = volume;
120}
121
122//_____________________________________________________________________________
124{
125 // Returns the placement type name for specified typeId
126 switch (typeId) {
127 case kSimplePlacement:
128 return "Simple";
129 break;
131 return "Multiple";
132 break;
133 // case kParameterised: return "Parameterised"; break;
134 default:
135 return "Undefined";
136 break;
137 };
138}
139
140//_____________________________________________________________________________
141std::ostream& operator<<(std::ostream& out, const VGM::IPlacement& placement)
142{
143 return placement.Put(out);
144}
std::ostream & operator<<(std::ostream &out, const VGM::Transform &transform)
Definition utilities.cxx:88
The abstract base class to positions of volumes.
Definition VPlacement.h:32
void SetVolume(VGM::IVolume *volume)
virtual VGM::IVolume * Volume() const
Return the associated volume.
virtual VGM::IVolume * Mother() const
Return the associated mother volume.
virtual std::ostream & Put(std::ostream &out) const
Put the printing of the placement parameters in the out stream.
VGM Axis enumeration.
The VGM interface to positions of volumes.
Definition IPlacement.h:44
virtual std::ostream & Put(std::ostream &out) const =0
Put the printing of the placement parameters in the out stream.
The VGM interface to volumes.
Definition IVolume.h:32
virtual void AddDaughter(VGM::IPlacement *daughter)=0
Add the specified daughter.
VGM interfaces.
Definition VMedium.h:28
std::string AxisTypeName(VGM::Axis typeId)
Definition utilities.cxx:53
@ kUnknownAxis
Definition Axis.h:42
std::string PlacementTypeName(VGM::PlacementType typeId)
PlacementType
Definition IPlacement.h:32
@ kSimplePlacement
Definition IPlacement.h:33
@ kMultiplePlacement
Definition IPlacement.h:34