VGM Version 5.3
Loading...
Searching...
No Matches
ScaledSolid.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The RootGM 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 Root Scaled solid
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
22
23#include "TGeoMatrix.h"
24#include "TGeoScaledShape.h"
25
26//_____________________________________________________________________________
28 const std::string& name, VGM::ISolid* solid, TGeoScale* scale)
29 : VGM::ISolid(), VGM::IScaledSolid(), BaseVGM::VScaledSolid(), fScaledShape(0)
30{
34
35 // Get solid from the volumes map
36 TGeoShape* rootSolid = RootGM::SolidMap::Instance()->GetSolid(solid);
37
38 // Create new TGeo scaled solid
39 fScaledShape = new TGeoScaledShape(name.data(), rootSolid, scale);
40
41 RootGM::SolidMap::Instance()->AddSolid(this, fScaledShape);
42}
43
44//_____________________________________________________________________________
45RootGM::ScaledSolid::ScaledSolid(TGeoScaledShape* scaledShape)
46 : VGM::ISolid(),
47 VGM::IScaledSolid(),
48 BaseVGM::VScaledSolid(),
49 fScaledShape(scaledShape)
50{
52
53 RootGM::SolidMap::Instance()->AddSolid(this, fScaledShape);
54}
55
56//_____________________________________________________________________________
58 : VGM::ISolid(), VGM::IScaledSolid(), BaseVGM::VScaledSolid()
59{
61}
62
63//_____________________________________________________________________________
65 : VGM::ISolid(rhs), VGM::IScaledSolid(rhs), BaseVGM::VScaledSolid(rhs)
66{
68}
69
70//_____________________________________________________________________________
75
76//
77// public methods
78//
79
80//_____________________________________________________________________________
81std::string RootGM::ScaledSolid::Name() const
82{
83 // Returns the Scaled solid name
84 // ---
85
86 return fScaledShape->GetName();
87}
88
89//_____________________________________________________________________________
91{
92 // Returns the first constituent solid.
93 // ---
94
95 TGeoShape* rootSolid = fScaledShape->GetShape();
96 VGM::ISolid* solid = RootGM::SolidMap::Instance()->GetSolid(rootSolid);
97
98 return solid;
99}
100
101//_____________________________________________________________________________
103{
104 // Returns the solid scale.
105 // ---
106
107 return TransformScale(*(fScaledShape->GetScale()));
108}
VGM implementation for Root Scaled solid.
Definition ScaledSolid.h:34
virtual VGM::ISolid * ConstituentSolid() const
Return the constituent solid.
virtual VGM::Transform Scale() const
Return the 3D scale.
virtual std::string Name() const
Return the name of this solid.
TGeoShape * GetSolid(VGM::ISolid *iSolid) const
Definition SolidMap.cxx:86
void AddSolid(VGM::ISolid *, TGeoShape *)
Definition SolidMap.cxx:59
static SolidMap * Instance()
Definition SolidMap.cxx:28
The VGM interface to solids.
Definition ISolid.h:58
BaseVGM utilities.
Definition utilities.h:23
VGM::Transform TransformScale(const TGeoScale &scale)
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40