|
|
|||
File indexing completed on 2026-09-24 09:10:22
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 // G4VDivisionParameterisation 0027 // 0028 // Class description: 0029 // 0030 // Base class for parameterisations defining divisions of volumes 0031 // for different kind of CSG and specific solids. 0032 0033 // Author: Pedro Arce (CIEMAT), 09.05.2001 - Initial version 0034 // Ivana Hrivnacova (Orsay), 08.04.2004 - Implemented reflection 0035 // Makoto Asai (SLAC), 21.04.2010 - Added gaps 0036 //--------------------------------------------------------------------- 0037 #ifndef G4VDIVISIONPARAMETERISATION_HH 0038 #define G4VDIVISIONPARAMETERISATION_HH 1 0039 0040 #include "G4Types.hh" 0041 #include "geomdefs.hh" 0042 #include "G4VPVParameterisation.hh" 0043 #include "G4RotationMatrix.hh" 0044 0045 enum DivisionType { DivNDIVandWIDTH, DivNDIV, DivWIDTH }; 0046 0047 class G4VPhysicalVolume; 0048 class G4VSolid; 0049 0050 /** 0051 * @brief G4VDivisionParameterisation is the base class for parameterisations 0052 * defining divisions of volumes for different kind of CSG and specific solids. 0053 */ 0054 0055 class G4VDivisionParameterisation : public G4VPVParameterisation 0056 { 0057 public: 0058 0059 /** 0060 * Constructor with number of divisions and width. 0061 * @param[in] axis The axis along which do the division. 0062 * @param[in] nDiv The number of division copies to replicate. 0063 * @param[in] width The witdh of the divided slice along the axis. 0064 * @param[in] offset The optional offset distance from mother's border. 0065 * @param[in] divType The kind of division type, based on input parameters. 0066 * @param[in] motherSolid Pointer to the solid to be divided. 0067 */ 0068 G4VDivisionParameterisation( EAxis axis, 0069 G4int nDiv, 0070 G4double width, 0071 G4double offset, 0072 DivisionType divType, 0073 G4VSolid* motherSolid = nullptr ); 0074 0075 /** 0076 * Destructor. 0077 */ 0078 ~G4VDivisionParameterisation() override; 0079 0080 /** 0081 * Invokes the base parameterisation to compute the parameterised solid. 0082 * @param[in] pv Pointer to the physical volume to divide. 0083 * @returns The pointer to the generated solid slice. 0084 */ 0085 G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume* pv) override; 0086 0087 /** 0088 * Base method to be implemented in derived classes for defining the 0089 * transformation in the parameterisation. 0090 */ 0091 void ComputeTransformation(const G4int copyNo, 0092 G4VPhysicalVolume* physVol) const override = 0; 0093 0094 /** 0095 * Accessors and setters. 0096 */ 0097 inline const G4String& GetType() const; 0098 inline EAxis GetAxis() const; 0099 inline G4int GetNoDiv() const; 0100 inline G4double GetWidth() const; 0101 inline G4double GetOffset() const; 0102 inline G4VSolid* GetMotherSolid() const; 0103 inline void SetType(const G4String& type); 0104 inline void SetHalfGap(G4double hg); 0105 inline G4double GetHalfGap() const; 0106 0107 protected: 0108 0109 /** 0110 * Defines and sets rotation on Z in trasformation for given volume. 0111 * @param[in,out] physVol Pointer to the physical volume to apply rotation. 0112 * @param[in] rotZ The rotation on Z (default is 0). 0113 */ 0114 void ChangeRotMatrix( G4VPhysicalVolume* physVol, 0115 G4double rotZ = 0.0 ) const; 0116 0117 /** 0118 * Calculates the number of divisions, based on the input parameters. 0119 * @param[in] motherDim The width of the volume to divide. 0120 * @param[in] width The width of the division slice. 0121 * @param[in] offset The optional offset distance from mother's border. 0122 * @returns The number of divisions. 0123 */ 0124 G4int CalculateNDiv( G4double motherDim, G4double width, 0125 G4double offset ) const; 0126 0127 /** 0128 * Calculates the slice width, based on the input parameters. 0129 * @param[in] motherDim The width of the volume to divide. 0130 * @param[in] nDiv The number of division slices to create. 0131 * @param[in] offset The optional offset distance from mother's border. 0132 * @returns The width of the division slice. 0133 */ 0134 G4double CalculateWidth( G4double motherDim, G4int nDiv, 0135 G4double offset ) const; 0136 0137 /** 0138 * Checks the validity of parameters given in input, issuing an exception. 0139 */ 0140 virtual void CheckParametersValidity(); 0141 0142 /** 0143 * Internal methods for checking parameters. 0144 */ 0145 void CheckOffset( G4double maxPar ); 0146 void CheckNDivAndWidth( G4double maxPar ); 0147 0148 /** 0149 * Returns the max width along the axis of division. 0150 * @returns The maximum width of the solid to divide along the axis. 0151 */ 0152 virtual G4double GetMaxParameter() const = 0; 0153 0154 /** 0155 * Sets the offset, taking into account potential reflection. 0156 */ 0157 G4double OffsetZ() const; 0158 0159 protected: 0160 0161 G4String ftype; // String for division type 0162 EAxis faxis; // Axis of division 0163 G4int fnDiv = 0; // Number of divisions 0164 G4double fwidth = 0.0; // Width of division slice 0165 G4double foffset = 0.0; // Offset distance from mother's border 0166 DivisionType fDivisionType; // Division type ID 0167 G4VSolid* fmotherSolid = nullptr; // Pointer to solid to divide 0168 G4bool fReflectedSolid = false; // Specifies if solid is reflected 0169 G4bool fDeleteSolid = false; // Specifies if delete solid to divide 0170 0171 static G4ThreadLocal G4RotationMatrix* fRot; // Rotation transformation 0172 0173 static const G4int verbose; // Verbosity level 0174 0175 G4double kCarTolerance; // Cached surface tolerance 0176 0177 G4double fhgap = 0.0; // Cached gap between slices 0178 }; 0179 0180 #include "G4VDivisionParameterisation.icc" 0181 0182 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|