00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // class G4VPhysicalVolume 00031 // 00032 // Class description: 00033 // 00034 // This is an Abstract Base class for the representation of positioned volume. 00035 // The volume is placed within a mother volume, relative to its coordinate 00036 // system. Either a single positioned volume or many positioned volume can 00037 // be represented by a particular G4VPhysicalVolume. 00038 00039 // History: 00040 // 09.11.99 J.Apostolakis Added GetObjectRotationValue() method & redid comments. 00041 // 28.08.96 P.Kent Replaced transform by rotmat + vector 00042 // 25.07.96 P.Kent Modified interface for new `Replica' capable geometry 00043 // 24.07.95 P.Kent First non-stub version 00044 // -------------------------------------------------------------------- 00045 #ifndef G4VPHYSICALVOLUME_HH 00046 #define G4VPHYSICALVOLUME_HH 00047 00048 #include "G4Types.hh" 00049 #include "G4String.hh" 00050 00051 #include "geomdefs.hh" 00052 00053 #include "G4RotationMatrix.hh" 00054 #include "G4ThreeVector.hh" 00055 00056 class G4LogicalVolume; 00057 class G4VPVParameterisation; 00058 00059 class G4VPhysicalVolume 00060 { 00061 public: // with description 00062 00063 G4VPhysicalVolume(G4RotationMatrix *pRot, 00064 const G4ThreeVector &tlate, 00065 const G4String &pName, 00066 G4LogicalVolume *pLogical, 00067 G4VPhysicalVolume *pMother); 00068 // Initialise volume, positioned in a frame which is rotated by *pRot, 00069 // relative to the coordinate system of the mother volume pMother. 00070 // The center of the object is then placed at tlate in the new 00071 // coordinates. If pRot=0 the volume is unrotated with respect to its 00072 // mother. The physical volume is added to the mother's logical volume. 00073 // 00074 // Must be called by all subclasses. pMother must point to a valid parent 00075 // volume, except in the case of the world/top volume, when it =0. 00076 // 00077 // The constructor also registers volume with physical volume Store. 00078 // Note that the Store may be removed or dynamically built in future 00079 // because of memory constraints. 00080 00081 virtual ~G4VPhysicalVolume(); 00082 // Destructor, will be subclassed. Removes volume from volume Store. 00083 00084 inline G4bool operator == (const G4VPhysicalVolume& p) const; 00085 // Equality defined by equal addresses only. 00086 00087 // Access functions 00088 00089 // The following are accessor functions that make a distinction 00090 // between whether the rotation/translation is being made for the 00091 // frame or the object/volume that is being placed. 00092 // (They are the inverse of each other). 00093 G4RotationMatrix* GetObjectRotation() const; // Obsolete 00094 inline G4RotationMatrix GetObjectRotationValue() const; // Replacement 00095 inline G4ThreeVector GetObjectTranslation() const; 00096 // Return the rotation/translation of the Object relative to the mother. 00097 inline const G4RotationMatrix* GetFrameRotation() const; 00098 inline G4ThreeVector GetFrameTranslation() const; 00099 // Return the rotation/translation of the Frame used to position 00100 // this volume in its mother volume (opposite of object rot/trans). 00101 00102 // Older access functions, that do not distinguish between frame/object! 00103 00104 inline const G4ThreeVector& GetTranslation() const; 00105 inline const G4RotationMatrix* GetRotation() const; 00106 // Old access functions, that do not distinguish between frame/object! 00107 // They return the translation/rotation of the volume. 00108 00109 // Set functions 00110 00111 inline void SetTranslation(const G4ThreeVector &v); 00112 inline G4RotationMatrix* GetRotation(); 00113 inline void SetRotation(G4RotationMatrix*); 00114 // NOT INTENDED FOR GENERAL USE. 00115 // Non constant versions of above. Used to change transformation 00116 // for replication/parameterisation mechanism. 00117 00118 inline G4LogicalVolume* GetLogicalVolume() const; 00119 // Return the associated logical volume. 00120 inline void SetLogicalVolume(G4LogicalVolume *pLogical); 00121 // Set the logical volume. Must not be called when geometry closed. 00122 00123 inline G4LogicalVolume* GetMotherLogical() const; 00124 // Return the current mother logical volume pointer. 00125 inline void SetMotherLogical(G4LogicalVolume *pMother); 00126 // Set the mother logical volume. Must not be called when geometry closed. 00127 00128 inline const G4String& GetName() const; 00129 // Return the volume's name. 00130 inline void SetName(const G4String& pName); 00131 // Set the volume's name. 00132 00133 virtual G4int GetMultiplicity() const; 00134 // Returns number of object entities (1 for normal placements, 00135 // n for replicas or parameterised). 00136 00137 // Functions required of subclasses 00138 00139 virtual G4bool IsMany() const = 0; 00140 // Return true if the volume is MANY (not implemented yet). 00141 virtual G4int GetCopyNo() const = 0; 00142 // Return the volumes copy number. 00143 virtual void SetCopyNo(G4int CopyNo) = 0; 00144 // Set the volumes copy number. 00145 virtual G4bool IsReplicated() const = 0; 00146 // Return true if replicated (single object instance represents 00147 // many real volumes), else false. 00148 virtual G4bool IsParameterised() const = 0; 00149 // Return true if parameterised (single object instance represents 00150 // many real parameterised volumes), else false. 00151 virtual G4VPVParameterisation* GetParameterisation() const = 0; 00152 // Return replicas parameterisation object (able to compute dimensions 00153 // and transformations of replicas), or NULL if not applicable. 00154 virtual void GetReplicationData(EAxis& axis, 00155 G4int& nReplicas, 00156 G4double& width, 00157 G4double& offset, 00158 G4bool& consuming) const = 0; 00159 // Return replication information. No-op for no replicated volumes. 00160 virtual G4bool IsRegularStructure() const = 0; 00161 // Returns true if the underlying volume structure is regular. 00162 virtual G4int GetRegularStructureId() const = 0; 00163 // Returns non-zero code in case the underlying volume structure 00164 // is regular, voxel-like. Value is id for structure type. 00165 // If non-zero the volume is a candidate for specialised 00166 // navigation such as 'nearest neighbour' directly on volumes. 00167 virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., 00168 G4bool verbose=true); 00169 // Verifies if the placed volume is overlapping with existing 00170 // daughters or with the mother volume. Provides default resolution 00171 // for the number of points to be generated and verified. 00172 // Concrete implementation is done and required only for placed and 00173 // parameterised volumes. Returns true if the volume is overlapping. 00174 00175 public: // without description 00176 00177 G4VPhysicalVolume(__void__&); 00178 // Fake default constructor for usage restricted to direct object 00179 // persistency for clients requiring preallocation of memory for 00180 // persistifiable objects. 00181 00182 private: 00183 00184 G4VPhysicalVolume(const G4VPhysicalVolume&); 00185 G4VPhysicalVolume& operator=(const G4VPhysicalVolume&); 00186 // Private copy constructor and assignment operator. 00187 00188 protected: 00189 00190 G4RotationMatrix *frot; 00191 G4ThreeVector ftrans; 00192 00193 private: 00194 00195 G4LogicalVolume *flogical; // The logical volume representing the 00196 // physical and tracking attributes of 00197 // the volume 00198 G4String fname; // The name of the volume 00199 G4LogicalVolume *flmother; // The current mother logical volume 00200 }; 00201 00202 #include "G4VPhysicalVolume.icc" 00203 00204 #endif