Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ReplicatedSlice.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// G4ReplicatedSlice
27//
28// Class description:
29//
30// G4ReplicatedSlice represents many touchable detector elements differing
31// only in their positioning. The elements' positions are calculated by means
32// of a simple linear formula.
33
34// Author: Makoto Asai (SLAC), 20/04/2010 - Extended from G4PVDivision
35// ----------------------------------------------------------------------
36#ifndef G4REPLICATEDSLICE_HH
37#define G4REPLICATEDSLICE_HH 1
38
39#include "geomdefs.hh"
40#include "G4PVReplica.hh"
42
43class G4LogicalVolume;
44class G4VSolid;
45
46/**
47 * @brief G4ReplicatedSlice represents many touchable detector elements
48 * differing only in their positioning. The elements' positions are calculated
49 * by means 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 G4ReplicatedSlice : 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] pMotherLogical 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] half_gap The half-witdh of the gap between slices.
85 * @param[in] offset The optional offset distance from mother's border.
86 */
87 G4ReplicatedSlice(const G4String& pName,
88 G4LogicalVolume* pLogical,
89 G4LogicalVolume* pMotherLogical,
90 const EAxis pAxis,
91 const G4int nReplicas,
92 const G4double width,
93 const G4double half_gap,
94 const G4double offset );
95
96 /**
97 * Constructor with number of divisions.
98 * @param[in] pName The volume name.
99 * @param[in] pLogical Pointer to the logical volume of the division.
100 * @param[in] pMotherLogical Pointer to the logical volume of the mother.
101 * @param[in] pAxis The axis along which do the division.
102 * @param[in] nReplicas The number of copies to replicate.
103 * @param[in] half_gap The half-witdh of the gap between slices.
104 * @param[in] offset The optional offset distance from mother's border.
105 */
106 G4ReplicatedSlice(const G4String& pName,
107 G4LogicalVolume* pLogical,
108 G4LogicalVolume* pMotherLogical,
109 const EAxis pAxis,
110 const G4int nReplicas,
111 const G4double half_gap,
112 const G4double offset );
113
114 /**
115 * Constructor with width of the division slice.
116 * @param[in] pName The volume name.
117 * @param[in] pLogical Pointer to the logical volume of the division.
118 * @param[in] pMotherLogical Pointer to the logical volume of the mother.
119 * @param[in] pAxis The axis along which do the division.
120 * @param[in] width The witdh of the divided slice along the axis.
121 * @param[in] half_gap The half-witdh of the gap between slices.
122 * @param[in] offset The optional offset distance from mother's border.
123 */
124 G4ReplicatedSlice(const G4String& pName,
125 G4LogicalVolume* pLogical,
126 G4LogicalVolume* pMotherLogical,
127 const EAxis pAxis,
128 const G4double width,
129 const G4double half_gap,
130 const G4double offset );
131
132 /**
133 * Constructor in mother physical volume with number of divisions and width.
134 * @param[in] pName The volume name.
135 * @param[in] pLogical Pointer to the logical volume of the division.
136 * @param[in] pMotherPhysical Pointer to the physical volume of the mother.
137 * @param[in] pAxis The axis along which do the division.
138 * @param[in] nReplicas The number of copies to replicate.
139 * @param[in] width The witdh of the divided slice along the axis.
140 * @param[in] half_gap The half-witdh of the gap between slices.
141 * @param[in] offset The optional offset distance from mother's border.
142 */
143 G4ReplicatedSlice(const G4String& pName,
144 G4LogicalVolume* pLogical,
145 G4VPhysicalVolume* pMotherPhysical,
146 const EAxis pAxis,
147 const G4int nReplicas,
148 const G4double width,
149 const G4double half_gap,
150 const G4double offset);
151
152 /**
153 * Constructor in mother physical volume with number of divisions.
154 * @param[in] pName The volume name.
155 * @param[in] pLogical Pointer to the logical volume of the division.
156 * @param[in] pMotherPhysical Pointer to the physical volume of the mother.
157 * @param[in] pAxis The axis along which do the division.
158 * @param[in] nReplicas The number of copies to replicate.
159 * @param[in] half_gap The half-witdh of the gap between slices.
160 * @param[in] offset The optional offset distance from mother's border.
161 */
162 G4ReplicatedSlice(const G4String& pName,
163 G4LogicalVolume* pLogical,
164 G4VPhysicalVolume* pMotherPhysical,
165 const EAxis pAxis,
166 const G4int nReplicas,
167 const G4double half_gap,
168 const G4double offset );
169
170 /**
171 * Constructor in mother physical volume with width of division slice.
172 * @param[in] pName The volume name.
173 * @param[in] pLogical Pointer to the logical volume of the division.
174 * @param[in] pMotherPhysical Pointer to the physical volume of the mother.
175 * @param[in] pAxis The axis along which do the division.
176 * @param[in] width The witdh of the divided slice along the axis.
177 * @param[in] half_gap The half-witdh of the gap between slices.
178 * @param[in] offset The optional offset distance from mother's border.
179 */
180 G4ReplicatedSlice(const G4String& pName,
181 G4LogicalVolume* pLogical,
182 G4VPhysicalVolume* pMotherPhysical,
183 const EAxis pAxis,
184 const G4double width,
185 const G4double half_gap,
186 const G4double offset );
187
188 /**
189 * Destructor.
190 */
191 ~G4ReplicatedSlice() override;
192
193 /**
194 * Copy constructor and assignment operator not allowed.
195 */
198
199 /**
200 * Not used.
201 */
202 G4bool IsMany() const override;
203
204 /**
205 * Returns true.
206 */
207 G4bool IsReplicated() const override;
208
209 /**
210 * Returns the number of slices.
211 */
212 G4int GetMultiplicity() const override;
213
214 /**
215 * Returns true to identify if it is a parameterised physical volume.
216 */
217 G4bool IsParameterised() const override;
218
219 /**
220 * Returns the pointer to the parameterisation algorithm.
221 */
223
224 /**
225 * Fills arguments with the attributes from the base replica.
226 * @param[in,out] axis Axis of parameterisation returned.
227 * @param[in,out] nReplicas The number of division copies.
228 * @param[in,out] width Width of the division slice.
229 * @param[in,out] offset Potential offset in replication.
230 * @param[in,out] consuming Flag of replica characterisation (always false
231 * for parameterisations).
232 */
234 G4int& nReplicas,
235 G4double& width,
237 G4bool& consuming ) const override;
238
239 /**
240 * Returns the axis along which the division is made.
241 * @returns The string Id of the axis.
242 */
244
245 /**
246 * Returns the volume type characterisation.
247 * @returns The string Id of the volume type, i.e. 'kParameterised'.
248 */
249 EVolume VolumeType() const final;
250
251 /**
252 * Methods to identify volumes that can have revised 'regular' navigation.
253 * Currently divisions do not qualify for this.
254 */
255 G4bool IsRegularStructure() const override;
256 G4int GetRegularStructureId() const override;
257
258 private:
259
260 /**
261 * Invoked in constructors to check and set the parameters for the
262 * parameterisation.
263 */
264 void CheckAndSetParameters( const EAxis pAxis,
265 const G4int nDivs,
266 const G4double width,
267 const G4double half_gap,
268 const G4double offset,
269 DivisionType divType,
270 G4LogicalVolume* pMotherLogical,
271 const G4LogicalVolume* pLogical );
272
273 /**
274 * Sets the parameterisation according to the allowed type of solid
275 * to be divided.
276 */
277 void SetParameterisation( G4LogicalVolume* motherLogical,
278 const EAxis pAxis,
279 const G4int nReplicas,
280 const G4double width,
281 const G4double half_gap,
282 const G4double offset,
283 DivisionType divType );
284
285 /**
286 * Logging the axis when an error in division occurs.
287 */
288 void ErrorInAxis( EAxis axis, G4VSolid* solid );
289
290 protected:
291
292 /** Axis of optimisation. */
294
295 /** Axis of division. */
297
298 /** Number of slices. */
300
301 /** Width of the division slice and potential offset. */
302 G4double fwidth = 0.0, foffset = 0.0;
303
304 /** Pointer to the parameterisation algorithm. */
306};
307
308#endif
G4ThreadLocal T * G4GeomSplitter< T >::offset
G4VPVParameterisation * GetParameterisation() const override
EAxis faxis
EAxis GetDivisionAxis() const
G4int fnReplicas
G4bool IsParameterised() const override
G4double fwidth
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
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....
G4ReplicatedSlice(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMotherLogical, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double half_gap, const G4double offset)
G4ReplicatedSlice represents many touchable detector elements differing only in their positioning....
~G4ReplicatedSlice() override
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