Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VPhysicalVolume.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 G4VPhysicalVolume
31 //
32 // Class description:
33 //
34 // This is an Abstract Base class for the representation of positioned volume.
35 // The volume is placed within a mother volume, relative to its coordinate
36 // system. Either a single positioned volume or many positioned volume can
37 // be represented by a particular G4VPhysicalVolume.
38 
39 // History:
40 // 09.11.99 J.Apostolakis Added GetObjectRotationValue() method & redid comments.
41 // 28.08.96 P.Kent Replaced transform by rotmat + vector
42 // 25.07.96 P.Kent Modified interface for new `Replica' capable geometry
43 // 24.07.95 P.Kent First non-stub version
44 // --------------------------------------------------------------------
45 #ifndef G4VPHYSICALVOLUME_HH
46 #define G4VPHYSICALVOLUME_HH
47 
48 #include "G4Types.hh"
49 #include "G4String.hh"
50 
51 #include "geomdefs.hh"
52 
53 #include "G4RotationMatrix.hh"
54 #include "G4ThreeVector.hh"
55 
56 class G4LogicalVolume;
58 
60 {
61  public: // with description
62 
64  const G4ThreeVector &tlate,
65  const G4String &pName,
66  G4LogicalVolume *pLogical,
67  G4VPhysicalVolume *pMother);
68  // Initialise volume, positioned in a frame which is rotated by *pRot,
69  // relative to the coordinate system of the mother volume pMother.
70  // The center of the object is then placed at tlate in the new
71  // coordinates. If pRot=0 the volume is unrotated with respect to its
72  // mother. The physical volume is added to the mother's logical volume.
73  //
74  // Must be called by all subclasses. pMother must point to a valid parent
75  // volume, except in the case of the world/top volume, when it =0.
76  //
77  // The constructor also registers volume with physical volume Store.
78  // Note that the Store may be removed or dynamically built in future
79  // because of memory constraints.
80 
81  virtual ~G4VPhysicalVolume();
82  // Destructor, will be subclassed. Removes volume from volume Store.
83 
84  inline G4bool operator == (const G4VPhysicalVolume& p) const;
85  // Equality defined by equal addresses only.
86 
87  // Access functions
88 
89  // The following are accessor functions that make a distinction
90  // between whether the rotation/translation is being made for the
91  // frame or the object/volume that is being placed.
92  // (They are the inverse of each other).
93  G4RotationMatrix* GetObjectRotation() const; // Obsolete
94  inline G4RotationMatrix GetObjectRotationValue() const; // Replacement
95  inline G4ThreeVector GetObjectTranslation() const;
96  // Return the rotation/translation of the Object relative to the mother.
97  inline const G4RotationMatrix* GetFrameRotation() const;
98  inline G4ThreeVector GetFrameTranslation() const;
99  // Return the rotation/translation of the Frame used to position
100  // this volume in its mother volume (opposite of object rot/trans).
101 
102  // Older access functions, that do not distinguish between frame/object!
103 
104  inline const G4ThreeVector& GetTranslation() const;
105  inline const G4RotationMatrix* GetRotation() const;
106  // Old access functions, that do not distinguish between frame/object!
107  // They return the translation/rotation of the volume.
108 
109  // Set functions
110 
111  inline void SetTranslation(const G4ThreeVector &v);
112  inline G4RotationMatrix* GetRotation();
113  inline void SetRotation(G4RotationMatrix*);
114  // NOT INTENDED FOR GENERAL USE.
115  // Non constant versions of above. Used to change transformation
116  // for replication/parameterisation mechanism.
117 
118  inline G4LogicalVolume* GetLogicalVolume() const;
119  // Return the associated logical volume.
120  inline void SetLogicalVolume(G4LogicalVolume *pLogical);
121  // Set the logical volume. Must not be called when geometry closed.
122 
123  inline G4LogicalVolume* GetMotherLogical() const;
124  // Return the current mother logical volume pointer.
125  inline void SetMotherLogical(G4LogicalVolume *pMother);
126  // Set the mother logical volume. Must not be called when geometry closed.
127 
128  inline const G4String& GetName() const;
129  // Return the volume's name.
130  inline void SetName(const G4String& pName);
131  // Set the volume's name.
132 
133  virtual G4int GetMultiplicity() const;
134  // Returns number of object entities (1 for normal placements,
135  // n for replicas or parameterised).
136 
137  // Functions required of subclasses
138 
139  virtual G4bool IsMany() const = 0;
140  // Return true if the volume is MANY (not implemented yet).
141  virtual G4int GetCopyNo() const = 0;
142  // Return the volumes copy number.
143  virtual void SetCopyNo(G4int CopyNo) = 0;
144  // Set the volumes copy number.
145  virtual G4bool IsReplicated() const = 0;
146  // Return true if replicated (single object instance represents
147  // many real volumes), else false.
148  virtual G4bool IsParameterised() const = 0;
149  // Return true if parameterised (single object instance represents
150  // many real parameterised volumes), else false.
151  virtual G4VPVParameterisation* GetParameterisation() const = 0;
152  // Return replicas parameterisation object (able to compute dimensions
153  // and transformations of replicas), or NULL if not applicable.
154  virtual void GetReplicationData(EAxis& axis,
155  G4int& nReplicas,
156  G4double& width,
157  G4double& offset,
158  G4bool& consuming) const = 0;
159  // Return replication information. No-op for no replicated volumes.
160  virtual G4bool IsRegularStructure() const = 0;
161  // Returns true if the underlying volume structure is regular.
162  virtual G4int GetRegularStructureId() const = 0;
163  // Returns non-zero code in case the underlying volume structure
164  // is regular, voxel-like. Value is id for structure type.
165  // If non-zero the volume is a candidate for specialised
166  // navigation such as 'nearest neighbour' directly on volumes.
167  virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0.,
168  G4bool verbose=true);
169  // Verifies if the placed volume is overlapping with existing
170  // daughters or with the mother volume. Provides default resolution
171  // for the number of points to be generated and verified.
172  // Concrete implementation is done and required only for placed and
173  // parameterised volumes. Returns true if the volume is overlapping.
174 
175  public: // without description
176 
177  G4VPhysicalVolume(__void__&);
178  // Fake default constructor for usage restricted to direct object
179  // persistency for clients requiring preallocation of memory for
180  // persistifiable objects.
181 
182  private:
183 
185  G4VPhysicalVolume& operator=(const G4VPhysicalVolume&);
186  // Private copy constructor and assignment operator.
187 
188  protected:
189 
192 
193  private:
194 
195  G4LogicalVolume *flogical; // The logical volume representing the
196  // physical and tracking attributes of
197  // the volume
198  G4String fname; // The name of the volume
199  G4LogicalVolume *flmother; // The current mother logical volume
200 };
201 
202 #include "G4VPhysicalVolume.icc"
203 
204 #endif