Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVDivision.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// G4PVDivision
27//
28// Class description:
29//
30// Represents many touchable detector elements differing only in their
31// positioning. The elements' positions are calculated by means of a simple
32// linear formula.
33
34// Author: Pedro Arce (CIEMAT), 09.05.2001 - Initial version
35// ----------------------------------------------------------------------
36#ifndef G4PVDIVISION_HH
37#define G4PVDIVISION_HH 1
38
39#include "geomdefs.hh"
40#include "G4PVReplica.hh"
42
43class G4LogicalVolume;
44class G4VSolid;
45
46/**
47 * @brief G4PVDivision represents many touchable detector elements differing
48 * only in their positioning. The elements' positions are calculated by means
49 * of a simple linear formula.
50 *
51 * Division may occur along:
52 *
53 * o Cartesian axes (kXAxis,kYAxis,kZAxis)
54 *
55 * The divisions, of specified width have coordinates of
56 * form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
57 * for the case of kXAxis, and are unrotated.
58 *
59 * o Radial axis (cylindrical polar) (kRho)
60 *
61 * The divisions are cons/tubs sections, centred on the origin
62 * and are unrotated.
63 * They have radii of width*n+offset to width*(n+1)+offset
64 * where n=0..nReplicas-1
65 *
66 * o Phi axis (cylindrical polar) (kPhi)
67 * The divisions are `phi sections' or wedges, and of cons/tubs form
68 * They have phi of offset+n*width to offset+(n+1)*width where
69 * n=0..nReplicas-1
70 */
71
72class G4PVDivision : public G4PVReplica
73{
74 public:
75
76 /**
77 * Constructor with number of divisions and width.
78 * @param[in] pName The volume name.
79 * @param[in] pLogical Pointer to the logical volume of the division.
80 * @param[in] pMother Pointer to the logical volume of the mother.
81 * @param[in] pAxis The axis along which do the division.
82 * @param[in] nReplicas The number of copies to replicate.
83 * @param[in] width The witdh of the divided slice along the axis.
84 * @param[in] offset The optional offset distance from mother's border.
85 */
86 G4PVDivision(const G4String& pName,
87 G4LogicalVolume* pLogical,
88 G4LogicalVolume* pMother,
89 const EAxis pAxis,
90 const G4int nReplicas,
91 const G4double width,
92 const G4double offset );
93
94 /**
95 * Constructor with number of divisions.
96 * @param[in] pName The volume name.
97 * @param[in] pLogical Pointer to the logical volume of the division.
98 * @param[in] pMother Pointer to the logical volume of the mother.
99 * @param[in] pAxis The axis along which do the division.
100 * @param[in] nReplicas The number of copies to replicate.
101 * @param[in] offset The optional offset distance from mother's border.
102 */
103 G4PVDivision(const G4String& pName,
104 G4LogicalVolume* pLogical,
105 G4LogicalVolume* pMother,
106 const EAxis pAxis,
107 const G4int nReplicas,
108 const G4double offset );
109
110 /**
111 * Constructor with width.
112 * @param[in] pName The volume name.
113 * @param[in] pLogical Pointer to the logical volume of the division.
114 * @param[in] pMother Pointer to the logical volume of the mother.
115 * @param[in] pAxis The axis along which do the division.
116 * @param[in] width The witdh of the divided slice along the axis.
117 * @param[in] offset The optional offset distance from mother's border.
118 */
119 G4PVDivision(const G4String& pName,
120 G4LogicalVolume* pLogical,
121 G4LogicalVolume* pMother,
122 const EAxis pAxis,
123 const G4double width,
124 const G4double offset );
125
126 /**
127 * Constructor in mother physical volume (same as first constructor).
128 * @param[in] pName The volume name.
129 * @param[in] pLogical Pointer to the logical volume of the division.
130 * @param[in] pMother Pointer to the physical volume of the mother.
131 * @param[in] pAxis The axis along which do the division.
132 * @param[in] nReplicas The number of copies to replicate.
133 * @param[in] width The witdh of the divided slice along the axis.
134 * @param[in] offset The optional offset distance from mother's border.
135 */
136 G4PVDivision(const G4String& pName,
137 G4LogicalVolume* pLogical,
138 G4VPhysicalVolume* pMother,
139 const EAxis pAxis,
140 const G4int nReplicas,
141 const G4double width,
142 const G4double offset);
143
144 /**
145 * Destructor.
146 */
147 ~G4PVDivision() override;
148
149 /**
150 * Copy constructor and assignment operator not allowed.
151 */
152 G4PVDivision(const G4PVDivision&) = delete;
154
155 /**
156 * Not used.
157 */
158 G4bool IsMany() const override;
159
160 /**
161 * Returns true.
162 */
163 G4bool IsReplicated() const override;
164
165 /**
166 * Returns the number of divisions.
167 */
168 G4int GetMultiplicity() const override;
169
170 /**
171 * Returns true to identify if it is a parameterised physical volume.
172 */
173 G4bool IsParameterised() const override;
174
175 /**
176 * Returns the pointer to the parameterisation algorithm.
177 */
179
180 /**
181 * Fills arguments with the attributes from the base replica.
182 * @param[in,out] axis Axis of parameterisation returned.
183 * @param[in,out] nReplicas The number of division copies.
184 * @param[in,out] width Width of the division slice.
185 * @param[in,out] offset Potential offset in replication.
186 * @param[in,out] consuming Flag of replica characterisation (always false
187 * for parameterisations).
188 */
190 G4int& nReplicas,
191 G4double& width,
193 G4bool& consuming ) const override;
194
195 /**
196 * Returns the axis along which the division is made.
197 * @returns The string Id of the axis.
198 */
199 EAxis GetDivisionAxis() const;
200
201 /**
202 * Returns the volume type characterisation.
203 * @returns The string Id of the volume type, i.e. 'kParameterised'.
204 */
205 EVolume VolumeType() const override;
206
207 /**
208 * Methods to identify volumes that can have revised 'regular' navigation.
209 * Currently divisions do not qualify for this.
210 */
211 G4bool IsRegularStructure() const override; // Returns false
212 G4int GetRegularStructureId() const override; // Returns 0
213
214 private:
215
216 /**
217 * Invoked in constructors to check and set the parameters for the
218 * parameterisation.
219 */
220 void CheckAndSetParameters( const EAxis pAxis,
221 const G4int nDivs,
222 const G4double width,
223 const G4double offset,
224 DivisionType divType,
225 const G4LogicalVolume* pMotherLogical );
226
227 /**
228 * Sets the parameterisation according to the allowed type of solid
229 * to be divided.
230 */
231 void SetParameterisation( G4LogicalVolume* motherLogical,
232 const EAxis pAxis,
233 const G4int nReplicas,
234 const G4double width,
235 const G4double offset,
236 DivisionType divType );
237
238 /**
239 * Logging the axis when an error in division occurs.
240 */
241 void ErrorInAxis( EAxis axis, G4VSolid* solid );
242
243 protected:
244
245 /** Axis of optimisation. */
247
248 /** Axis of division. */
250
251 /** Number of divisions. */
253
254 /** Width of the division slice and potential offset. */
255 G4double fwidth = 0.0, foffset = 0.0;
256
257 /** Pointer to the parameterisation algorithm. */
259};
260
261#endif
G4ThreadLocal T * G4GeomSplitter< T >::offset
G4VPVParameterisation * GetParameterisation() const override
EAxis faxis
EAxis GetDivisionAxis() const
G4int fnReplicas
G4bool IsParameterised() const override
G4double fwidth
~G4PVDivision() override
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const override
G4bool IsMany() const override
G4double foffset
G4PVDivision & operator=(const G4PVDivision &)=delete
G4int GetRegularStructureId() const override
G4VDivisionParameterisation * fparam
EAxis fdivAxis
G4bool IsReplicated() const override
G4int GetMultiplicity() const override
G4bool IsRegularStructure() const override
EVolume VolumeType() const override
G4PVDivision(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)
G4PVDivision represents many touchable detector elements differing only in their positioning....
G4PVReplica(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0.)
G4PVReplica represents many touchable detector elements differing only in their positioning....
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
G4VDivisionParameterisation is the base class for parameterisations defining divisions of volumes for...
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
Definition G4VSolid.hh:80
EAxis
Definition geomdefs.hh:54
EVolume
Definition geomdefs.hh:83
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668