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 | // |
---|
27 | // $Id: G4PVPlacement.hh,v 1.8 2007/04/11 07:56:38 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // class G4PVPlacement |
---|
32 | // |
---|
33 | // Class description: |
---|
34 | // |
---|
35 | // Class representing a single volume positioned within and relative |
---|
36 | // to a mother volume. |
---|
37 | |
---|
38 | // History: |
---|
39 | // 24.07.95 P.Kent First non-stub version |
---|
40 | // 25.07.96 P.Kent Modified interface for new `Replica' capable geometry |
---|
41 | // 28.08.96 P.Kent Tidied + transform replaced by rotmat+vector |
---|
42 | // 28.02.97 J.Apostolakis Added 2nd constructor with G4Transform3D of solid. |
---|
43 | // 11.07.97 J.Apostolakis Added 3rd constructor with pMotherLogical |
---|
44 | // 11.05.98 J.Apostolakis Added 4th constructor with G4Transform3D & pMotherLV |
---|
45 | // ---------------------------------------------------------------------- |
---|
46 | #ifndef G4PVPLACEMENT_HH |
---|
47 | #define G4PVPLACEMENT_HH |
---|
48 | |
---|
49 | #include "G4VPhysicalVolume.hh" |
---|
50 | #include "G4Transform3D.hh" |
---|
51 | |
---|
52 | class G4PVPlacement : public G4VPhysicalVolume |
---|
53 | { |
---|
54 | public: // with description |
---|
55 | |
---|
56 | G4PVPlacement(G4RotationMatrix *pRot, |
---|
57 | const G4ThreeVector &tlate, |
---|
58 | G4LogicalVolume *pCurrentLogical, |
---|
59 | const G4String& pName, |
---|
60 | G4LogicalVolume *pMotherLogical, |
---|
61 | G4bool pMany, |
---|
62 | G4int pCopyNo, |
---|
63 | G4bool pSurfChk=false); |
---|
64 | // Initialise a single volume, positioned in a frame which is rotated by |
---|
65 | // *pRot and traslated by tlate, relative to the coordinate system of the |
---|
66 | // mother volume pMotherLogical. |
---|
67 | // If pRot=0 the volume is unrotated with respect to its mother. |
---|
68 | // The physical volume is added to the mother's logical volume. |
---|
69 | // Arguments particular to G4PVPlacement: |
---|
70 | // pMany Currently NOT used. For future use to identify if the volume |
---|
71 | // is meant to be considered an overlapping structure, or not. |
---|
72 | // pCopyNo should be set to 0 for the first volume of a given type. |
---|
73 | // pSurfChk if true activates check for overlaps with existing volumes. |
---|
74 | // This is a very natural way of defining a physical volume, and is |
---|
75 | // especially useful when creating subdetectors: the mother volumes are |
---|
76 | // not placed until a later stage of the assembly program. |
---|
77 | |
---|
78 | G4PVPlacement(const G4Transform3D &Transform3D, |
---|
79 | G4LogicalVolume *pCurrentLogical, |
---|
80 | const G4String& pName, |
---|
81 | G4LogicalVolume *pMotherLogical, |
---|
82 | G4bool pMany, |
---|
83 | G4int pCopyNo, |
---|
84 | G4bool pSurfChk=false); |
---|
85 | // Additional constructor, which expects a G4Transform3D that represents |
---|
86 | // the direct rotation and translation of the solid (NOT of the frame). |
---|
87 | // The G4Transform3D argument should be constructed by: |
---|
88 | // i) First rotating it to align the solid to the system of |
---|
89 | // reference of its mother volume *pMotherLogical, and |
---|
90 | // ii) Then placing the solid at the location Transform3D.getTranslation(), |
---|
91 | // with respect to the origin of the system of coordinates of the |
---|
92 | // mother volume. |
---|
93 | // [ This is useful for the people who prefer to think in terms |
---|
94 | // of moving objects in a given reference frame. ] |
---|
95 | // All other arguments are the same as for the previous constructor. |
---|
96 | |
---|
97 | public: // without description |
---|
98 | |
---|
99 | G4PVPlacement(G4RotationMatrix *pRot, |
---|
100 | const G4ThreeVector &tlate, |
---|
101 | const G4String &pName, |
---|
102 | G4LogicalVolume *pLogical, |
---|
103 | G4VPhysicalVolume *pMother, |
---|
104 | G4bool pMany, |
---|
105 | G4int pCopyNo, |
---|
106 | G4bool pSurfChk=false); |
---|
107 | // A simple variation of the 1st constructor, only specifying the |
---|
108 | // mother volume as a pointer to its physical volume instead of its |
---|
109 | // logical volume. The effect is exactly the same. |
---|
110 | |
---|
111 | G4PVPlacement(const G4Transform3D &Transform3D, |
---|
112 | const G4String &pName, |
---|
113 | G4LogicalVolume *pLogical, |
---|
114 | G4VPhysicalVolume *pMother, |
---|
115 | G4bool pMany, |
---|
116 | G4int pCopyNo, |
---|
117 | G4bool pSurfChk=false); |
---|
118 | // Utilises both variations above (from 2nd and 3rd constructor). |
---|
119 | // The effect is the same as for the 2nd constructor. |
---|
120 | |
---|
121 | public: // with description |
---|
122 | |
---|
123 | virtual ~G4PVPlacement(); |
---|
124 | // Default destructor. |
---|
125 | |
---|
126 | G4int GetCopyNo() const; |
---|
127 | void SetCopyNo(G4int CopyNo); |
---|
128 | // Gets and sets the copy number of the volume. |
---|
129 | |
---|
130 | G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true); |
---|
131 | // Verifies if the placed volume is overlapping with existing |
---|
132 | // daughters or with the mother volume. Provides default resolution |
---|
133 | // for the number of points to be generated and verified. |
---|
134 | // A tolerance for the precision of the overlap check can be specified, |
---|
135 | // by default it is set to maximum precision. |
---|
136 | // Returns true if the volume is overlapping. |
---|
137 | |
---|
138 | public: // without description |
---|
139 | |
---|
140 | G4PVPlacement(__void__&); |
---|
141 | // Fake default constructor for usage restricted to direct object |
---|
142 | // persistency for clients requiring preallocation of memory for |
---|
143 | // persistifiable objects. |
---|
144 | |
---|
145 | G4bool IsMany() const; |
---|
146 | G4bool IsReplicated() const; |
---|
147 | G4bool IsParameterised() const; |
---|
148 | G4VPVParameterisation* GetParameterisation() const; |
---|
149 | void GetReplicationData(EAxis& axis, |
---|
150 | G4int& nReplicas, |
---|
151 | G4double& width, |
---|
152 | G4double& offset, |
---|
153 | G4bool& consuming) const; |
---|
154 | G4bool IsRegularStructure() const; |
---|
155 | G4int GetRegularStructureId() 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 | G4PVPlacement(const G4PVPlacement&); |
---|
165 | G4PVPlacement& operator=(const G4PVPlacement&); |
---|
166 | // Private copy constructor and assignment operator. |
---|
167 | |
---|
168 | private: |
---|
169 | |
---|
170 | G4bool fmany; // flag for overlapping structure - not used |
---|
171 | G4bool fallocatedRotM; // flag for allocation of Rotation Matrix |
---|
172 | G4int fcopyNo; // for identification |
---|
173 | |
---|
174 | }; |
---|
175 | |
---|
176 | #endif |
---|
177 | |
---|