ATLAS Offline Software
Loading...
Searching...
No Matches
G4ShiftedCone.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5//
6// The G4ShiftedCone class copied from standard G4Cons and modified to:
7// 1) have an arbitrary position along Z axis,
8// 2) represent a twopi-cone. Sectors are not supported but the
9// corresponding code kept and just commented out.
10//
11
12//
13// ********************************************************************
14// * License and Disclaimer *
15// * *
16// * The Geant4 software is copyright of the Copyright Holders of *
17// * the Geant4 Collaboration. It is provided under the terms and *
18// * conditions of the Geant4 Software License, included in the file *
19// * LICENSE and available at http://cern.ch/geant4/license . These *
20// * include a list of copyright holders. *
21// * *
22// * Neither the authors of this software system, nor their employing *
23// * institutes,nor the agencies providing financial support for this *
24// * work make any representation or warranty, express or implied, *
25// * regarding this software system or assume any liability for its *
26// * use. Please see the license in the file LICENSE and URL above *
27// * for the full disclaimer and the limitation of liability. *
28// * *
29// * This code implementation is the result of the scientific and *
30// * technical work of the GEANT4 collaboration. *
31// * By using, copying, modifying or distributing the software (or *
32// * any work based on the software) you agree to acknowledge its *
33// * use in resulting scientific publications, and indicate your *
34// * acceptance of all terms of the Geant4 Software license. *
35// ********************************************************************
36//
37//
38//
39//
40// --------------------------------------------------------------------
41// GEANT 4 class header file
42//
43// G4ShiftedCone
44//
45// Class description:
46//
47// A G4ShiftedCone is, in the general case, a Phi segment of a cone,
48// inner and outer radii specified at z1 and z2.
49// This version does not support phi segmetation, but the code is kept
50// in case it would be necessary later.
51// The Phi segment is described by a starting fSPhi angle, and the
52// +fDPhi delta angle for the shape.
53// If the delta angle is >=2*pi, the shape is treated as continuous
54// in Phi
55//
56// Member Data:
57//
58// fRmin1 inside radius at z1
59// fRmin2 inside radius at z2
60// fRmax1 outside radius at z1
61// fRmax2 outside radius at z2
62// fDz half length in z
63//
64// fSPhi starting angle of the segment in radians
65// fDPhi delta angle of the segment in radians
66//
67// fPhiFullCone Boolean variable used for indicate the Phi Section
68// always true in the current version, hope compiler optimize
69//
70// Note:
71// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
72// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
73// made with (say) Phi of a point.
74
75// History:
76// 03.07.2019 A. Sukharev copied from G4Cons for ATLAS EMEC needs
77// --------------------------------------------------------------------
78#ifndef G4ShiftedCone_HH
79#define G4ShiftedCone_HH
80
81#include <CLHEP/Units/PhysicalConstants.h>
82
83#include "G4CSGSolid.hh"
84#include "G4Polyhedron.hh"
85
86class G4ShiftedCone : public G4CSGSolid
87{
88 public: // with description
89
90 G4ShiftedCone(const G4String& pName,
91 G4double pZ1, G4double pZ2,
92 G4double pRmin1, G4double pRmax1,
93 G4double pRmin2, G4double pRmax2);
94 // G4double pSPhi, G4double pDPhi);
95 //
96 // Constructs a cone with the given name and dimensions
97
99 //
100 // Destructor
101
102 // Accessors
103
104 inline G4double GetInnerRadiusMinusZ() const;
105 inline G4double GetOuterRadiusMinusZ() const;
106 inline G4double GetInnerRadiusPlusZ() const;
107 inline G4double GetOuterRadiusPlusZ() const;
108 inline G4double GetZHalfLength() const;
109 inline G4double GetZ1() const;
110 inline G4double GetZ2() const;
111 inline G4double GetStartPhiAngle() const;
112 inline G4double GetDeltaPhiAngle() const;
113 inline G4double GetSinStartPhi() const;
114 inline G4double GetCosStartPhi() const;
115 inline G4double GetSinEndPhi() const;
116 inline G4double GetCosEndPhi() const;
117
118 // Modifiers
119
120 inline void SetInnerRadiusMinusZ (G4double Rmin1 );
121 inline void SetOuterRadiusMinusZ (G4double Rmax1 );
122 inline void SetInnerRadiusPlusZ (G4double Rmin2 );
123 inline void SetOuterRadiusPlusZ (G4double Rmax2 );
124// inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
125// inline void SetDeltaPhiAngle (G4double newDPhi);
126
127 // Other methods for solid
128
129 inline G4double GetCubicVolume();
130 inline G4double GetSurfaceArea();
131
132 void ComputeDimensions( G4VPVParameterisation* p,
133 const G4int n,
134 const G4VPhysicalVolume* pRep );
135
136 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
137
138 G4bool CalculateExtent( const EAxis pAxis,
139 const G4VoxelLimits& pVoxelLimit,
140 const G4AffineTransform& pTransform,
141 G4double& pMin, G4double& pMax ) const;
142
143 EInside Inside( const G4ThreeVector& p ) const;
144
145 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
146
147 G4double DistanceToIn (const G4ThreeVector& p,
148 const G4ThreeVector& v) const;
149 G4double DistanceToIn (const G4ThreeVector& p) const;
150 G4double DistanceToOut(const G4ThreeVector& p,
151 const G4ThreeVector& v,
152 const G4bool calcNorm=G4bool(false),
153 G4bool *validNorm=0,
154 G4ThreeVector *n=0) const;
155 G4double DistanceToOut(const G4ThreeVector& p) const;
156
157 G4GeometryType GetEntityType() const;
158
159 G4ThreeVector GetPointOnSurface() const;
160
161 G4VSolid* Clone() const;
162
163 std::ostream& StreamInfo(std::ostream& os) const;
164
165 // Visualisation functions
166
167 void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
168 G4Polyhedron* CreatePolyhedron() const;
169
170 public: // without description
171
172 G4ShiftedCone(__void__&);
173 //
174 // Fake default constructor for usage restricted to direct object
175 // persistency for clients requiring preallocation of memory for
176 // persistifiable objects.
177
178 G4ShiftedCone(const G4ShiftedCone& rhs);
180 // Copy constructor and assignment operator.
181
182 // Old access functions
183
184 inline G4double GetRmin1() const;
185 inline G4double GetRmax1() const;
186 inline G4double GetRmin2() const;
187 inline G4double GetRmax2() const;
188// inline G4double GetSPhi() const;
189// inline G4double GetDPhi() const;
190
191 private:
192
193 inline void Initialize();
194 //
195 // Reset relevant values to zero
196
197// inline void CheckSPhiAngle(G4double sPhi);
198// inline void CheckDPhiAngle(G4double dPhi);
199// inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
200 //
201 // Reset relevant flags and angle values
202
204 //
205 // Recompute relevant trigonometric values and cache them
206
207 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
208 //
209 // Algorithm for SurfaceNormal() following the original
210 // specification for points not on the surface
211
212 private:
213
214 // Used by distanceToOut
215 //
217
218 // used by normal
219 //
221
223 //
224 // Radial and angular tolerances
225
227 G4double fDz, fZshift;//, fSPhi, fDPhi;
228 //
229 // Radial and angular dimensions
230
231// G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
232// sinSPhi, cosSPhi, sinEPhi, cosEPhi;
233 //
234 // Cached trigonometric values
235
236// const G4bool fPhiFullCone;
237 //
238 // Flag for identification of section or full cone
239
241 //
242 // Cached half tolerance values
243};
244
245#include "G4ShiftedCone.icc"
246
247#endif
EInside Inside(const G4ThreeVector &p) const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
G4double halfRadTolerance
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4double GetCubicVolume()
G4double GetRmin2() const
G4double GetOuterRadiusMinusZ() const
void SetOuterRadiusPlusZ(G4double Rmax2)
void SetOuterRadiusMinusZ(G4double Rmax1)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadiusMinusZ() const
G4ShiftedCone & operator=(const G4ShiftedCone &rhs)
G4double GetRmax2() const
G4Polyhedron * CreatePolyhedron() const
G4double GetRmax1() const
G4double GetZHalfLength() const
G4double GetSinEndPhi() const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4GeometryType GetEntityType() const
void InitializeTrigonometry()
G4double halfAngTolerance
G4double GetStartPhiAngle() const
void SetInnerRadiusPlusZ(G4double Rmin2)
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
void Initialize()
G4ThreeVector GetPointOnSurface() const
G4double GetInnerRadiusPlusZ() const
G4ShiftedCone(const G4String &pName, G4double pZ1, G4double pZ2, G4double pRmin1, G4double pRmax1, G4double pRmin2, G4double pRmax2)
G4double GetZ1() const
G4double halfCarTolerance
G4double kRadTolerance
G4double GetZ2() const
G4double GetSurfaceArea()
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
void SetInnerRadiusMinusZ(G4double Rmin1)
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4VSolid * Clone() const
G4double GetOuterRadiusPlusZ() const
G4double GetCosEndPhi() const
G4double kAngTolerance
G4double GetCosStartPhi() const
G4double GetSinStartPhi() const
G4double GetRmin1() const
std::ostream & StreamInfo(std::ostream &os) const