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