Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVPlacement.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// G4PVPlacement
27//
28// Class description:
29//
30// Class representing a single volume positioned within and relative
31// to a mother volume.
32
33// Author: Paul Kent (CERN), 24.07.1995 - First non-stub version
34// ----------------------------------------------------------------------
35#ifndef G4PVPLACEMENT_HH
36#define G4PVPLACEMENT_HH
37
38#include "G4VPhysicalVolume.hh"
39#include "G4Transform3D.hh"
40
41/**
42 * @brief G4PVPlacement represents a single volume positioned within and
43 * relative to a mother volume.
44 */
45
47{
48 public:
49
50 /**
51 * Initialises a single volume, positioned in a frame which is rotated by
52 * '*pRot' and traslated by 'tlate', relative to the coordinate system of
53 * the mother volume 'pMotherLogical'.
54 * If 'pRot=nullptr' the volume is unrotated with respect to its mother.
55 * The physical volume is added to the mother's logical volume.
56 * This is a very natural way of defining a physical volume, and is
57 * especially useful when creating subdetectors: the mother volumes are
58 * not placed until a later stage of the assembly program.
59 * @param[in] pRot The pointer to the rotation in the mother volume.
60 * @param[in] tlate Traslation vector in the mother volume.
61 * @param[in] pCurrentLogical Pointer to its logical volume.
62 * @param[in] pName The volume name.
63 * @param[in] pMotherLogical Pointer to the logical volume of the mother.
64 * @param[in] pMany Flag to identify if the volume is meant to be
65 * considered an overlapping structure, or not. - not used.
66 * @param[in] pCopyNo The optional custom copy number. Should be set to 0
67 * for the first volume of a given type.
68 * @param[in] pSurfChk Boolean flag, if true activates check for overlaps
69 * with existing volumes (false by default).
70 */
72 const G4ThreeVector& tlate,
73 G4LogicalVolume* pCurrentLogical,
74 const G4String& pName,
75 G4LogicalVolume* pMotherLogical,
76 G4bool pMany,
77 G4int pCopyNo,
78 G4bool pSurfChk = false);
79
80 /**
81 * Additional constructor, which expects a G4Transform3D object that
82 * represents the direct rotation and translation of the solid (NOT of the
83 * frame). The G4Transform3D argument should be constructed by:
84 * i) First rotating it to align the solid to the system of
85 * reference of its mother volume *pMotherLogical, and
86 * ii) Then placing the solid at the location Transform3D.getTranslation(),
87 * with respect to the origin of the system of coordinates of the
88 * mother volume.
89 * This construct is useful for the people who prefer to think in terms
90 * of moving objects in a given reference frame.
91 * All other arguments are the same as for the previous constructor.
92 * @param[in] Transform3D The transformation in the 3D space.
93 * @param[in] pCurrentLogical Pointer to its logical volume.
94 * @param[in] pName The volume name.
95 * @param[in] pMotherLogical Pointer to the logical volume of the mother.
96 * @param[in] pMany Flag to identify if the volume is meant to be
97 * considered an overlapping structure, or not. - not used.
98 * @param[in] pCopyNo The optional custom copy number. Should be set to 0
99 * for the first volume of a given type.
100 * @param[in] pSurfChk Boolean flag, if true activates check for overlaps
101 * with existing volumes (false by default).
102 */
103 G4PVPlacement(const G4Transform3D& Transform3D,
104 G4LogicalVolume* pCurrentLogical,
105 const G4String& pName,
106 G4LogicalVolume* pMotherLogical,
107 G4bool pMany,
108 G4int pCopyNo,
109 G4bool pSurfChk = false);
110
111 /**
112 * A simple variation of the first constructor, only specifying the
113 * mother volume as a pointer to its physical volume instead of its
114 * logical volume. The effect is exactly the same.
115 */
117 const G4ThreeVector& tlate,
118 const G4String& pName,
119 G4LogicalVolume* pLogical,
120 G4VPhysicalVolume* pMother,
121 G4bool pMany,
122 G4int pCopyNo,
123 G4bool pSurfChk = false);
124
125 /**
126 * Utilises both variations above (from first and third constructors).
127 * The effect is the same as for the second constructor.
128 */
129 G4PVPlacement(const G4Transform3D& Transform3D,
130 const G4String& pName,
131 G4LogicalVolume* pLogical,
132 G4VPhysicalVolume* pMother,
133 G4bool pMany,
134 G4int pCopyNo,
135 G4bool pSurfChk = false);
136
137 /**
138 * Fake default constructor for usage restricted to direct object
139 * persistency for clients requiring preallocation of memory for
140 * persistifiable objects.
141 */
142 G4PVPlacement(__void__&);
143
144 /**
145 * Default Destructor.
146 */
147 ~G4PVPlacement() override;
148
149 /**
150 * Copy constructor and assignment operator not allowed.
151 */
152 G4PVPlacement(const G4PVPlacement&) = delete;
154
155 /**
156 * Returns/sets the copy number associated to the volume.
157 */
158 inline G4int GetCopyNo() const override { return fcopyNo; }
159 void SetCopyNo(G4int CopyNo) override;
160
161 /**
162 * Verifies if the placed volume is overlapping with existing daughters
163 * or with the mother volume. Provides default resolution for the number
164 * of points to be generated and verified.
165 * A tolerance for the precision of the overlap check can be specified,
166 * by default it is set to maximum precision.
167 * Reports a maximum of overlaps errors according to parameter in input.
168 * @param[in] res The number of points to generate on volume's surface.
169 * @param[in] tol The precision tolerance for the overlap check, below
170 * which to ignore overlaps (default is maximim precision).
171 * @param[in] verbose Verbosity mode (default is true).
172 * @param[in] maxErr Maximum of overlaps errors to report (default is 1).
173 * @returns True if an overlap occurs.
174 */
175 G4bool CheckOverlaps(G4int res = 1000, G4double tol = 0.,
176 G4bool verbose = true, G4int maxErr = 1) override;
177
178 /**
179 * Stub methods, unused for placed volumes.
180 */
181 G4bool IsMany() const override;
182 G4bool IsReplicated() const override;
183 G4bool IsParameterised() const override;
186 G4int& nReplicas,
187 G4double& width,
189 G4bool& consuming) const override;
190
191 /**
192 * Used only for specialised repeated volumes. Always false with Id 0.
193 */
194 G4bool IsRegularStructure() const override;
195 G4int GetRegularStructureId() const override;
196
197 /**
198 * Returns the volume type characterisation.
199 */
200 EVolume VolumeType() const override;
201
202 private:
203
204 /**
205 * Auxiliary function for 2nd constructor (one with G4Transform3D).
206 * Creates a new RotMatrix on the heap (using "new") and copies
207 * its argument into it.
208 */
209 static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix& RotMat);
210
211 private:
212
213 /** Flag for overlapping structure - not used. */
214 G4bool fmany = false;
215
216 /** Flag for allocation of the rotation matrix. */
217 G4bool fallocatedRotM = false;
218
219 /** Optional copy number, for identification. */
220 G4int fcopyNo = 0;
221};
222
223#endif
G4ThreadLocal T * G4GeomSplitter< T >::offset
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Transform3D G4Transform3D
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....
G4PVPlacement(const G4PVPlacement &)=delete
G4VPVParameterisation * GetParameterisation() const override
~G4PVPlacement() override
G4bool IsMany() const override
void SetCopyNo(G4int CopyNo) override
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1) override
G4PVPlacement(G4RotationMatrix *pRot, const G4ThreeVector &tlate, G4LogicalVolume *pCurrentLogical, const G4String &pName, G4LogicalVolume *pMotherLogical, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false)
EVolume VolumeType() const override
G4int GetRegularStructureId() const override
G4bool IsReplicated() const override
G4int GetCopyNo() const override
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const override
G4PVPlacement & operator=(const G4PVPlacement &)=delete
G4bool IsParameterised() const override
G4bool IsRegularStructure() const override
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
EAxis
Definition geomdefs.hh:54
EVolume
Definition geomdefs.hh:83
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668