Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-07 09:11:39

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 // G4PVParameterised
0027 //
0028 // Class description:
0029 //
0030 // Represents many touchable detector elements differing in their
0031 // positioning and dimensions. Both are calculated by means
0032 // of a G4VParameterisation object. The positioning is assumed to
0033 // be dominant along a specified Cartesian axis.
0034 
0035 // Author: Paul Kent (CERN), 29.07.1995 - First non-stub version
0036 // ----------------------------------------------------------------------
0037 #ifndef G4PVPARAMETERISED_HH
0038 #define G4PVPARAMETERISED_HH
0039 
0040 #include "G4PVReplica.hh"
0041 
0042 /**
0043  * @brief G4PVParameterised represents many touchable detector elements
0044  * differing in their positioning and dimensions. Both are calculated by means
0045  * of a G4VParameterisation object. The positioning is assumed to be dominant
0046  * along a specified Cartesian axis.
0047  */
0048 
0049 class G4PVParameterised : public G4PVReplica
0050 {
0051   public:
0052 
0053     /**
0054      * Replicates the volume 'nReplicas' times using the paramaterisation
0055      * 'pParam', within the mother volume 'pMotherLogical'.
0056      * The positioning of the replicas is dominant along the specified axis.
0057      *  @param[in] pName The volume name.
0058      *  @param[in] pLogical Pointer to the logical volume of the replica.
0059      *  @param[in] pMotherLogical Pointer to the logical volume of the mother.
0060      *  @param[in] pAxis The axis along which do the replication.
0061      *  @param[in] nReplicas The number of copies to replicate.
0062      *  @param[in] pParam Pointer to the provided parameterisation algorithm.
0063      *  @param[in] pSurfChk Boolean flag, if true activates check for overlaps
0064      *             with existing volumes (false by default).
0065      */
0066     G4PVParameterised(const G4String& pName,
0067                             G4LogicalVolume* pLogical,
0068                             G4LogicalVolume* pMotherLogical,
0069                       const EAxis pAxis,
0070                       const G4int nReplicas,
0071                             G4VPVParameterisation* pParam,
0072                             G4bool pSurfChk = false);
0073  
0074     /**
0075      * Similar to the constructor above, except for the mother pointer's type
0076      * being here a G4VPhysicalVolume.
0077      *  @param[in] pName The volume name.
0078      *  @param[in] pLogical Pointer to the logical volume of the replica.
0079      *  @param[in] pMother Pointer to the physical volume of the mother.
0080      *  @param[in] pAxis The axis along which do the replication.
0081      *  @param[in] nReplicas The number of copies to replicate.
0082      *  @param[in] pParam Pointer to the provided parameterisation algorithm.
0083      *  @param[in] pSurfChk Boolean flag, if true activates check for overlaps
0084      *             with existing volumes (false by default).
0085      */
0086     G4PVParameterised(const G4String& pName,
0087                             G4LogicalVolume* pLogical,
0088                             G4VPhysicalVolume* pMother,
0089                       const EAxis pAxis,
0090                       const G4int nReplicas,
0091                             G4VPVParameterisation* pParam,
0092                             G4bool pSurfChk = false);
0093 
0094     /**
0095      * Fake default constructor for usage restricted to direct object
0096      * persistency for clients requiring preallocation of memory for
0097      * persistifiable objects.
0098      */
0099     G4PVParameterised(__void__&);
0100 
0101     /**
0102      * Default Destructor.
0103      */
0104     ~G4PVParameterised() override = default;
0105 
0106     /**
0107      * Returns true to identify if it is a parameterised physical volume.
0108      */
0109     G4bool IsParameterised() const override;
0110 
0111     /**
0112      * Returns the volume type characterisation.
0113      */
0114     EVolume VolumeType() const final;
0115    
0116     /**
0117      * Returns the current pointer to the parameterisation algorithm.
0118      */
0119     G4VPVParameterisation* GetParameterisation() const override;
0120 
0121     /**
0122      * Fills arguments with the attributes from the base replica.
0123      * @param[in,out] axis Axis of parameterisation returned.
0124      * @param[in,out] nReplicas The number of replica copies.
0125      * @param[in,out] width Width of the replica object.
0126      * @param[in,out] offset Potential offset in replication.
0127      * @param[in,out] consuming Flag of replica characterisation (always false
0128      *                for parameterisations).
0129      */
0130     void GetReplicationData(EAxis& axis,
0131                             G4int& nReplicas,
0132                             G4double& width,
0133                             G4double& offset,
0134                             G4bool& consuming) const override;
0135 
0136     /**
0137      * Sets code and can prepare for special type of regular volumes.
0138      */
0139     void SetRegularStructureId( G4int code ) override; 
0140 
0141     /**
0142      * Verifies if each instance of the parameterised volume is overlapping
0143      * with other instances or with the mother volume. Provides default
0144      * resolution for the number of points to be generated and verified.
0145      * A tolerance for the precision of the overlap check can be specified,
0146      * by default it is set to maximum precision.
0147      * Reports a maximum of overlaps errors according to parameter in input.
0148      *  @param[in] res The number of points to generate on volume's surface.
0149      *  @param[in] tol The precision tolerance for the overlap check, below
0150      *             which to ignore overlaps (deafult is maximim precision).
0151      *  @param[in] verbose Verbosity mode (default is true).
0152      *  @param[in] maxErr Maximum of overlaps errors to report (default is 1).
0153      *  @returns True if an overlap occurs.
0154      */
0155     G4bool CheckOverlaps(G4int res = 1000, G4double tol = 0.,
0156                          G4bool verbose = true, G4int maxErr = 1) override;
0157 
0158   private:
0159 
0160     /** The pointer to the parameterisation algorithm. */
0161     G4VPVParameterisation* fparam = nullptr; 
0162 };
0163 
0164 #endif