Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:00

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 // 
0026 // G4PVPlacement
0027 //
0028 // Class description:
0029 //
0030 // Class representing a single volume positioned within and relative
0031 // to a mother volume.
0032 
0033 // 24.07.95 P.Kent, First non-stub version.
0034 // ----------------------------------------------------------------------
0035 #ifndef G4PVPLACEMENT_HH
0036 #define G4PVPLACEMENT_HH 1
0037 
0038 #include "G4VPhysicalVolume.hh"
0039 #include "G4Transform3D.hh"
0040 
0041 class G4PVPlacement : public G4VPhysicalVolume
0042 {
0043   public:
0044 
0045     G4PVPlacement(G4RotationMatrix* pRot,
0046             const G4ThreeVector& tlate,
0047                   G4LogicalVolume* pCurrentLogical,
0048             const G4String& pName,
0049                   G4LogicalVolume* pMotherLogical,
0050                   G4bool pMany,
0051                   G4int  pCopyNo,
0052                   G4bool pSurfChk = false);
0053       // Initialise a single volume, positioned in a frame which is rotated by
0054       // *pRot and traslated by tlate, relative to the coordinate system of the
0055       // mother volume pMotherLogical.
0056       // If pRot=nullptr the volume is unrotated with respect to its mother.
0057       // The physical volume is added to the mother's logical volume.
0058       // Arguments particular to G4PVPlacement:
0059       //   pMany Currently NOT used. For future use to identify if the volume
0060       //         is meant to be considered an overlapping structure, or not.
0061       //   pCopyNo should be set to 0 for the first volume of a given type.
0062       //   pSurfChk if true activates check for overlaps with existing volumes.
0063       // This is a very natural way of defining a physical volume, and is
0064       // especially useful when creating subdetectors: the mother volumes are
0065       // not placed until a later stage of the assembly program.
0066 
0067     G4PVPlacement(const G4Transform3D& Transform3D,
0068                         G4LogicalVolume* pCurrentLogical,
0069                   const G4String& pName,
0070                         G4LogicalVolume* pMotherLogical,
0071                         G4bool pMany,
0072                         G4int pCopyNo,
0073                         G4bool pSurfChk = false);
0074       // Additional constructor, which expects a G4Transform3D that represents 
0075       // the direct rotation and translation of the solid (NOT of the frame).  
0076       // The G4Transform3D argument should be constructed by:
0077       //  i) First rotating it to align the solid to the system of 
0078       //     reference of its mother volume *pMotherLogical, and 
0079       // ii) Then placing the solid at the location Transform3D.getTranslation(),
0080       //     with respect to the origin of the system of coordinates of the
0081       //     mother volume.  
0082       // [ This is useful for the people who prefer to think in terms 
0083       //   of moving objects in a given reference frame. ]
0084       // All other arguments are the same as for the previous constructor.
0085 
0086     G4PVPlacement(G4RotationMatrix* pRot,
0087             const G4ThreeVector& tlate,
0088             const G4String& pName,
0089                   G4LogicalVolume* pLogical,
0090                   G4VPhysicalVolume* pMother,
0091                   G4bool pMany,
0092                   G4int pCopyNo,
0093                   G4bool pSurfChk = false);
0094       // A simple variation of the 1st constructor, only specifying the
0095       // mother volume as a pointer to its physical volume instead of its
0096       // logical volume. The effect is exactly the same.
0097 
0098     G4PVPlacement(const G4Transform3D& Transform3D,
0099                   const G4String& pName,
0100                         G4LogicalVolume* pLogical,
0101                         G4VPhysicalVolume* pMother,
0102                         G4bool pMany,
0103                         G4int pCopyNo,
0104                         G4bool pSurfChk = false);
0105       // Utilises both variations above (from 2nd and 3rd constructor).
0106       // The effect is the same as for the 2nd constructor.
0107 
0108     ~G4PVPlacement() override;
0109       // Default destructor.
0110 
0111     inline G4int GetCopyNo() const override  { return fcopyNo; }
0112 
0113     void SetCopyNo(G4int CopyNo) override;
0114       // Gets and sets the copy number of the volume.
0115 
0116     G4bool CheckOverlaps(G4int res = 1000, G4double tol = 0.,
0117                          G4bool verbose = true, G4int maxErr = 1) override;
0118       // Verifies if the placed volume is overlapping with existing
0119       // daughters or with the mother volume. Provides default resolution
0120       // for the number of points to be generated and verified.
0121       // A tolerance for the precision of the overlap check can be specified,
0122       // by default it is set to maximum precision.
0123       // Reports a maximum of overlaps errors according to parameter in input.
0124       // Returns true if the volume is overlapping.
0125 
0126     G4PVPlacement(__void__&);
0127       // Fake default constructor for usage restricted to direct object
0128       // persistency for clients requiring preallocation of memory for
0129       // persistifiable objects.
0130 
0131     G4PVPlacement(const G4PVPlacement&) = delete;
0132     G4PVPlacement& operator=(const G4PVPlacement&) = delete;
0133       // Copy constructor and assignment operator not allowed.
0134 
0135     G4bool IsMany() const override;
0136     G4bool IsReplicated() const override;
0137     G4bool IsParameterised() const override;
0138     G4VPVParameterisation* GetParameterisation() const override;
0139     void GetReplicationData(EAxis& axis,
0140                             G4int& nReplicas,
0141                             G4double& width,
0142                             G4double& offset,
0143                             G4bool& consuming) const override;
0144     G4bool IsRegularStructure() const override; 
0145     G4int GetRegularStructureId() const override; 
0146 
0147     EVolume VolumeType() const override;
0148    
0149   private:
0150 
0151     static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix& RotMat);
0152       // Auxiliary function for 2nd constructor (one with G4Transform3D).
0153       // Creates a new RotMatrix on the heap (using "new") and copies 
0154       // its argument into it.
0155 
0156   private:
0157 
0158     G4bool fmany = false;   // flag for overlapping structure - not used
0159     G4bool fallocatedRotM = false;  // flag for allocation of Rotation Matrix
0160     G4int fcopyNo = 0;      // for identification
0161 };
0162 
0163 #endif