VGM Version 5.3
Loading...
Searching...
No Matches
DisplacedSolid.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 DisplacedSolid
14// ---------------------
15// VGM implementation for Geant4 displaced solid
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
19#include "ClhepVGM/transform.h"
20
23
24#include "G4DisplacedSolid.hh"
25#include "G4ReflectedSolid.hh"
26
27//_____________________________________________________________________________
29 VGM::ISolid* constituentSolid, CLHEP::HepRotation* rotation,
30 const CLHEP::Hep3Vector& translation)
31 : VGM::ISolid(),
32 VGM::IDisplacedSolid(),
33 BaseVGM::VDisplacedSolid(),
34 fDisplacedSolid(0),
35 fToBeReflected(false)
36{
41
42 // Get solid from the volumes map
43 G4VSolid* g4Solid =
44 Geant4GM::SolidMap::Instance()->GetSolid(constituentSolid);
45
46 // Create displaced solid
47 fDisplacedSolid = new G4DisplacedSolid(name, g4Solid, rotation, translation);
48
49 Geant4GM::SolidMap::Instance()->AddSolid(this, fDisplacedSolid);
50}
51
52//_____________________________________________________________________________
54 G4DisplacedSolid* displacedSolid, G4ReflectedSolid* reflectedDisplaced)
55 : VGM::ISolid(),
56 VGM::IDisplacedSolid(),
57 BaseVGM::VDisplacedSolid(),
58 fDisplacedSolid(displacedSolid),
59 fToBeReflected(false)
60{
62
63 if (reflectedDisplaced) {
64 fToBeReflected = true;
65 Geant4GM::SolidMap::Instance()->AddSolid(this, reflectedDisplaced);
66 }
67 else
68 Geant4GM::SolidMap::Instance()->AddSolid(this, fDisplacedSolid);
69}
70
71//_____________________________________________________________________________
73 : VGM::ISolid(), VGM::IDisplacedSolid(), BaseVGM::VDisplacedSolid()
74{
76}
77
78//_____________________________________________________________________________
80 : VGM::ISolid(rhs), VGM::IDisplacedSolid(rhs), BaseVGM::VDisplacedSolid(rhs)
81{
83}
84
85//_____________________________________________________________________________
90
91//
92// public methods
93//
94
95//_____________________________________________________________________________
97{
98 // Returns the Displaced solid name
99 // ---
100
101 return fDisplacedSolid->GetName();
102}
103
104//_____________________________________________________________________________
106{
107 // Returns the constituent solid.
108 // ---
109
110 G4VSolid* g4Solid = fDisplacedSolid->GetConstituentMovedSolid();
111
113
114 return solid;
115}
116
117//_____________________________________________________________________________
119{
120 // Returns the first constituent solid.
121 // ---
122
123 return ClhepVGM::Transform(fDisplacedSolid->GetObjectRotation(),
124 fDisplacedSolid->GetObjectTranslation());
125}
VGM implementation for Geant4 displaced solid.
virtual std::string Name() const
Return the name of this solid.
virtual VGM::ISolid * ConstituentSolid() const
Return the constituent solid.
virtual VGM::Transform Displacement() const
Return the 3D displacement of the constituent 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