Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4PVPlacement 26 // G4PVPlacement 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // Class representing a single volume position 30 // Class representing a single volume positioned within and relative 31 // to a mother volume. 31 // to a mother volume. 32 32 33 // 24.07.95 P.Kent, First non-stub version. << 33 // 24.07.95 P.Kent, First non-stub version >> 34 // 25.07.96 P.Kent, Modified interface for new `Replica' capable geometry >> 35 // 28.08.96 P.Kent. Tidied + transform replaced by rotmat+vector 34 // ------------------------------------------- 36 // ---------------------------------------------------------------------- 35 #ifndef G4PVPLACEMENT_HH 37 #ifndef G4PVPLACEMENT_HH 36 #define G4PVPLACEMENT_HH 1 << 38 #define G4PVPLACEMENT_HH 37 39 38 #include "G4VPhysicalVolume.hh" 40 #include "G4VPhysicalVolume.hh" 39 #include "G4Transform3D.hh" 41 #include "G4Transform3D.hh" 40 42 41 class G4PVPlacement : public G4VPhysicalVolume 43 class G4PVPlacement : public G4VPhysicalVolume 42 { 44 { 43 public: << 45 public: // with description 44 46 45 G4PVPlacement(G4RotationMatrix* pRot, 47 G4PVPlacement(G4RotationMatrix* pRot, 46 const G4ThreeVector& tlate, 48 const G4ThreeVector& tlate, 47 G4LogicalVolume* pCurrentLog 49 G4LogicalVolume* pCurrentLogical, 48 const G4String& pName, 50 const G4String& pName, 49 G4LogicalVolume* pMotherLogi 51 G4LogicalVolume* pMotherLogical, 50 G4bool pMany, 52 G4bool pMany, 51 G4int pCopyNo, 53 G4int pCopyNo, 52 G4bool pSurfChk = false); 54 G4bool pSurfChk = false); 53 // Initialise a single volume, positione 55 // Initialise a single volume, positioned in a frame which is rotated by 54 // *pRot and traslated by tlate, relativ 56 // *pRot and traslated by tlate, relative to the coordinate system of the 55 // mother volume pMotherLogical. 57 // mother volume pMotherLogical. 56 // If pRot=nullptr the volume is unrotat 58 // If pRot=nullptr the volume is unrotated with respect to its mother. 57 // The physical volume is added to the m 59 // The physical volume is added to the mother's logical volume. 58 // Arguments particular to G4PVPlacement 60 // Arguments particular to G4PVPlacement: 59 // pMany Currently NOT used. For futur 61 // pMany Currently NOT used. For future use to identify if the volume 60 // is meant to be considered an 62 // is meant to be considered an overlapping structure, or not. 61 // pCopyNo should be set to 0 for the 63 // pCopyNo should be set to 0 for the first volume of a given type. 62 // pSurfChk if true activates check fo 64 // pSurfChk if true activates check for overlaps with existing volumes. 63 // This is a very natural way of definin 65 // This is a very natural way of defining a physical volume, and is 64 // especially useful when creating subde 66 // especially useful when creating subdetectors: the mother volumes are 65 // not placed until a later stage of the 67 // not placed until a later stage of the assembly program. 66 68 67 G4PVPlacement(const G4Transform3D& Transfo 69 G4PVPlacement(const G4Transform3D& Transform3D, 68 G4LogicalVolume* pCurr 70 G4LogicalVolume* pCurrentLogical, 69 const G4String& pName, 71 const G4String& pName, 70 G4LogicalVolume* pMoth 72 G4LogicalVolume* pMotherLogical, 71 G4bool pMany, 73 G4bool pMany, 72 G4int pCopyNo, 74 G4int pCopyNo, 73 G4bool pSurfChk = fals 75 G4bool pSurfChk = false); 74 // Additional constructor, which expects 76 // Additional constructor, which expects a G4Transform3D that represents 75 // the direct rotation and translation o 77 // the direct rotation and translation of the solid (NOT of the frame). 76 // The G4Transform3D argument should be 78 // The G4Transform3D argument should be constructed by: 77 // i) First rotating it to align the so 79 // i) First rotating it to align the solid to the system of 78 // reference of its mother volume *p 80 // reference of its mother volume *pMotherLogical, and 79 // ii) Then placing the solid at the loc 81 // ii) Then placing the solid at the location Transform3D.getTranslation(), 80 // with respect to the origin of the 82 // with respect to the origin of the system of coordinates of the 81 // mother volume. 83 // mother volume. 82 // [ This is useful for the people who p 84 // [ This is useful for the people who prefer to think in terms 83 // of moving objects in a given refere 85 // of moving objects in a given reference frame. ] 84 // All other arguments are the same as f 86 // All other arguments are the same as for the previous constructor. 85 87 >> 88 public: // without description >> 89 86 G4PVPlacement(G4RotationMatrix* pRot, 90 G4PVPlacement(G4RotationMatrix* pRot, 87 const G4ThreeVector& tlate, 91 const G4ThreeVector& tlate, 88 const G4String& pName, 92 const G4String& pName, 89 G4LogicalVolume* pLogical, 93 G4LogicalVolume* pLogical, 90 G4VPhysicalVolume* pMother, 94 G4VPhysicalVolume* pMother, 91 G4bool pMany, 95 G4bool pMany, 92 G4int pCopyNo, 96 G4int pCopyNo, 93 G4bool pSurfChk = false); 97 G4bool pSurfChk = false); 94 // A simple variation of the 1st constru 98 // A simple variation of the 1st constructor, only specifying the 95 // mother volume as a pointer to its phy 99 // mother volume as a pointer to its physical volume instead of its 96 // logical volume. The effect is exactly 100 // logical volume. The effect is exactly the same. 97 101 98 G4PVPlacement(const G4Transform3D& Transfo 102 G4PVPlacement(const G4Transform3D& Transform3D, 99 const G4String& pName, 103 const G4String& pName, 100 G4LogicalVolume* pLogi 104 G4LogicalVolume* pLogical, 101 G4VPhysicalVolume* pMo 105 G4VPhysicalVolume* pMother, 102 G4bool pMany, 106 G4bool pMany, 103 G4int pCopyNo, 107 G4int pCopyNo, 104 G4bool pSurfChk = fals 108 G4bool pSurfChk = false); 105 // Utilises both variations above (from 109 // Utilises both variations above (from 2nd and 3rd constructor). 106 // The effect is the same as for the 2nd 110 // The effect is the same as for the 2nd constructor. 107 111 108 ~G4PVPlacement() override; << 112 public: // with description >> 113 >> 114 virtual ~G4PVPlacement(); 109 // Default destructor. 115 // Default destructor. 110 116 111 inline G4int GetCopyNo() const override { << 117 inline G4int GetCopyNo() const { return fcopyNo; } 112 118 113 void SetCopyNo(G4int CopyNo) override; << 119 void SetCopyNo(G4int CopyNo); 114 // Gets and sets the copy number of the 120 // Gets and sets the copy number of the volume. 115 121 116 G4bool CheckOverlaps(G4int res = 1000, G4d 122 G4bool CheckOverlaps(G4int res = 1000, G4double tol = 0., 117 G4bool verbose = true << 123 G4bool verbose = true, G4int maxErr = 1); 118 // Verifies if the placed volume is over 124 // Verifies if the placed volume is overlapping with existing 119 // daughters or with the mother volume. 125 // daughters or with the mother volume. Provides default resolution 120 // for the number of points to be genera 126 // for the number of points to be generated and verified. 121 // A tolerance for the precision of the 127 // A tolerance for the precision of the overlap check can be specified, 122 // by default it is set to maximum preci 128 // by default it is set to maximum precision. 123 // Reports a maximum of overlaps errors 129 // Reports a maximum of overlaps errors according to parameter in input. 124 // Returns true if the volume is overlap 130 // Returns true if the volume is overlapping. 125 131 >> 132 public: // without description >> 133 126 G4PVPlacement(__void__&); 134 G4PVPlacement(__void__&); 127 // Fake default constructor for usage re 135 // Fake default constructor for usage restricted to direct object 128 // persistency for clients requiring pre 136 // persistency for clients requiring preallocation of memory for 129 // persistifiable objects. 137 // persistifiable objects. 130 138 131 G4PVPlacement(const G4PVPlacement&) = dele 139 G4PVPlacement(const G4PVPlacement&) = delete; 132 G4PVPlacement& operator=(const G4PVPlaceme 140 G4PVPlacement& operator=(const G4PVPlacement&) = delete; 133 // Copy constructor and assignment opera 141 // Copy constructor and assignment operator not allowed. 134 142 135 G4bool IsMany() const override; << 143 G4bool IsMany() const; 136 G4bool IsReplicated() const override; << 144 G4bool IsReplicated() const; 137 G4bool IsParameterised() const override; << 145 G4bool IsParameterised() const; 138 G4VPVParameterisation* GetParameterisation << 146 G4VPVParameterisation* GetParameterisation() const; 139 void GetReplicationData(EAxis& axis, 147 void GetReplicationData(EAxis& axis, 140 G4int& nReplicas, 148 G4int& nReplicas, 141 G4double& width, 149 G4double& width, 142 G4double& offset, 150 G4double& offset, 143 G4bool& consuming) << 151 G4bool& consuming) const; 144 G4bool IsRegularStructure() const override << 152 G4bool IsRegularStructure() const; 145 G4int GetRegularStructureId() const overri << 153 G4int GetRegularStructureId() const; 146 154 147 EVolume VolumeType() const override; << 155 EVolume VolumeType() const; 148 156 149 private: 157 private: 150 158 151 static G4RotationMatrix* NewPtrRotMatrix(c 159 static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix& RotMat); 152 // Auxiliary function for 2nd constructo 160 // Auxiliary function for 2nd constructor (one with G4Transform3D). 153 // Creates a new RotMatrix on the heap ( 161 // Creates a new RotMatrix on the heap (using "new") and copies 154 // its argument into it. 162 // its argument into it. 155 163 156 private: 164 private: 157 165 158 G4bool fmany = false; // flag for overla 166 G4bool fmany = false; // flag for overlapping structure - not used 159 G4bool fallocatedRotM = false; // flag fo 167 G4bool fallocatedRotM = false; // flag for allocation of Rotation Matrix 160 G4int fcopyNo = 0; // for identificat 168 G4int fcopyNo = 0; // for identification >> 169 161 }; 170 }; 162 171 163 #endif 172 #endif >> 173 164 174