Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:13:16

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 // G4AssemblyTriplet
0027 //
0028 // Class description:
0029 //
0030 // A class to help place logical or assembly volumes inside a generic 
0031 // container (like STL vector) together with information about its rotation, 
0032 // placement and eventually reflection.
0033 // How to interpret the rotation and translation depends on the class which
0034 // uses a container of these triplets. The first class using G4AssemblyTriplet
0035 // is G4AssemblyVolume.
0036 // The pointer to the logical or assembly volume is copied so this class 
0037 // does not take its ownership and does not delete the object behind.
0038 
0039 // Author: Radovan Chytracek (CERN), November 2000
0040 // ----------------------------------------------------------------------
0041 #ifndef G4_ASSEMBLYTRIPLET_HH
0042 #define G4_ASSEMBLYTRIPLET_HH
0043 
0044 #include "G4ThreeVector.hh"
0045 #include "G4RotationMatrix.hh"
0046 
0047 class G4LogicalVolume;
0048 class G4AssemblyVolume;
0049 
0050 /**
0051  * @brief G4AssemblyTriplet is a helper class for placing logical or assembly
0052  * volumes inside a generic container together with information about its
0053  * rotation, placement and eventually reflection.
0054  * How to interpret the rotation and translation depends on the class which
0055  * uses a container of these triplets. The first class using G4AssemblyTriplet
0056  * is G4AssemblyVolume.
0057  * The pointer to the logical or assembly volume is copied so this class 
0058  * does not take its ownership and does not delete the object behind.
0059  */
0060 
0061 class G4AssemblyTriplet
0062 {
0063   public:
0064 
0065     /**
0066        Default constructor.
0067      */
0068     G4AssemblyTriplet();
0069 
0070     /**
0071      * An explicit constructor for a logical volume.
0072      *  @param[in] pVolume Pointer to the logical volume.
0073      *  @param[in] translation Translation vector.
0074      *  @param[in] pRotation Pointer to the rotation matrix.
0075      *  @param[in] isReflection Flag to specify if volume is reflected.
0076      */
0077     G4AssemblyTriplet( G4LogicalVolume* pVolume,
0078                        G4ThreeVector& translation,
0079                        G4RotationMatrix* pRotation,
0080                        G4bool isReflection = false );
0081     
0082     /**
0083      * An explicit constructor for an assembly volume.
0084      *  @param[in] pAssembly Pointer to the assembly volume.
0085      *  @param[in] translation Translation vector.
0086      *  @param[in] pRotation Pointer to the rotation matrix.
0087      *  @param[in] isReflection Flag to specify if volume is reflected.
0088      */
0089     G4AssemblyTriplet( G4AssemblyVolume* pAssembly,
0090                        G4ThreeVector& translation,
0091                        G4RotationMatrix* pRotation,
0092                        G4bool isReflection = false );
0093     
0094     /**
0095        Copy constructor.
0096      */
0097     G4AssemblyTriplet( const G4AssemblyTriplet& second );
0098 
0099     /**
0100        Destructor.
0101      */
0102     ~G4AssemblyTriplet();    
0103 
0104     /**
0105        Assignment operator.
0106      */
0107     G4AssemblyTriplet& operator=( const G4AssemblyTriplet& second );
0108 
0109     /**
0110        Retrieves the logical volume reference.
0111      */
0112     inline G4LogicalVolume* GetVolume() const;
0113 
0114     /**
0115        Updates the logical volume reference.
0116      */
0117     inline void SetVolume( G4LogicalVolume* pVolume );
0118 
0119     /**
0120        Retrieves the assembly volume reference.
0121      */
0122     inline G4AssemblyVolume* GetAssembly() const;
0123 
0124     /**
0125        Updates the assembly volume reference.
0126      */
0127     inline void SetAssembly( G4AssemblyVolume* pAssembly );
0128 
0129     /**
0130        Retrieves the logical volume translation.
0131      */
0132     inline G4ThreeVector GetTranslation() const;
0133 
0134     /**
0135        Updates the logical volume translation.
0136      */
0137     inline void SetTranslation( G4ThreeVector& pVolume );
0138 
0139     /**
0140        Retrieves the logical volume rotation.
0141      */
0142     inline G4RotationMatrix* GetRotation() const;
0143 
0144     /**
0145        Updates the logical volume rotation.
0146      */
0147     inline void SetRotation( G4RotationMatrix* pVolume );
0148 
0149     /**
0150        Returns true if the logical or assembly volume has reflection.
0151      */
0152     inline G4bool IsReflection() const;
0153 
0154   private:
0155 
0156     /** A logical volume. */
0157     G4LogicalVolume* fVolume = nullptr;
0158 
0159     /** A logical volume translation. */
0160     G4ThreeVector fTranslation;
0161 
0162     /** A logical volume rotation. */
0163     G4RotationMatrix* fRotation = nullptr;
0164 
0165     // Member data for handling assemblies of assemblies and reflections
0166 
0167     /** An assembly volume. */
0168     G4AssemblyVolume* fAssembly = nullptr;
0169 
0170     /** True if the logical or assembly volume has reflection. */
0171     G4bool fIsReflection = false;
0172 };
0173 
0174 #include "G4AssemblyTriplet.icc"
0175 
0176 #endif