ATLAS Offline Software
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 
86 class 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 
98  ~G4ShiftedCone() ;
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 
203  inline void InitializeTrigonometry();
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 
226  G4double fRmin1, fRmin2, fRmax1, fRmax2;
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
G4ShiftedCone::fDz
G4double fDz
Definition: G4ShiftedCone.h:227
G4ShiftedCone::DescribeYourselfTo
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4ShiftedCone.cxx:2253
G4ShiftedCone::fZshift
G4double fZshift
Definition: G4ShiftedCone.h:227
G4ShiftedCone::~G4ShiftedCone
~G4ShiftedCone()
Definition: G4ShiftedCone.cxx:148
G4ShiftedCone::GetRmin1
G4double GetRmin1() const
G4ShiftedCone::GetCosStartPhi
G4double GetCosStartPhi() const
G4ShiftedCone::Clone
G4VSolid * Clone() const
Definition: G4ShiftedCone.cxx:2129
G4ShiftedCone.icc
G4ShiftedCone::operator=
G4ShiftedCone & operator=(const G4ShiftedCone &rhs)
Definition: G4ShiftedCone.cxx:175
G4ShiftedCone::kNRMax
@ kNRMax
Definition: G4ShiftedCone.h:220
G4ShiftedCone::GetInnerRadiusPlusZ
G4double GetInnerRadiusPlusZ() const
G4ShiftedCone::DistanceToOut
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4ShiftedCone.cxx:1414
G4ShiftedCone::GetRmax2
G4double GetRmax2() const
G4ShiftedCone::GetEntityType
G4GeometryType GetEntityType() const
Definition: G4ShiftedCone.cxx:2120
G4ShiftedCone::SetOuterRadiusMinusZ
void SetOuterRadiusMinusZ(G4double Rmax1)
G4ShiftedCone::SetOuterRadiusPlusZ
void SetOuterRadiusPlusZ(G4double Rmax2)
G4ShiftedCone::GetZ1
G4double GetZ1() const
G4ShiftedCone::kMZ
@ kMZ
Definition: G4ShiftedCone.h:216
G4ShiftedCone::Inside
EInside Inside(const G4ThreeVector &p) const
Definition: G4ShiftedCone.cxx:209
G4ShiftedCone::CalculateExtent
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4ShiftedCone.cxx:325
G4ShiftedCone::SurfaceNormal
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4ShiftedCone.cxx:442
G4ShiftedCone::CreatePolyhedron
G4Polyhedron * CreatePolyhedron() const
Definition: G4ShiftedCone.cxx:2258
G4ShiftedCone::GetInnerRadiusMinusZ
G4double GetInnerRadiusMinusZ() const
G4ShiftedCone
Definition: G4ShiftedCone.h:87
G4ShiftedCone::GetSinEndPhi
G4double GetSinEndPhi() const
G4ShiftedCone::StreamInfo
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4ShiftedCone.cxx:2138
G4ShiftedCone::ESide
ESide
Definition: G4ShiftedCone.h:216
G4ShiftedCone::halfCarTolerance
G4double halfCarTolerance
Definition: G4ShiftedCone.h:240
G4ShiftedCone::GetRmax1
G4double GetRmax1() const
G4ShiftedCone::kRMin
@ kRMin
Definition: G4ShiftedCone.h:216
G4ShiftedCone::GetSurfaceArea
G4double GetSurfaceArea()
G4ShiftedCone::Initialize
void Initialize()
G4ShiftedCone::kEPhi
@ kEPhi
Definition: G4ShiftedCone.h:216
G4ShiftedCone::SetInnerRadiusMinusZ
void SetInnerRadiusMinusZ(G4double Rmin1)
G4ShiftedCone::DistanceToIn
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4ShiftedCone.cxx:677
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
G4ShiftedCone::ComputeDimensions
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4ShiftedCone.cxx:267
G4ShiftedCone::GetOuterRadiusMinusZ
G4double GetOuterRadiusMinusZ() const
G4ShiftedCone::GetSinStartPhi
G4double GetSinStartPhi() const
G4ShiftedCone::halfAngTolerance
G4double halfAngTolerance
Definition: G4ShiftedCone.h:240
G4ShiftedCone::fRmax1
G4double fRmax1
Definition: G4ShiftedCone.h:226
beamspotman.n
n
Definition: beamspotman.py:731
G4ShiftedCone::GetCosEndPhi
G4double GetCosEndPhi() const
G4ShiftedCone::fRmin2
G4double fRmin2
Definition: G4ShiftedCone.h:226
G4ShiftedCone::fRmin1
G4double fRmin1
Definition: G4ShiftedCone.h:226
G4ShiftedCone::G4ShiftedCone
G4ShiftedCone(const G4String &pName, G4double pZ1, G4double pZ2, G4double pRmin1, G4double pRmax1, G4double pRmin2, G4double pRmax2)
Definition: G4ShiftedCone.cxx:81
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
G4ShiftedCone::BoundingLimits
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4ShiftedCone.cxx:282
G4ShiftedCone::kRadTolerance
G4double kRadTolerance
Definition: G4ShiftedCone.h:222
G4ShiftedCone::GetZ2
G4double GetZ2() const
G4ShiftedCone::GetZHalfLength
G4double GetZHalfLength() const
G4ShiftedCone::kNRMin
@ kNRMin
Definition: G4ShiftedCone.h:220
G4ShiftedCone::GetCubicVolume
G4double GetCubicVolume()
G4ShiftedCone::ApproxSurfaceNormal
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4ShiftedCone.cxx:548
G4ShiftedCone::kNull
@ kNull
Definition: G4ShiftedCone.h:216
G4ShiftedCone::GetRmin2
G4double GetRmin2() const
G4ShiftedCone::GetPointOnSurface
G4ThreeVector GetPointOnSurface() const
Definition: G4ShiftedCone.cxx:2166
python.PyAthena.v
v
Definition: PyAthena.py:154
G4ShiftedCone::kPZ
@ kPZ
Definition: G4ShiftedCone.h:216
G4ShiftedCone::ENorm
ENorm
Definition: G4ShiftedCone.h:220
G4ShiftedCone::kRMax
@ kRMax
Definition: G4ShiftedCone.h:216
G4ShiftedCone::kNSPhi
@ kNSPhi
Definition: G4ShiftedCone.h:220
G4ShiftedCone::kAngTolerance
G4double kAngTolerance
Definition: G4ShiftedCone.h:222
G4ShiftedCone::kNZ
@ kNZ
Definition: G4ShiftedCone.h:220
G4ShiftedCone::InitializeTrigonometry
void InitializeTrigonometry()
G4ShiftedCone::kNEPhi
@ kNEPhi
Definition: G4ShiftedCone.h:220
G4ShiftedCone::GetDeltaPhiAngle
G4double GetDeltaPhiAngle() const
G4ShiftedCone::GetStartPhiAngle
G4double GetStartPhiAngle() const
G4ShiftedCone::SetInnerRadiusPlusZ
void SetInnerRadiusPlusZ(G4double Rmin2)
G4ShiftedCone::fRmax2
G4double fRmax2
Definition: G4ShiftedCone.h:226
G4ShiftedCone::kSPhi
@ kSPhi
Definition: G4ShiftedCone.h:216
G4ShiftedCone::halfRadTolerance
G4double halfRadTolerance
Definition: G4ShiftedCone.h:240
G4ShiftedCone::GetOuterRadiusPlusZ
G4double GetOuterRadiusPlusZ() const