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