Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VDivisionParameterisation.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4VDivisionParameterisation
27//
28// Class description:
29//
30// Base class for parameterisations defining divisions of volumes
31// for different kind of CSG and specific solids.
32
33// Author: Pedro Arce (CIEMAT), 09.05.2001 - Initial version
34// Ivana Hrivnacova (Orsay), 08.04.2004 - Implemented reflection
35// Makoto Asai (SLAC), 21.04.2010 - Added gaps
36//---------------------------------------------------------------------
37#ifndef G4VDIVISIONPARAMETERISATION_HH
38#define G4VDIVISIONPARAMETERISATION_HH 1
39
40#include "G4Types.hh"
41#include "geomdefs.hh"
43#include "G4RotationMatrix.hh"
44
46
48class G4VSolid;
49
50/**
51 * @brief G4VDivisionParameterisation is the base class for parameterisations
52 * defining divisions of volumes for different kind of CSG and specific solids.
53 */
54
56{
57 public:
58
59 /**
60 * Constructor with number of divisions and width.
61 * @param[in] axis The axis along which do the division.
62 * @param[in] nDiv The number of division copies to replicate.
63 * @param[in] width The witdh of the divided slice along the axis.
64 * @param[in] offset The optional offset distance from mother's border.
65 * @param[in] divType The kind of division type, based on input parameters.
66 * @param[in] motherSolid Pointer to the solid to be divided.
67 */
69 G4int nDiv,
70 G4double width,
72 DivisionType divType,
73 G4VSolid* motherSolid = nullptr );
74
75 /**
76 * Destructor.
77 */
79
80 /**
81 * Invokes the base parameterisation to compute the parameterised solid.
82 * @param[in] pv Pointer to the physical volume to divide.
83 * @returns The pointer to the generated solid slice.
84 */
85 G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume* pv) override;
86
87 /**
88 * Base method to be implemented in derived classes for defining the
89 * transformation in the parameterisation.
90 */
91 void ComputeTransformation(const G4int copyNo,
92 G4VPhysicalVolume* physVol) const override = 0;
93
94 /**
95 * Accessors and setters.
96 */
97 inline const G4String& GetType() const;
98 inline EAxis GetAxis() const;
99 inline G4int GetNoDiv() const;
100 inline G4double GetWidth() const;
101 inline G4double GetOffset() const;
102 inline G4VSolid* GetMotherSolid() const;
103 inline void SetType(const G4String& type);
104 inline void SetHalfGap(G4double hg);
105 inline G4double GetHalfGap() const;
106
107 protected:
108
109 /**
110 * Defines and sets rotation on Z in trasformation for given volume.
111 * @param[in,out] physVol Pointer to the physical volume to apply rotation.
112 * @param[in] rotZ The rotation on Z (default is 0).
113 */
114 void ChangeRotMatrix( G4VPhysicalVolume* physVol,
115 G4double rotZ = 0.0 ) const;
116
117 /**
118 * Calculates the number of divisions, based on the input parameters.
119 * @param[in] motherDim The width of the volume to divide.
120 * @param[in] width The width of the division slice.
121 * @param[in] offset The optional offset distance from mother's border.
122 * @returns The number of divisions.
123 */
124 G4int CalculateNDiv( G4double motherDim, G4double width,
125 G4double offset ) const;
126
127 /**
128 * Calculates the slice width, based on the input parameters.
129 * @param[in] motherDim The width of the volume to divide.
130 * @param[in] nDiv The number of division slices to create.
131 * @param[in] offset The optional offset distance from mother's border.
132 * @returns The width of the division slice.
133 */
134 G4double CalculateWidth( G4double motherDim, G4int nDiv,
135 G4double offset ) const;
136
137 /**
138 * Checks the validity of parameters given in input, issuing an exception.
139 */
140 virtual void CheckParametersValidity();
141
142 /**
143 * Internal methods for checking parameters.
144 */
145 void CheckOffset( G4double maxPar );
146 void CheckNDivAndWidth( G4double maxPar );
147
148 /**
149 * Returns the max width along the axis of division.
150 * @returns The maximum width of the solid to divide along the axis.
151 */
152 virtual G4double GetMaxParameter() const = 0;
153
154 /**
155 * Sets the offset, taking into account potential reflection.
156 */
157 G4double OffsetZ() const;
158
159 protected:
160
161 G4String ftype; // String for division type
162 EAxis faxis; // Axis of division
163 G4int fnDiv = 0; // Number of divisions
164 G4double fwidth = 0.0; // Width of division slice
165 G4double foffset = 0.0; // Offset distance from mother's border
166 DivisionType fDivisionType; // Division type ID
167 G4VSolid* fmotherSolid = nullptr; // Pointer to solid to divide
168 G4bool fReflectedSolid = false; // Specifies if solid is reflected
169 G4bool fDeleteSolid = false; // Specifies if delete solid to divide
170
171 static G4ThreadLocal G4RotationMatrix* fRot; // Rotation transformation
172
173 static const G4int verbose; // Verbosity level
174
175 G4double kCarTolerance; // Cached surface tolerance
176
177 G4double fhgap = 0.0; // Cached gap between slices
178};
179
180#include "G4VDivisionParameterisation.icc"
181
182#endif
G4ThreadLocal T * G4GeomSplitter< T >::offset
CLHEP::HepRotation G4RotationMatrix
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4double GetOffset() const
void SetType(const G4String &type)
virtual G4double GetMaxParameter() const =0
G4double GetHalfGap() const
void SetHalfGap(G4double hg)
const G4String & GetType() const
G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *pv) override
G4double CalculateWidth(G4double motherDim, G4int nDiv, G4double offset) const
G4VSolid * GetMotherSolid() const
G4int CalculateNDiv(G4double motherDim, G4double width, G4double offset) const
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const override=0
G4double GetWidth() const
static G4ThreadLocal G4RotationMatrix * fRot
G4VDivisionParameterisation(EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=nullptr)
void ChangeRotMatrix(G4VPhysicalVolume *physVol, G4double rotZ=0.0) const
G4VPVParameterisation()=default
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
Definition G4VSolid.hh:80
EAxis
Definition geomdefs.hh:54
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668
#define G4ThreadLocal
Definition tls.hh:77