VGM Version 5.3
Loading...
Searching...
No Matches
MultiUnion.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 MultiUnion
14// ---------------------
15// VGM implementation for Geant4 multi union solid
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
19#include "ClhepVGM/transform.h"
20
23
24#include "G4MultiUnion.hh"
25#include "G4ReflectedSolid.hh"
26
27//_____________________________________________________________________________
28Geant4GM::MultiUnion::MultiUnion(const std::string& name,
29 std::vector<VGM::ISolid*> constituents, std::vector<G4Transform3D> transforms)
30 : VGM::ISolid(),
31 VGM::IMultiUnion(),
32 BaseVGM::VMultiUnion(),
33 fMultiUnion(0),
34 fToBeReflected(false)
35{
39
40 fMultiUnion = new G4MultiUnion(name);
41
42 for (size_t i = 0; i < constituents.size(); ++i) {
43 // Get solid from the volumes map
44 G4VSolid* g4Solid =
45 Geant4GM::SolidMap::Instance()->GetSolid(constituents[i]);
46 // Add constituent
47 fMultiUnion->AddNode(*g4Solid, transforms[i]);
48 }
49 // Finally close the structure
50 fMultiUnion->Voxelize();
51
52 Geant4GM::SolidMap::Instance()->AddSolid(this, fMultiUnion);
53}
54
55//_____________________________________________________________________________
57 G4MultiUnion* multiUnion, G4ReflectedSolid* reflected)
58 : VGM::ISolid(),
59 VGM::IMultiUnion(),
60 BaseVGM::VMultiUnion(),
61 fMultiUnion(multiUnion),
62 fToBeReflected(false)
63{
65
66 if (reflected) {
67 fToBeReflected = true;
68 Geant4GM::SolidMap::Instance()->AddSolid(this, reflected);
69 }
70 else {
71 Geant4GM::SolidMap::Instance()->AddSolid(this, fMultiUnion);
72 }
73}
74
75//_____________________________________________________________________________
77 : VGM::ISolid(), VGM::IMultiUnion(), BaseVGM::VMultiUnion()
78{
80}
81
82//_____________________________________________________________________________
84 : VGM::ISolid(rhs), VGM::IMultiUnion(rhs), BaseVGM::VMultiUnion(rhs)
85{
87}
88
89//_____________________________________________________________________________
94
95//
96// public methods
97//
98
99//_____________________________________________________________________________
100std::string Geant4GM::MultiUnion::Name() const
101{
102 // Returns the Boolean solid name
103 // ---
104
105 return fMultiUnion->GetName();
106}
107
108//_____________________________________________________________________________
110{
111 // Returns the number of constituent solids.
112 // ---
113
114 return fMultiUnion->GetNumberOfSolids();
115}
116
117//_____________________________________________________________________________
119{
120 // Returns the index-th constituent solid.
121 // ---
122
123 G4VSolid* g4Solid = fMultiUnion->GetSolid(index);
124
125 return Geant4GM::SolidMap::Instance()->GetSolid(g4Solid);
126}
127
128//_____________________________________________________________________________
130{
131 // Returns the displacement of the index-th constituent solid
132 // ---
133
134 return ClhepVGM::Transform(fMultiUnion->GetTransformation(index));
135}
VGM implementation for Geant4 Boolean solid.
Definition MultiUnion.h:40
virtual VGM::Transform Transformation(G4int index) const
virtual ISolid * ConstituentSolid(G4int index) const
virtual int NofSolids() const
Return the number of constituent solids.
virtual std::string Name() const
Return the name of this solid.
G4VSolid * GetSolid(VGM::ISolid *iSolid) const
Definition SolidMap.cxx:68
static SolidMap * Instance()
Definition SolidMap.cxx:28
void AddSolid(VGM::ISolid *, G4VSolid *)
Definition SolidMap.cxx:59
The VGM interface to solids.
Definition ISolid.h:58
BaseVGM utilities.
Definition utilities.h:23
VGM::Transform Transform(const CLHEP::HepRotation &rotation, const CLHEP::Hep3Vector &translation)
Definition transform.cxx:26
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40