VGM Version 5.3
Loading...
Searching...
No Matches
ScaledSolid.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 ScaledSolid
14// ---------------------
15// VGM implementation for Geant4 Scaled solid
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
19#include "ClhepVGM/transform.h"
20
23
24#include "G4ReflectedSolid.hh"
25#include "G4ScaledSolid.hh"
26
27//_____________________________________________________________________________
29 const std::string& name, VGM::ISolid* solid, const HepGeom::Scale3D& scale3D)
30 : VGM::ISolid(),
31 VGM::IScaledSolid(),
32 BaseVGM::VScaledSolid(),
33 fScaledSolid(0),
34 fToBeReflected(false)
35{
40
41 // Get solid from the volumes map
42 G4VSolid* g4Solid = Geant4GM::SolidMap::Instance()->GetSolid(solid);
43
44 // Create G4 solid
45 fScaledSolid = new G4ScaledSolid(name, g4Solid, scale3D);
46
47 Geant4GM::SolidMap::Instance()->AddSolid(this, fScaledSolid);
48}
49
50//_____________________________________________________________________________
52 G4ScaledSolid* scaledSolid, G4ReflectedSolid* reflectedScaled)
53 : VGM::ISolid(),
54 VGM::IScaledSolid(),
55 BaseVGM::VScaledSolid(),
56 fScaledSolid(scaledSolid),
57 fToBeReflected(false)
58{
60
61 if (reflectedScaled) {
62 fToBeReflected = true;
63 Geant4GM::SolidMap::Instance()->AddSolid(this, reflectedScaled);
64 }
65 else {
66 Geant4GM::SolidMap::Instance()->AddSolid(this, fScaledSolid);
67 }
68}
69
70//_____________________________________________________________________________
72 : VGM::ISolid(), VGM::IScaledSolid(), BaseVGM::VScaledSolid()
73{
75}
76
77//_____________________________________________________________________________
79 : VGM::ISolid(rhs), VGM::IScaledSolid(rhs), BaseVGM::VScaledSolid(rhs)
80{
82}
83
84//_____________________________________________________________________________
89
90//
91// public methods
92//
93
94//_____________________________________________________________________________
95std::string Geant4GM::ScaledSolid::Name() const
96{
97 // Returns the Scaled solid name
98 // ---
99
100 return fScaledSolid->GetName();
101}
102
103//_____________________________________________________________________________
105{
106 // Returns the constituent (unscaled) solid.
107 // ---
108
109 G4VSolid* g4Solid = fScaledSolid->GetUnscaledSolid();
111
112 return solid;
113}
114
115//_____________________________________________________________________________
117{
118 // Returns the solid scale as three vector
119 // ---
120
121 return ClhepVGM::TransformScale(fScaledSolid->GetScaleTransform());
122}
VGM implementation for Geant4 Scaled solid.
Definition ScaledSolid.h:36
virtual VGM::ISolid * ConstituentSolid() const
Return the constituent solid.
virtual std::string Name() const
Return the name of this solid.
virtual VGM::Transform Scale() const
Return the 3D scale.
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 TransformScale(const HepGeom::Scale3D &scaleTransform)
Definition transform.cxx:87
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40