VGM Version 5.3
Loading...
Searching...
No Matches
Sphere.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 Sphere
14// ---------------
15// VGM implementation for Geant4 tubs solid.
16// If reflected, the parameters are changed as follows:
17// rin, rout --> rin', rout'
18// sphi, dphi --> sphi', dphi'
19// stheta --> PI - stheta'
20// dtheta --> dtheta'
21//
22// Author: Ivana Hrivnacova; IPN Orsay
23
24#include "VGM/common/Math.h"
25
26#include "ClhepVGM/Units.h"
27
30
31#include "G4ReflectedSolid.hh"
32#include "G4Sphere.hh"
33
34//_____________________________________________________________________________
35Geant4GM::Sphere::Sphere(const std::string& name, double rin, double rout,
36 double sphi, double dphi, double stheta, double dtheta)
37 : VGM::ISolid(),
38 VGM::ISphere(),
39 BaseVGM::VSphere(),
40 fIsReflected(false),
41 fSphere(new G4Sphere(name, rin / ClhepVGM::Units::Length(),
42 rout / ClhepVGM::Units::Length(), sphi / ClhepVGM::Units::Angle(),
43 dphi / ClhepVGM::Units::Angle(), stheta / ClhepVGM::Units::Angle(),
44 dtheta / ClhepVGM::Units::Angle()))
45{
53
54 Geant4GM::SolidMap::Instance()->AddSolid(this, fSphere);
55}
56
57//_____________________________________________________________________________
58Geant4GM::Sphere::Sphere(G4Sphere* sphere, G4ReflectedSolid* reflSphere)
59 : VGM::ISolid(),
60 VGM::ISphere(),
61 BaseVGM::VSphere(),
62 fIsReflected(false),
63 fSphere(sphere)
64{
66
67 if (reflSphere) {
68 fIsReflected = true;
69 Geant4GM::SolidMap::Instance()->AddSolid(this, reflSphere);
70 }
71 else
73}
74
75//_____________________________________________________________________________
76Geant4GM::Sphere::Sphere() : VGM::ISolid(), VGM::ISphere(), BaseVGM::VSphere()
77{
79}
80
81//_____________________________________________________________________________
83 : VGM::ISolid(rhs), VGM::ISphere(rhs), BaseVGM::VSphere(rhs)
84{
86}
87
88//_____________________________________________________________________________
93
94//_____________________________________________________________________________
95std::string Geant4GM::Sphere::Name() const { return fSphere->GetName(); }
96
97//_____________________________________________________________________________
99{
100 return fSphere->GetInnerRadius() * ClhepVGM::Units::Length();
101}
102
103//_____________________________________________________________________________
105{
106 return fSphere->GetOuterRadius() * ClhepVGM::Units::Length();
107}
108
109//_____________________________________________________________________________
111{
112 return fSphere->GetStartPhiAngle() * ClhepVGM::Units::Angle();
113}
114
115//_____________________________________________________________________________
117{
118 return fSphere->GetDeltaPhiAngle() * ClhepVGM::Units::Angle();
119}
120
121//_____________________________________________________________________________
123{
124 if (!fIsReflected)
125 return fSphere->GetStartThetaAngle() * ClhepVGM::Units::Angle();
126 else
127 return (M_PI - fSphere->GetDeltaThetaAngle()) * ClhepVGM::Units::Angle();
128}
129
130//_____________________________________________________________________________
132{
133 return fSphere->GetDeltaThetaAngle() * ClhepVGM::Units::Angle();
134}
static double Length()
Return CLHEP default length unit in VGM units.
Definition Units.cxx:83
static double Angle()
Return CLHEP default angle unit in VGM units.
Definition Units.cxx:92
static SolidMap * Instance()
Definition SolidMap.cxx:28
void AddSolid(VGM::ISolid *, G4VSolid *)
Definition SolidMap.cxx:59
VGM implementation for Geant4 sphere solid.
Definition Sphere.h:33
virtual double StartPhi() const
Return the starting azimuthal angle of the segment in deg.
Definition Sphere.cxx:110
virtual double StartTheta() const
Return the starting polar angle of the segment in deg.
Definition Sphere.cxx:122
virtual double InnerRadius() const
Return the inside radius of the shell in mm.
Definition Sphere.cxx:98
virtual double DeltaPhi() const
Return the opening azimuthal angle of the segment in deg.
Definition Sphere.cxx:116
virtual ~Sphere()
Definition Sphere.cxx:89
virtual double OuterRadius() const
Return the outside radius of the shell in mm.
Definition Sphere.cxx:104
virtual std::string Name() const
Return the name of this solid.
Definition Sphere.cxx:95
virtual double DeltaTheta() const
Return the opening polar angle of the segment in deg.
Definition Sphere.cxx:131
#define M_PI
Definition of math constant M_PI not available on Win32.
Definition Math.h:24
BaseVGM utilities.
Definition utilities.h:23
ClhepVGM utilities.
Definition transform.h:29
VGM interfaces.
Definition VMedium.h:28