ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PVPlacement.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PVPlacement.hh
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 // 24.07.95 P.Kent, First non-stub version
34 // 25.07.96 P.Kent, Modified interface for new `Replica' capable geometry
35 // 28.08.96 P.Kent. Tidied + transform replaced by rotmat+vector
36 // ----------------------------------------------------------------------
37 #ifndef G4PVPLACEMENT_HH
38 #define G4PVPLACEMENT_HH
39 
40 #include "G4VPhysicalVolume.hh"
41 #include "G4Transform3D.hh"
42 
44 {
45  public: // with description
46 
48  const G4ThreeVector& tlate,
49  G4LogicalVolume* pCurrentLogical,
50  const G4String& pName,
51  G4LogicalVolume* pMotherLogical,
52  G4bool pMany,
53  G4int pCopyNo,
54  G4bool pSurfChk = false);
55  // Initialise a single volume, positioned in a frame which is rotated by
56  // *pRot and traslated by tlate, relative to the coordinate system of the
57  // mother volume pMotherLogical.
58  // If pRot=nullptr the volume is unrotated with respect to its mother.
59  // The physical volume is added to the mother's logical volume.
60  // Arguments particular to G4PVPlacement:
61  // pMany Currently NOT used. For future use to identify if the volume
62  // is meant to be considered an overlapping structure, or not.
63  // pCopyNo should be set to 0 for the first volume of a given type.
64  // pSurfChk if true activates check for overlaps with existing volumes.
65  // This is a very natural way of defining a physical volume, and is
66  // especially useful when creating subdetectors: the mother volumes are
67  // not placed until a later stage of the assembly program.
68 
70  G4LogicalVolume* pCurrentLogical,
71  const G4String& pName,
72  G4LogicalVolume* pMotherLogical,
73  G4bool pMany,
74  G4int pCopyNo,
75  G4bool pSurfChk = false);
76  // Additional constructor, which expects a G4Transform3D that represents
77  // the direct rotation and translation of the solid (NOT of the frame).
78  // The G4Transform3D argument should be constructed by:
79  // i) First rotating it to align the solid to the system of
80  // reference of its mother volume *pMotherLogical, and
81  // ii) Then placing the solid at the location Transform3D.getTranslation(),
82  // with respect to the origin of the system of coordinates of the
83  // mother volume.
84  // [ This is useful for the people who prefer to think in terms
85  // of moving objects in a given reference frame. ]
86  // All other arguments are the same as for the previous constructor.
87 
88  public: // without description
89 
91  const G4ThreeVector& tlate,
92  const G4String& pName,
93  G4LogicalVolume* pLogical,
94  G4VPhysicalVolume* pMother,
95  G4bool pMany,
96  G4int pCopyNo,
97  G4bool pSurfChk = false);
98  // A simple variation of the 1st constructor, only specifying the
99  // mother volume as a pointer to its physical volume instead of its
100  // logical volume. The effect is exactly the same.
101 
102  G4PVPlacement(const G4Transform3D& Transform3D,
103  const G4String& pName,
104  G4LogicalVolume* pLogical,
105  G4VPhysicalVolume* pMother,
106  G4bool pMany,
107  G4int pCopyNo,
108  G4bool pSurfChk = false);
109  // Utilises both variations above (from 2nd and 3rd constructor).
110  // The effect is the same as for the 2nd constructor.
111 
112  public: // with description
113 
114  virtual ~G4PVPlacement();
115  // Default destructor.
116 
117  inline G4int GetCopyNo() const { return fcopyNo; }
118 
119  void SetCopyNo(G4int CopyNo);
120  // Gets and sets the copy number of the volume.
121 
122  G4bool CheckOverlaps(G4int res = 1000, G4double tol = 0.,
123  G4bool verbose = true, G4int maxErr = 1);
124  // Verifies if the placed volume is overlapping with existing
125  // daughters or with the mother volume. Provides default resolution
126  // for the number of points to be generated and verified.
127  // A tolerance for the precision of the overlap check can be specified,
128  // by default it is set to maximum precision.
129  // Reports a maximum of overlaps errors according to parameter in input.
130  // Returns true if the volume is overlapping.
131 
132  public: // without description
133 
134  G4PVPlacement(__void__&);
135  // Fake default constructor for usage restricted to direct object
136  // persistency for clients requiring preallocation of memory for
137  // persistifiable objects.
138 
139  G4PVPlacement(const G4PVPlacement&) = delete;
140  G4PVPlacement& operator=(const G4PVPlacement&) = delete;
141  // Copy constructor and assignment operator not allowed.
142 
143  G4bool IsMany() const;
144  G4bool IsReplicated() const;
145  G4bool IsParameterised() const;
147  void GetReplicationData(EAxis& axis,
148  G4int& nReplicas,
149  G4double& width,
150  G4double& offset,
151  G4bool& consuming) const;
152  G4bool IsRegularStructure() const;
153  G4int GetRegularStructureId() const;
154 
155  EVolume VolumeType() const;
156 
157  private:
158 
159  static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix& RotMat);
160  // Auxiliary function for 2nd constructor (one with G4Transform3D).
161  // Creates a new RotMatrix on the heap (using "new") and copies
162  // its argument into it.
163 
164  private:
165 
166  G4bool fmany = false; // flag for overlapping structure - not used
167  G4bool fallocatedRotM = false; // flag for allocation of Rotation Matrix
168  G4int fcopyNo = 0; // for identification
169 
170 };
171 
172 #endif
173